Author: wmb Date: 2007-08-24 01:34:38 +0200 (Fri, 24 Aug 2007) New Revision: 577
Modified: ofw/fs/fatfs/partition.fth Log: Followup to r564 - Tighter heuristic for detecting the presence of a partition map; the old one was treating boot code as partition info. This new one also requires a couple of specific values (0 or 80) in the bootable byte.
Modified: ofw/fs/fatfs/partition.fth =================================================================== --- ofw/fs/fatfs/partition.fth 2007-08-23 23:31:44 UTC (rev 576) +++ ofw/fs/fatfs/partition.fth 2007-08-23 23:34:38 UTC (rev 577) @@ -17,8 +17,12 @@ \ 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 + \ In partition maps, the status byte is 0 (not bootable) or 80 (bootable) + sector-buf h# 1be + c@ h# 7f and 0<> ( unpartitioned? ) + \ and the end of the sector contains a signature + sector-buf h# 1fe + le-w@ h# aa55 <> or ( unpartitioned?' ) + \ and the first partition entry has a non0 starting sector number + sector-buf h# 1c6 + le-l@ 0= or ( unpartitioned?' ) ;
: ptable-bounds ( -- end start ) sector-buf h# 1be + h# 40 bounds ;