Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 294268 - sys-kernel/genkernel- a patch to let an iso boot via grub2
Summary: sys-kernel/genkernel- a patch to let an iso boot via grub2
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Genkernel Maintainers
Keywords: InVCS
Depends on:
Reported: 2009-11-23 19:01 UTC by Andreas Schürch
Modified: 2010-12-25 00:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

patch against sys-kernel/genkernel- to let it boot as iso via grub2 (grub2-genkernel.patch,1.73 KB, patch)
2009-11-23 19:03 UTC, Andreas Schürch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schürch gentoo-dev 2009-11-23 19:01:11 UTC
This patch makes it possible to boot a genkernel-based livecd as iso directly from grub2. 

Reproducible: Always

The idea behind it is to have for example a gentoo-minimal-install.iso on a local drive as fallback... :-)

I introduced a new boot-parameter called isoboot which holds the relative path on the partition to the iso like "isoboot=/home/user/isos/gentoo.iso".
If this parameter is set, then it searches that file (during the normal find-cd-loop) and mounts the partition which holds the iso as /mnt/isodisk. The rest is like the old behavior (the iso gets mounted on /mnt/cdrom)... 

To boot a gentoo livecd, the grub2 config should look like the following:

menuentry "Gentoo Linux minimal install cd x86" {
        loopback loop (hd0,3)/home/mad/install-x86-minimal.iso
        linux (loop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot initrd=gentoo.igz vga=791 isoboot=/home/mad/install-x86-minimal.iso
        initrd (loop)/isolinux/gentoo.igz

I've tested it via a homegrown gentoo livecd and it works at least for me (booted as .iso and as real-cd).
Comment 1 Andreas Schürch gentoo-dev 2009-11-23 19:03:16 UTC
Created attachment 211005 [details, diff]
patch against sys-kernel/genkernel- to let it boot as iso via grub2
Comment 2 Andrew Gaffney (RETIRED) gentoo-dev 2009-11-24 13:34:13 UTC
What exactly does this do? I've been able to boot the CD as it is from grub-0.97 without anything extra (or maybe I'm thinking of liveusb...)
Comment 3 Andreas Schürch gentoo-dev 2009-11-24 14:37:51 UTC
You need to have grub2 (i've got 1.97beta1) to boot a plain iso-file which is laying somewhere (could be usb or a normal partition).
But the problem is, that grub just mounts it to start the kernel and get the initrd, but it is up to the linuxrc-script to actually do the rest. Therefore this patch! Without it, it just tries every block-device and searches for the recognition file (/livecd) on that device... but as an iso isn't really a blockdevice, it will fail to boot with the message "Media not found! Could not find CD to boot, something else needed!" (tested with the 20091103 minimal iso).

The patch just mounts the partition with the iso-file on it to /mnt/iso and then loop-mounts the iso to /mnt/cdrom. Without the new bootparameter, it's the old behavior...
Have a look at the forums-link... i've also got fooled around at first! ;-)
Comment 4 Andrew Gaffney (RETIRED) gentoo-dev 2009-12-27 00:30:48 UTC
I've applied a modified version of this patch in git.
Comment 5 Sebastian Pipping gentoo-dev 2010-12-25 00:43:46 UTC
Included in, closing.