This image can be run and test with QEMU tool emulator like any ISO CDROM image.
You can build your kernel with any assembler and use this steps to test it.
I used the FASM assembly tool. Into my fasm folder I create these folders:
You need a stage2 file known like: stage2_eltorito.
[mythcat@desk fasm]$ mkdir -p iso/boot/grub
This file uses the El Torito is a specification for bootable CD using BIOS functions.
The GRUB supports the no emulation mode in the El Torito specification.
El Torito file booting begins by the Boot Record of the ISO 9660 filesystem at block address 0x11.
You can get this file from your Linux distro of you can find installed into old GRUB.
Put this file into grub folder:
Use fasm tool with your kernel and use this commands to create the ISO file:
[mythcat@desk fasm] cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub/
Now you can test the result:
[mythcat@desk fasm]$ ./fasm kernel.asm flat assembler version 1.73.04 (16384 kilobytes memory) 2 passes, 16756 bytes. [mythcat@desk fasm]$ cp kernel.o iso/boot/kernel.k [mythcat@desk fasm]$ cat > iso/boot/grub/menu.lst << EOF > default 0 > timeout 1 > title fasm multiboot > kernel /boot/kernel.k > EOF [mythcat@desk fasm]$ genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o mykernel.iso iso I: -input-charset not specified, using utf-8 (detected in locale settings) Size of boot image is 4 sectors -> No emulation Total translation table size: 2048 Total rockridge attributes bytes: 920 Total directory bytes: 4096 Path table size(bytes): 34 Max brk space used 24000 241 extents written (0 MB)
This is result of my kernel:
[mythcat@desk fasm]$ qemu-system-i386 -cdrom mykernel.iso