OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:25 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Can't boot .bin
PostPosted: Sat Nov 25, 2017 2:34 pm 
Offline

Joined: Sat Nov 25, 2017 2:31 pm
Posts: 1
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?


Top
 Profile  
 
 Post subject: Re: Can't boot .bin
PostPosted: Sat Nov 25, 2017 4:18 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
If all you have is ar, everything looks like a static library.

Why are you using ar?


Top
 Profile  
 
 Post subject: Re: Can't boot .bin
PostPosted: Sat Nov 25, 2017 6:35 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Amazonbot [bot] and 66 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group