summaryrefslogtreecommitdiff
path: root/sys/src/boot
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-09-01 21:18:11 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-09-01 21:18:11 +0200
commitb14138c2ae17ac725bd48ab736414770aed6d656 (patch)
tree642633abf4aeaeb66753f1dc1e55db7da285c9c0 /sys/src/boot
parent243cb68011ac5335bb2f9fc146d0f6be2d283fa9 (diff)
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.
Diffstat (limited to 'sys/src/boot')
-rw-r--r--sys/src/boot/pc/fat.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/src/boot/pc/fat.c b/sys/src/boot/pc/fat.c
index 35a8f9603..7b90234b4 100644
--- a/sys/src/boot/pc/fat.c
+++ b/sys/src/boot/pc/fat.c
@@ -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))