Page 1 of 1

Creating and writing to reserved sectors

Posted: Wed Mar 30, 2016 6:46 pm
by collisiondetection
My operating system is currently just a bootloader (I've spent more time researching and theorizing than actual programming). One thing on my wishlist is a filesystem-independent bootloader.

I am aware that GRUB accomplishes this by keeping a "Stage 1.5" in the reserved area of a disk, but I wonder how it is possible to format a disk (a FAT12 floppy disk, for example) with reserved sectors in which I can place files into.

Does anybody know of a program (or system utility built into some OS I'm not aware of) that can format disks with certain filesystems and with reserved sectors?

Re: Creating and writing to reserved sectors

Posted: Thu Mar 31, 2016 1:07 am
by b.zaar
Grub uses reserved sectors on a partitioned disk. A FAT12 floppy isn't really large enough to include reserved sectors as well as the file system.

Re: Creating and writing to reserved sectors

Posted: Thu Mar 31, 2016 2:30 am
by mikegonta
b.zaar wrote:Grub uses reserved sectors on a partitioned disk. A FAT12 floppy isn't really large enough to include reserved sectors as well as the file system.
Those are hidden sectors. You can reserve as many sectors as you want on any FAT file system (as long as you leave some of the available sectors
available for data of course).

Re: Creating and writing to reserved sectors

Posted: Thu Mar 31, 2016 5:32 am
by collisiondetection
Yes, but how does one accomplish this? I know how GRUB does it - I'm just stumped figuring out how to do it myself.

Re: Creating and writing to reserved sectors

Posted: Thu Mar 31, 2016 6:18 am
by embryo2
collisiondetection wrote:Yes, but how does one accomplish this? I know how GRUB does it - I'm just stumped figuring out how to do it myself.

Read about FAT format and just write your data accordingly. To write a sector you have BIOS functions. Just use them. You already have a bootloader, then the rest is relatively simple. Or you can write required bytes as a file under your preferred OS and next to copy the file to the beginning of a disk. Under Linux it is the dd program that can help you. Under WindowsXP it is the HxD program. May be there are other programs. Just google for them.

Re: Creating and writing to reserved sectors

Posted: Thu Mar 31, 2016 6:24 am
by iansjack

Re: Creating and writing to reserved sectors

Posted: Thu Mar 31, 2016 12:24 pm
by mikegonta
embryo2 wrote:Under Linux it is the dd program that can help you.
The Windows version of DD works on all versions up to and including Windows 7.
embryo2 wrote:Under WindowsXP it is the HxD program.
They are obviously two totally different programs (HxD is not a replacement for DD), however HxD is an excellent disk editor and
works on all versions up to and including Windows 7. Both programs probably also work on Windows 10, however I can not personally verify that.

Re: Creating and writing to reserved sectors

Posted: Thu May 19, 2016 6:13 am
by alexander
mikegonta wrote:
embryo2 wrote:Under Linux it is the dd program that can help you.
The Windows version of DD works on all versions up to and including Windows 7.
embryo2 wrote:Under WindowsXP it is the HxD program.
They are obviously two totally different programs (HxD is not a replacement for DD), however HxD is an excellent disk editor and
works on all versions up to and including Windows 7. Both programs probably also work on Windows 10, however I can not personally verify that.
I can confirm that HxD works flawlessly on Windows 10

Re: Creating and writing to reserved sectors

Posted: Thu May 19, 2016 8:08 am
by mikegonta
alexander wrote:
mikegonta wrote:
embryo2 wrote:Under Linux it is the dd program that can help you.
The Windows version of DD works on all versions up to and including Windows 7.
embryo2 wrote:Under WindowsXP it is the HxD program.
They are obviously two totally different programs (HxD is not a replacement for DD), however HxD is an excellent disk editor and
works on all versions up to and including Windows 7. Both programs probably also work on Windows 10, however I can not personally verify that.
I can confirm that HxD works flawlessly on Windows 10
How about DD for Windows on Win10?

Re: Creating and writing to reserved sectors

Posted: Thu May 26, 2016 6:43 am
by alexander
mikegonta wrote: How about DD for Windows on Win10?
I'll see if I can test that for you.

Edit:I assume you are talking about: http://www.chrysocome.net/dd and not https://sourceforge.net/projects/windd/