Boot ISO With Grub: Difference between revisions
No edit summary |
Devnulling (talk | contribs) (Fix formatting - html entities) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
'''The ISO must be placed on an EXT4 formatted partition!.''' | '''The ISO must be placed on an EXT4 formatted partition!.''' | ||
Line 6: | Line 4: | ||
<pre> | <pre> | ||
cp /boot/grub/grub.cfg{,.bak} | |||
</pre> | </pre> | ||
Locate the partition you want to use for the ISO. | Locate the partition you want to use for the ISO. | ||
<pre> | <pre> | ||
[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 | |||
</pre> | </pre> | ||
It will return a list of partitions, and where they are mounted. In this case, I have a dedicated partition for ISO files. | It will return a list of partitions, and where they are mounted. In this case, I have a dedicated partition for ISO files. | ||
Line 25: | Line 23: | ||
In /etc/grub.d/40_custom add: | In /etc/grub.d/40_custom add: | ||
<pre> | <pre>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 | |||
} | |||
</pre> | </pre> | ||
You most likely need to tweak the grub entry. | You most likely need to tweak the grub entry. | ||
<pre> | <pre> | ||
set isofile="/gnuradio.iso" | |||
</pre> | </pre> | ||
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. | 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. | ||
<pre> | <pre> | ||
loopback loop (hd1,4)$isofile | |||
</pre> | </pre> | ||
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. | 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. | ||
Line 45: | Line 43: | ||
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. | 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. | ||
<pre> | <pre> | ||
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noprompt noeject | |||
initrd (loop)/casper/initrd.lz | |||
</pre> | </pre> | ||
These two lines tells how to boot the ISO. You can figure these out by mounting the ISO file (not covered here) and checking the boot folders. | These two lines tells how to boot the ISO. You can figure these out by mounting the ISO file (not covered here) and checking the boot folders. | ||
Line 52: | Line 50: | ||
The last thing you need to do, is update grub, to apply the changes. On Arch you do this: | The last thing you need to do, is update grub, to apply the changes. On Arch you do this: | ||
<pre> | <pre> | ||
grub-mkconfig -o /boot/grub/grub.cfg | |||
</pre> | </pre> | ||
If you run a Debian flavored distribution, you're most likely looking for this: | If you run a Debian flavored distribution, you're most likely looking for this: | ||
<pre> | <pre> | ||
update-grub | |||
</pre> | </pre> | ||
Now you should be able to reboot and see a new entry in grub. | Now you should be able to reboot and see a new entry in grub. | ||
Line 62: | Line 60: | ||
Sources: | Sources: | ||
[[http://ubuntuforums.org/showthread.php?t=1549847&page=3]]<br /> | [[http://ubuntuforums.org/showthread.php?t=1549847&page=3 http://ubuntuforums.org/showthread.php?t=1549847&page=3]]<br /> | ||
[[https://help.ubuntu.com/community/Grub2/ISOBoot/Examples]]<br /> | [[https://help.ubuntu.com/community/Grub2/ISOBoot/Examples https://help.ubuntu.com/community/Grub2/ISOBoot/Examples]]<br /> | ||
[[https://wiki.archlinux.org/index.php/GRUB]] | [[https://wiki.archlinux.org/index.php/GRUB https://wiki.archlinux.org/index.php/GRUB]] |
Latest revision as of 00:48, 21 March 2017
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
These two lines tells how to boot the ISO. You can figure these 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]