Boot ISO With Grub

From GNU Radio
Revision as of 01:36, 8 March 2017 by Mbr0wn (talk | contribs) (Imported from Redmine)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Boot ISO With Grub

The ISO must be placed on an EXT4 formatted partition!.

Before you begin, create a backup of your grub.cfg

> cp /boot/grub/grub.cfg{,.bak}

Locate the partition you want to use for the ISO.

> [mj@gnu ~]$ df -h
> Filesystem Size Used Avail Use% Mounted on
> /dev/sdb2 15G 3.5G 12G 24% /
> /dev/sdb3 21G 4.5G 16G 23% /home
> /dev/sdb4 20G 5.3G 14G 29% /var/iso
> /dev/sdb1 511M 37M 475M 8% /boot

It will return a list of partitions, and where they are mounted. In this case, I have a dedicated partition for ISO files.

My ISO file is named gnuradio.iso and resides in /var/iso

When you add your entry in grub, it is very important to add the path of the ISO relative to the partition. In this case, the ISO file is in the root of the partition. This is not relative to your system's root.

In /etc/grub.d/40_custom add:

> menuentry "GNU Radio Linux (ISO)" {
> set isofile="/gnuradio.iso"
> loopback loop (hd1,4)$isofile
> linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile toram noprompt noeject
> initrd (loop)/casper/initrd.lz
> }

You most likely need to tweak the grub entry.

> set isofile="/gnuradio.iso"

This is the path relative to the partition, where your ISO file is stored. I named the ISO something simple, so it's easy to update, without the need to update grub.

> loopback loop (hd1,4)$isofile

This line specifies which partition to use. In my setup, I have two hard disks. Where /dev/sdb is my main disk for my Linux OS.

To make it boot, I need to tell grub where to look. hd1 specifies it is my second disk /dev/sdb, and ,4 specifies it is partition 4. Which is /dev/sdb4.

> linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noprompt noeject
> initrd (loop)/casper/initrd.lz

Theese two lines tells how to boot the ISO. You can figgure theese out by mounting the ISO file (not covered here) and checking the boot folders.

The last thing you need to do, is update grub, to apply the changes. On Arch you do this:

> grub-mkconfig -o /boot/grub/grub.cfg

If you run a Debian flavored distribution, you're most likely looking for this:

> update-grub

Now you should be able to reboot and see a new entry in grub.

Sources:

http://ubuntuforums.org/showthread.php?t=1549847&page=3
https://help.ubuntu.com/community/Grub2/ISOBoot/Examples
https://wiki.archlinux.org/index.php/GRUB