Linking Boot Stage01 to Stage02
Posted: Sun Oct 11, 2015 11:01 pm
Hi every,
I am trying to get my second stage boot loader up and running and am running into some conceptual difficulties.
Currently my first stage boot loader does the following:
Now here comes my confusion. Usually, as I have been walking through single stage boot loaders and simple code examples, I have had the following workflow:
where I can directly execute this code:
OR
I can create a bootable image using the following commands:
then
finally running that image in bochs.
In my first example, would I be able to compile my stage01 boot loader, my stage02 boot loader, and then append stage02 binary to stage01 binary? That doesn't seem correct, as I need a FAT on my second, which isn't present in the current code.
It's 1am here now, and I can't formulate my words completely correctly. I will reformulate my question tomorrow morning to make it more clear.
I am trying to get my second stage boot loader up and running and am running into some conceptual difficulties.
Currently my first stage boot loader does the following:
- Clears the screen and sets a stack (for proof of concept)
- Resets the disk controller back to the first sector on the 0th head/drive
- Reads this into a disk buffer at 0x7E00 (just beyond where the boot loader is loaded into memory)
- ... unimplemented, a jump to that memory location to continue execution of stage02
- Writes a message to the screen (it has some data and code for this, using BIOS functions).
Code: Select all
nasm boot_stage02.asm -o STAGE02.SYS -f binNow here comes my confusion. Usually, as I have been walking through single stage boot loaders and simple code examples, I have had the following workflow:
Code: Select all
nasm <bootloader> -o <bootloader.bin> -f binCode: Select all
qemu-system-x86_64 bootloader.binI can create a bootable image using the following commands:
Code: Select all
truncate bootable.bin -s 1200kCode: Select all
mkisofs -o iso/boot.iso -b bootable.bin ./In my first example, would I be able to compile my stage01 boot loader, my stage02 boot loader, and then append stage02 binary to stage01 binary? That doesn't seem correct, as I need a FAT on my second, which isn't present in the current code.
It's 1am here now, and I can't formulate my words completely correctly. I will reformulate my question tomorrow morning to make it more clear.