[OpenBIOS] r564 - in ofw: disklabel fs/fatfs

svn at openbios.org svn at openbios.org
Fri Aug 17 23:23:31 CEST 2007


Author: wmb
Date: 2007-08-17 23:23:31 +0200 (Fri, 17 Aug 2007)
New Revision: 564

Modified:
   ofw/disklabel/methods.fth
   ofw/fs/fatfs/partition.fth
Log:
OLPC trac #2889 - handle disks that have a bogus duplicate BIOS Parameter
Block in sector 0 in addition to the real on in the partition.







Modified: ofw/disklabel/methods.fth
===================================================================
--- ofw/disklabel/methods.fth	2007-08-17 19:23:21 UTC (rev 563)
+++ ofw/disklabel/methods.fth	2007-08-17 21:23:31 UTC (rev 564)
@@ -69,7 +69,7 @@
 
    \ If we find certain things in the first sector, we need not bother
    \ with partitions, and we ignore the partition specification
-   fat?     if  get-disk-size exit  then
+   fat? unpartitioned?  and  if  get-disk-size exit  then
    dropin?  if  get-disk-size exit  then
    zip?     if  get-disk-size exit  then
 

Modified: ofw/fs/fatfs/partition.fth
===================================================================
--- ofw/fs/fatfs/partition.fth	2007-08-17 19:23:21 UTC (rev 563)
+++ ofw/fs/fatfs/partition.fth	2007-08-17 21:23:31 UTC (rev 564)
@@ -10,6 +10,17 @@
    sector-buf d# 16 + c@ 1 2 between and  ( flag )  \ #FATS ok?
 ;
 
+\ This is a lame check to see if there might be a partition map entry.
+\ It is for the case where the disk has a valid BPB in sector 0, but
+\ also has a partition that doesn't start at 0.  Thit is a bogus layout,
+\ but we need to handle it anyway, because people often screw up when
+\ using fdisk and mkdosfs under Linux.  It is too easy to run mkdosfs on
+\ the overall disk (not the partition).
+: unpartitioned?  ( -- flag )
+   sector-buf h# 1fe + le-w@ h# aa55 <>
+   sector-buf h# 1c6 + le-l@ 0=  or
+;
+
 : ptable-bounds  ( -- end start )  sector-buf  h# 1be +  h# 40  bounds  ;
 : ptable-sum  ( -- n )   0  ptable-bounds  do  i c@ +  loop  ;
 : fdisk?  ( -- flag )




More information about the OpenBIOS mailing list