Hi,
My boot loader is simple right now but it consists of the first 512 bytes sector, then the first sector will load my second-stage loader from disk (using BIOS interrupts for this as of right now - but the second-stage is linked into the same BIN file) and then I enter p-mode (verified that all is working). I've also setup VBE with BIOS interrupt and verified that using it after entering p-mode is working fine.
If the second stage is linked into the same binary, then you probably want to do the way of N "reserved sectors" instead of bothering with filesystems yet. So it becomes like this:
Code: Select all
MBR => VBR => Stage2 from reserved sectors => Kernel from reserved sectors
instead of:
Code: Select all
MBR => VBR => Stage2 from filesystem => Kernel from filesystem
If you want to use a filesystem, you would probably need to do it the second way, as FAT leaves only 512 bytes for boot code, so stage2 cannot even fit there. But then again, in addition to what your stage1 already does, a basic read-only FAT driver is hard to fit in 512 bytes (not that it cannot be done though).
Note: The "reserved sectors" can be concatenated using:
Code: Select all
cat vbr.bin stage2.bin kernel.bin > reserved.bin
where "vbr.bin" is your VBR binary, "stage2.bin" is your stage2, "kernel.bin" is your kernel and "reserved.bin" is the file you can write to the start of the first partition of the virtual HDD.
OOI How do you boot your OS? Do you use a VFD or do you use a VHD/real HDD boot?
I returned to OS development about a week ago, after a break of about 2 years. I ditched my old code (I used GRUB there) and so far I managed to experiment with a MBR (which I ditched too because making partitioned disk images automatically is a hassle and because a pre-built partitioned disk image doesn't fit the geometry of the target HDD/USB drive, unless it's built specifically for it, practically it shouldn't matter though), with PXE (which I'm planning to continue later) and currently I'm writing a bootloader for CDs that are booted using El Torito in no-emulation mode. I suggest you don't try PXE yet, unless you want to mess a bit with a DHCP server setup (TFTP is trivial to setup a server for it though). As for CD images, you will have to burn a CD each time you want to test your OS on real HW (unless you make your CD images "hybrid", i.e. additionally put a MBR/GPT into the CD image, so the BIOS recognises the CD image as a HDD image that can be booted from USB -- the partitions of this masqueraded CD image still don't fit the geometry of the target USB drive, unless it's built specifically for it, practically it shouldn't matter though).
Regards,
glauxosdever