I am attempting to run the file os-image.bin in bochs and im getting the error "FATAL: No bootable device."
my bochsrc.bxrc is this:
floppya: 1_44=os-image.bin, status=inserted
boot: a
and the .bin is in bochs' directory, i think the issue may be to do with the way i created the binary the command i used was: "ar cru ps-image.bin kernel.bin boot_sect.bin"
but i have no idea how else i could create the .bin. "kernel.bin" was created by "ar cru kernel.bin kernel.o kernel_entry.o" and boot_sect.bin was created by "nasm boot_sect.asm -f -bin -o boot_sect.bin"
or is there a way i could convert this non-bootable .bin into a bootable .bin without it affecting the source code?
Can't boot .bin
-
- Posts: 1
- Joined: Sat Nov 25, 2017 2:31 pm
- Libera.chat IRC: exoticscarf
-
- Member
- Posts: 5586
- Joined: Mon Mar 25, 2013 7:01 pm
-
- Member
- Posts: 799
- Joined: Fri Aug 26, 2016 1:41 pm
- Libera.chat IRC: mpetch
Re: Can't boot .bin
Poor man's way would be to do something like this:
-Ttext=0x######## needs to changed to the virtual memory address (origin point) where the kernel will be loaded in memory. Don't use ar.
This assumes you aren't on Windows using Cygwin or MinGW linkers and compilers. As per usual I recommend using cross compilers.
Code: Select all
ld -nostdlib -melf_i386 -Ttext=0x######## kernel_entry.o kernel.o -o kernel.elf
objcopy -O binary kernel.elf kernel.bin
cat boot_sect.bin kernel.bin >os-image.bin
This assumes you aren't on Windows using Cygwin or MinGW linkers and compilers. As per usual I recommend using cross compilers.