9bootfat: always try plan9 partition even when not marked active, fix bug

always look for 9fat in plan9 partition even tho the partition
is *not* maked active. marking partitions active is not
recommended anymore with grub so this makes life easier for
some people. multiple plan9 partitions on a single drive
is not supported.

have to copy partition table as buf gets trashed when reading
first block of fat partition. it worked only when the first
fat partition found (the one marked active) was the right one,
but conffat() can fail.
front
cinap_lenrek 2013-09-01 21:18:11 +02:00
parent 243cb68011
commit b14138c2ae
1 changed files with 3 additions and 2 deletions

View File

@ -329,7 +329,7 @@ findfat(Fat *fat, int drive, ulong xbase, ulong lba)
uchar echs[3];
uchar lba[4];
uchar len[4];
} *p;
} p[4];
uchar buf[Sectsz];
int i;
@ -345,7 +345,7 @@ findfat(Fat *fat, int drive, ulong xbase, ulong lba)
if(!conffat(fat, buf))
return 0;
}
p = (void*)&buf[0x1be];
memmove(p, &buf[0x1be], sizeof(p));
for(i=0; i<4; i++){
switch(p[i].typ){
case 0x05:
@ -360,6 +360,7 @@ findfat(Fat *fat, int drive, ulong xbase, ulong lba)
default:
if(p[i].status != 0x80)
continue;
case 0x39: /* always try plan9 partition */
fat->drive = drive;
fat->partlba = lba + GETLONG(p[i].lba);
if(readsect(drive, fat->partlba, buf))