Booting from iso9660 images using GRUB 2

In #grub one of the most asked questions is if GRUB can boot iso9660 images. Or better: how GRUB should do this, people don’t even think about if it would be possible or not. Of course this annoys many people and “GRUB can not boot CDROM images” is nowadays the most important line in the topic.

Actually, GRUB can read ISO9660(”iso”) images. It can for example loads the first few sectors and boot it. But most people do not realize is “what then?”. What would the loaded operating system do? It will most likely look for a CDROM, which it won’t find and fail.

A while ago I wrote a “loopback” command for GRUB 2. It makes it possible to load files from filesystem images. Think for example of a kernel and an initrd. But even this is not enough. The loaded kernel is not able to access the ISO9660 image just like that. The operating system needs support to deal with this. Somehow you need to pass the path of the ISO9660 image to the kernel and the kernel should loopback mount this image and use it.

So in order to use it I need an operating system that supports this. Sidux is one of those operating systems that do. The advantage of using GRUB 2 is that you do not need to extract the kernel+initrd manually, but can do this at boot time. So all you need is the ISO9660 image.

I managed to boot Sidux using GRUB 2 and the following commands (after renaming the .iso file):

loopback loop (hd0,7)/sidux.iso
linux (loop)/boot/vmlinuz boot=fll quiet vga=791 fromiso=/sidux.iso
initrd (loop)/boot/miniroot.gz
boot

This works perfectly and all you need is GRUB 2 and an the file
sidux-2007-02-200705281503-tartaros-kde-full.iso

I of course tried to do the same with Knoppix. It has a bootfrom option, but according to some forum post I found it doesn’t work when not booting from a CDROM. So I would have to wait until knoppix is fixed before this would work. I also hope Debian, Red Hat, etc will eventually make this possible.

What would be even better is that all CDROMs come with a multiboot bootloader as a file on the CDROM. For example /multiboot-IA32 for a PC CDROM (suggested by Robert Millan on #grub). This will make it possible to load some multiboot (multiboot2 perhaps?) kernel from the CDROM or CDROM image. That kernel (which can also be GRUB 2) will load a grub.cfg specific for the CDROM and boot it. To be able to load a ISO9660 image the multiboot-IA32 bootloader will need the path. The advantage of multiboot is that you can pass this path to the bootloader. If all distributions agree on this filename and agree on the argument to pass to the kernel to be “iso=”, it would be easy to boot such CDROMs without any legacy BIOS support, we can use ISO9660 images and perhaps even LinuxBIOS+GRUB2. Your firmware doesn’t even need CDROM support in the long term, GRUB2 just needs it and will get this support in the short term. And this can even be used on other architectures. Please let me know if this sounds like a good idea that will be supported. Perhaps we just need to create a new CDROM boot “standard” out of this :-).

Unrelated to this. This day I worked on inter frame decoding support for the Dirac decoder. I wrote support for a buffer of reference frames, although I have some doubts if this is done the right way. I made a start with the actual decoding. But this is buggy and crashes, so I have not yet committed this. More on this later this week.

Leave a Reply

You must be logged in to post a comment.