EmbeddedRelated.com
Forums

Bootloading from SD card

Started by eeboy November 16, 2009
ArarghMail911NOSPAM@NOT.AT.Arargh.com wrote:

>It's not all that difficult for FAT12 or FAT16 if you restrict your >file to the root directory. I wrote a routine that searches the root >directory for a specific file, and reads it into memory via the FAT. I >think it took less than 512 bytes on an x86, not sure, but definitely >less than 1024 bytes. The boot sector is only 2 sectors long -- non >standard disk format - but I presume your routine would be in ROM or >flash so my non-standard format is not an issue.
I also did a FAT-12 PC bootsector in 512 bytes: http://my.execpc.com/~geezer/code/fatboot.zip This code requires that the second stage or kernel or whatever be in the root directory, but it need not be physically contiguous on the disk. FAT-16 wouldn't be too different, but I agree that a FAT-32 bootloader probably wouldn't fit in 512 bytes.
On Fri, 20 Nov 2009 00:45:15 GMT, NoEmailAds@execpc.com (Chris Giese)
wrote:

>ArarghMail911NOSPAM@NOT.AT.Arargh.com wrote: > >>It's not all that difficult for FAT12 or FAT16 if you restrict your >>file to the root directory. I wrote a routine that searches the root >>directory for a specific file, and reads it into memory via the FAT. I >>think it took less than 512 bytes on an x86, not sure, but definitely >>less than 1024 bytes. The boot sector is only 2 sectors long -- non >>standard disk format - but I presume your routine would be in ROM or >>flash so my non-standard format is not an issue. > >I also did a FAT-12 PC bootsector in 512 bytes: > http://my.execpc.com/~geezer/code/fatboot.zip > >This code requires that the second stage or kernel or whatever be >in the root directory, but it need not be physically contiguous on >the disk. > >FAT-16 wouldn't be too different,
13 vs 5 instructions for FAT12 vs FAT16 in the code I wrote.
>but I agree that a FAT-32 >bootloader probably wouldn't fit in 512 bytes.
No, I don't think it's even possible, but I haven't tried. And see no point doing so, either. :-) -- ArarghMail911 at [drop the 'http://www.' from ->] http://www.arargh.com BCET Basic Compiler Page: http://www.arargh.com/basic/index.html To reply by email, remove the extra stuff from the reply address.
On Fri, 20 Nov 2009 00:52:00 -0600,
ArarghMail911NOSPAM@NOT.AT.Arargh.com wrote:

>On Fri, 20 Nov 2009 00:45:15 GMT, NoEmailAds@execpc.com (Chris Giese) >wrote: > >>ArarghMail911NOSPAM@NOT.AT.Arargh.com wrote: >> >>>It's not all that difficult for FAT12 or FAT16 if you restrict your >>>file to the root directory. I wrote a routine that searches the root >>>directory for a specific file, and reads it into memory via the FAT. I >>>think it took less than 512 bytes on an x86, not sure, but definitely >>>less than 1024 bytes. The boot sector is only 2 sectors long -- non >>>standard disk format - but I presume your routine would be in ROM or >>>flash so my non-standard format is not an issue. >> >>I also did a FAT-12 PC bootsector in 512 bytes: >> http://my.execpc.com/~geezer/code/fatboot.zip >> >>This code requires that the second stage or kernel or whatever be >>in the root directory, but it need not be physically contiguous on >>the disk. >> >>FAT-16 wouldn't be too different, >13 vs 5 instructions for FAT12 vs FAT16 in the code I wrote.
Forgot to mention that I cheated and just copied the first 64k worth of FAT to memory. For FAT12, that handles the split across sectors headache.
>>but I agree that a FAT-32 >>bootloader probably wouldn't fit in 512 bytes. >No, I don't think it's even possible, but I haven't tried. > >And see no point doing so, either. :-)
-- ArarghMail911 at [drop the 'http://www.' from ->] http://www.arargh.com BCET Basic Compiler Page: http://www.arargh.com/basic/index.html To reply by email, remove the extra stuff from the reply address.