git: 9front

Download patch

ref: addcf037ca4dc1060318cfbd044f473ea594afe6
parent: a1ac58b98fe362b5e911ece04bceca4a0ed4a7af
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Mon Sep 23 17:12:41 EDT 2013

9bootfat: only check for fat at block 0 on floppy drives (thanks aap)

smart boot manager has a "FAT" signature in its mbr causing
9bootfat to "detect" it as a fat filesystem and then fails
to find plan9.ini.

there shouldnt be a fat filesystem on harddrives at block 0, only
on floppy drives. but some bioses use floppy drive numbers
for usb harddrives so still check for a partition table.

thanks aap for debugging this.

--- a/sys/src/boot/pc/fat.c
+++ b/sys/src/boot/pc/fat.c
@@ -339,7 +339,7 @@
 		return -1;
 	if(buf[0x1fe] != 0x55 || buf[0x1ff] != 0xAA)
 		return -1;
-	if(lba == 0){
+	if(lba == 0 && (drive & 0x80) == 0){	/* floppy */
 		fat->drive = drive;
 		fat->partlba = 0;
 		if(!conffat(fat, buf))
--