A bootsector that doesn't load the kernel :(

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

Post by kenneth_phough »

I have a couple questions about the FAT12 filesystem. I only have a vague idea of what a filesystem is and I have been reading articles on filesystems and FATs at www.wikipedia.org, however forgive me if I ask a wierd question. :oops:

I have read that because cluster addresses are only 12 bits long, this make coding a bit tricky. Is this true?

When I implement the FAT12 fs in my boot sector and if I want to test my OS in bochs can I do the following to "link" my bootsector and the second stage and kernel:

Code: Select all

cat bootstage1.bin bootstage2.bin kernel.bin > a.img
and can I write this image to a floppy disk too?

And finally would I need to follow the follwing structure for FAT12 fs bootsectors:
http://en.wikipedia.org/wiki/File_Alloc ... oot_Sector

Thanks,
Kenneth
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post by JAAman »

I have a couple questions about the FAT12 filesystem. I only have a vague idea of what a filesystem is and I have been reading articles on filesystems and FATs at www.wikipedia.org
heres another page that might help
http://www.mega-tokyo.com/osfaq/FAT12%20document
I have read that because cluster addresses are only 12 bits long, this make coding a bit tricky. Is this true?
only on FAT12 -- FAT16 uses 16bit cluster addresses, and FAT32 uses 32bit addresses, however, it really isnt that hard, you just have to read 16bits, then mask the unused portion (for some it will be the high bits, others it will be the low bits -- mask with a SLR)
When I implement the FAT12 fs in my boot sector and if I want to test my OS in bochs can I do the following to "link" my bootsector and the second stage and kernel:
you can -- but i wouldnt -- this is the option i mentioned:
though it is possible to load it from a specific sector (either reserved sector at the begining...
there are some who do this, the problem is, your second stage is likely going to be much more than just 1 sector, and this disk may not be readable (and may get corrupted writing) with a program which hard-codes commonly use values (quite common for FAT12), also it will be harder to update your second-stage -- if you read the second stage from a file, then you can update it simply by copying the new file onto the disk (DOS took some shortcuts, which wouldnt allow this -- the file had to start in the first cluster, however win95 and later do this properly)
And finally would I need to follow the follwing structure for FAT12 fs bootsectors:
http://en.wikipedia.org/wiki/File_Alloc ... oot_Sector
yes, you will, i would recommend using the extended BPB on all disks (though its not required for FAT12), as it will simplify moving to FAT16 (required for any partition larger than 32MB)
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

Post by kenneth_phough »

Thank you very much. I'm really getting to understand filesystems. I can't wait to get it to work. :D
Post Reply