Page 1 of 1

Can't for the life of me load my kernel!!

Posted: Tue Jul 09, 2013 7:28 pm
by necroCoder
Hello Everybody,
This is my first time posting in this forum, so... I've been attempting to write a bootloader that boots off of a floppy to load my next stage for the last couple of weeks now, and I'm having no success. I'm using VirtualBox along with the nasm assembler. I can usally get a simple bootloader assembled and working, but any time I try and get a kernel or a stage two loaded...nothing happens. I'm stuck and I think that my linking is wrong somewhere. Also I have tried to load off of an .iso file, and still no success. Does anybody know how to format a bootable .vdi formatted file?

Re: Can't for the life of me load my kernel!!

Posted: Tue Jul 09, 2013 10:52 pm
by Antti
You can create a bootable raw image with NASM. Then you can use VBoxManage program to convert that into .vdi format.
http://www.virtualbox.org/manual/ch08.html wrote:VBoxManage convertfromraw

This command converts a raw disk image to a VirtualBox Disk Image (VDI) file
In this case the command would be something like this:

Code: Select all

VBoxManage convertfromraw --format VDI <my_raw_image.bin> <my_vdi_image.vdi>
Be sure to check the manual for proper description. If you are creating a bootable floppy, then you can easily just use the raw-image directly. Rename the file extension to .img and the VirtualBox directly regocnizes (the file browser in Windows, in fact) it when you are attaching the image to floppy device. Also, make sure that the size of the image is something that is standardised for floppies. E.g. 1474560 bytes.

This trick works easily in NASM when you add this at last line in your NASM source (you probably did use same approach with the boot signature).

Code: Select all

times 1474560 - ($ - $$) db 0
Good luck with low-level programming and welcome to this forum! By the way, I think floppies are a good way to start. Creating a good hard-drive image is not so simple.

Re: Can't for the life of me load my kernel!!

Posted: Tue Jul 09, 2013 11:29 pm
by HugeCode
@Antti: for this purpose I used 'convertdd' command and I didn't need to have aligned size of file - if .img file was too small (128, 256KB...), vboxmanage created 1MB disk without complaining. Is this the difference between 'convertdd' and 'convertfromraw' (as 'convertdd' is older version of 'convertfromraw')?

Re: Can't for the life of me load my kernel!!

Posted: Wed Jul 10, 2013 12:22 am
by Antti
@HugeCode: I think all the converting methods handle the issue. When someone creates a floppy image directly, the "aligned" size matters. Whether that is created with NASM or some hex editor. Any of those converting methods are not in use in that case. VirtualBox accepts that flat format for floppies.