How to make an bootable iso(not cd or flash drive) for testing your own boot loader?

Terminal picture Terminal · Jan 14, 2011 · Viewed 9.1k times · Source

i am trying to write a boot loader(hello world sort). i am using Bochs for simulation (platform Linux-Ubuntu). But i am unable to make an bootable iso for my binary file. Though in tutorial VFD(virtual floppy disk) is used but it is for windows platform. Here is my code for bootloader ( just for testing)

;*********************************************
;    Boot1.asm
;        - A Simple Bootloader for testing if cd is booting or not
;
;    Operating Systems Development Tutorial
;*********************************************

[BITS 16]    ;tell the assembler that its a 16 bit code
[ORG 0x7C00]    ;Origin, tell the assembler that where the code will

Start:

    cli                    ; Clear all Interrupts
    hlt                    ; halt the system

times 510 - ($-$$) db 0                ; We have to be 512 bytes. Clear the rest of the bytes with 0

dw 0xAA55                    ; Boot Signature

i tried master ISO on Ubuntu. It is converting the binary file to ISO but not to bootable ISO. Bochs is showing error "cd is not eltorito" which i googled and found to be standard for bootable ISO.What additional things i have to add to it to make it bootable. i have already added boot signature in the end. Can anyone suggest a reliable application to make a bootable ISO on Ubuntu? My work is stuck due to this.... OR i am pretty sure a lot of people must be involved in OS development on Linux platform. How do you people test?

I have made a bootable flash-drive with Unetbootin with the iso of my bootloader program. switched to Virtual-box and twisted a bit to boot from pendrive, but still its showing it to be non-bootable. I think someone said it correctly that u need a lot of patience in OS development.


:phew finally my bootloader program ran...
I used virtual floppy image to boot my program on Virtual box. Here are the steps in case somebody is struggling with it.
1.Create boot.asm which have your bootloader program.
2.Compile with nasm. nasm -f bin boot.asm -o boot.bin.
3.sudo mkfs.msdos -C /home/username/floppy.img 1440
4.sudo chown username ./floppy.img. link text
5.Copy with dd. dd if=./boot.bin of=./floppy.img.
6.Run VirtualBox and select floppy.img as booting device in your new virtual machine.
PS: you can also attach floppy.img to device "loop" and mount it just as a real floppy disk.

Answer

user562374 picture user562374 · Jan 14, 2011

Amongst all the storage locations/methods of retrieval, CD-ROM/El-Torito is the oddball (and don't get me started on Mac CDROM filesystem hybrids)

With Floppy, Harddisk/USB or PXE-TFTP, it suffices to write the object code to the first sector, or in case of tftp, just download-and-execute. It can't get any easier with these.