How to manage running ELF on Bochs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
OSMAN

How to manage running ELF on Bochs

Post by OSMAN »

Hi!

My kernel is in ELF. When I set the 1_44=kernel.elf in bochsrc or something like that, Bochs won't run it even I've heared that PC can run ELF.

I'm too tired to make a new floppy image through a real floppy whith Grub every time I test my kernel, so I just want to run the ELF kernel.

Is there something wrong with my bochsrc? (I downloaded Bochs yesterday so I can't know):
///////////////////////////////////////
megs: 32
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
vga: extension=vbe
floppya: 1_44=kernel.elf, status=inserted
boot: a
log: bochs_log.txt
mouse: enabled=0
ips: 15000000
vga_update_interval: 150000
i440fxsupport: enabled=1
///////////////////////////////////////

Please help. It woul'd make this thing a lot easier :)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:How to manage running ELF on Bochs

Post by Pype.Clicker »

okay ...
ELF is a file format, and your BIOS (on both real PC and BOCHS) knows nothing about it at all. When you use 1_44=kernel.elf, the BIOS attempt to use the first 512 bytes of your ELF file as a bootsector, while it actually contains ELF header, sections description, symbols tables and things alike. Instead, GRUB _is_ a bootloader and it can distinguish an ELF file when it gets one (not that hard, the first 3 bytes are 'E', 'L', 'F') and it knows how to load it properly.

I suggest you head to the proper "disk image" section of the FAQ to see how you could just mount a floppy image that contains GRUB and just change the 'kernel.elf' file without using a real floppy on your system.
Post Reply