OSDev.org
https://forum.osdev.org/

Can't boot .bin
https://forum.osdev.org/viewtopic.php?f=1&t=32596
Page 1 of 1

Author:  exoticscarf [ Sat Nov 25, 2017 2:34 pm ]
Post subject:  Can't boot .bin

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?

Author:  Octocontrabass [ Sat Nov 25, 2017 4:18 pm ]
Post subject:  Re: Can't boot .bin

If all you have is ar, everything looks like a static library.

Why are you using ar?

Author:  MichaelPetch [ Sat Nov 25, 2017 6:35 pm ]
Post subject:  Re: Can't boot .bin

Poor man's way would be to do something like this:
Code:
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
-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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/