Page 1 of 1
FAT12 Reserved Sectors
Posted: Sun Feb 22, 2009 11:13 am
by poted
Hi, I need to make some reserved sectors on a FAT12 formatted floppy to store my second stage bootloader but I can't find any description of how to actually make these reserved sectors. Does anyone know of any tools that can format a floppy leaving reserved sectors? Also I read in a thread on this forum that changing the reserved sectors in the BPB is the way to do it but how does that actually change the layout of the disk and reserve the sectors.
Thanks a lot, Poted.
Re: FAT12 Reserved Sectors
Posted: Sun Feb 22, 2009 11:58 am
by egos
In FAT12 the number of reserved sectors is equal to 1, i.e. boot sector only. You can store your second stage boot loader in the file or at the end of the volume excluding it from volume space.
Re: FAT12 Reserved Sectors
Posted: Sun Feb 22, 2009 12:40 pm
by Dex
You can use this method, if other code plays ball eg: if other code add the [bpbReservedSectors] instead of just adding 1 etc.
You will need to write a formater or mod a format program or use a disk editor (eg: HxD) to move the sector on by the number you add in the bpbReservedSectors .
See here will help:
http://dex4u.com/USBboot.htm
NOTE: its for usb, but will work for floppy too.
Also goto here
http://home.comcast.net/~dexos/
and get the DexOS format program with source "ForDex.com with source", which you can mod to sute your needs.
Re: FAT12 Reserved Sectors
Posted: Mon Feb 23, 2009 3:04 am
by AJ
@OP: For your information, I have used this in the past my self and have also used the floppy disk on Windows without any problems.
Installing the system on to a blank image is simple - just stick your bootloader, along with BPB on to the first x sectors. The FAT and Root will then follow as usual. As dex says - if it's not a blank image, then the other structures need to be moved on manually.
The only word of caution I would give is that you will need to reformat each time your boot loader extends over the next 512b boundary and the first stage will need to know how many sectors to load. For this reason alone, I advocate the use of the file system to store a stage 1.5 boot loader.
Cheers,
Adam
Re: FAT12 Reserved Sectors
Posted: Mon Feb 23, 2009 12:51 pm
by poted
Thanks a lot everyone I managed to change Dex's ForDex formatting program to leave reserved sectors and it's all working great but one weird thing I noticed was that after formatting with it, windows claims that 340kb has been used when it hasn't (as I only made one reserved sector). All i changed in the code was the number which sets where the FATs and root directory are written to (made them one bigger so it leaves one reserved sector) how come windows is saying I have used so much of the disk?
Thanks a lot, Poted.
Re: FAT12 Reserved Sectors
Posted: Mon Feb 23, 2009 1:26 pm
by Dex
Its possable that windows is just adding one and taking your code as fat ?.
Try do the same, but instead of your code put zero's then see what happens under windows.
PS: That code is by one of DexOS team member's called "roboman"
Re: FAT12 Reserved Sectors
Posted: Mon Feb 23, 2009 2:35 pm
by poted
Thanks for all the help, I've managed to fix it, it was a stupid mistake I'd forgotten to change bpbReservedSectors in my bootloader so as Dex said windows thought that my code was part of the FAT after changing bpbReseveredSectors it all works fine. Thanks you for your help and thank you roboman for writing the formatting utility in the first place.
Re: FAT12 Reserved Sectors
Posted: Fri Feb 27, 2009 9:46 am
by roboman
Thanks for the comment and I'm glad some one found it of some use.