Bootloader to Kernel on HD with no Partition/File System
Posted: Tue Nov 20, 2012 5:09 pm
Hi,
I am very new to OS Development. I have strong programming skills, and while my background is not in hardware, I have a desire to learn. I would like to write as much as possible from scratch for this reason.
To this end, I have succeeded in writing a basic first stage bootloader that prints to the screen with BIOS interrupts. I would like to modify this bootloader to jump to a small kernel stored as a sequence of instructions located at a particular physical address on the hard drive. My suspicion is that what is actually necessary is for the first stage bootloader to load a second stage bootloader stored in the next few sectors, then transfer control. The second stage bootloader would then load the kernel from the hard drive.
The examples online discuss file systems and partitions. I do not want the hard drive to be partitioned or be formatted into a file system. I would like to ignore partitioning and also write my own file system later when developing the kernel. I do not know if this is possible architecturally, but it seems to me the simplest thing. What I'm thinking is something where the first sector is the stage one bootloader, then a few more sectors are the stage two bootloader, then some more sectors are the OS itself. The rest of the disk would be where the OS stores data--this is where the file system would have significance. Is this possible?
Additionally, I am presently stuck on writing code that loads a sector from a hard drive and transfers control. The closest I found is loading from a floppy drive. I tried adapting this code to load from a hard drive, but I could not. I was considering reverse engineering GRUB, but perhaps this community can suggest an easier way? I realize this is a basic question. If there is a tutorial on this topic, please point me to it.
Thank you!
I am very new to OS Development. I have strong programming skills, and while my background is not in hardware, I have a desire to learn. I would like to write as much as possible from scratch for this reason.
To this end, I have succeeded in writing a basic first stage bootloader that prints to the screen with BIOS interrupts. I would like to modify this bootloader to jump to a small kernel stored as a sequence of instructions located at a particular physical address on the hard drive. My suspicion is that what is actually necessary is for the first stage bootloader to load a second stage bootloader stored in the next few sectors, then transfer control. The second stage bootloader would then load the kernel from the hard drive.
The examples online discuss file systems and partitions. I do not want the hard drive to be partitioned or be formatted into a file system. I would like to ignore partitioning and also write my own file system later when developing the kernel. I do not know if this is possible architecturally, but it seems to me the simplest thing. What I'm thinking is something where the first sector is the stage one bootloader, then a few more sectors are the stage two bootloader, then some more sectors are the OS itself. The rest of the disk would be where the OS stores data--this is where the file system would have significance. Is this possible?
Additionally, I am presently stuck on writing code that loads a sector from a hard drive and transfers control. The closest I found is loading from a floppy drive. I tried adapting this code to load from a hard drive, but I could not. I was considering reverse engineering GRUB, but perhaps this community can suggest an easier way? I realize this is a basic question. If there is a tutorial on this topic, please point me to it.
Thank you!