Editing Boot ISO With Grub

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
 +
= Boot ISO With Grub =
 +
 
'''The ISO must be placed on an EXT4 formatted partition!.'''
 
'''The ISO must be placed on an EXT4 formatted partition!.'''
  
Line 4: Line 6:
  
 
<pre>
 
<pre>
cp /boot/grub/grub.cfg{,.bak}
+
&gt; 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
+
&gt; [mj@gnu ~]$ df -h<br />
Filesystem Size Used Avail Use% Mounted on
+
&gt; Filesystem Size Used Avail Use% Mounted on<br />
/dev/sdb2 15G 3.5G 12G 24% /
+
&gt; /dev/sdb2 15G 3.5G 12G 24% /<br />
/dev/sdb3 21G 4.5G 16G 23% /home
+
&gt; /dev/sdb3 21G 4.5G 16G 23% /home<br />
/dev/sdb4 20G 5.3G 14G 29% /var/iso
+
&gt; '''/dev/sdb4 20G 5.3G 14G 29% /var/iso'''<br />
/dev/sdb1 511M 37M 475M 8% /boot
+
&gt; /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 23: Line 25:
 
In /etc/grub.d/40_custom add:
 
In /etc/grub.d/40_custom add:
  
<pre>menuentry "GNU Radio Linux (ISO)" {
+
<pre>&gt; menuentry &quot;GNU Radio Linux (ISO)&quot; {<br />
set isofile="/gnuradio.iso"
+
&gt; set isofile=&quot;/gnuradio.iso&quot;<br />
loopback loop (hd1,4)$isofile
+
&gt; loopback loop (hd1,4)$isofile<br />
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile toram noprompt noeject
+
&gt; linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile toram noprompt noeject<br />
initrd (loop)/casper/initrd.lz
+
&gt; initrd (loop)/casper/initrd.lz<br />
}
+
&gt; }
 
</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"
+
&gt; set isofile=&quot;/gnuradio.iso&quot;
 
</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
+
&gt; 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 43: Line 45:
 
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
+
&gt; linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noprompt noeject<br />
initrd (loop)/casper/initrd.lz
+
&gt; 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 50: Line 52:
 
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
+
&gt; 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
+
&gt; 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 60: Line 62:
 
Sources:
 
Sources:
  
[[http://ubuntuforums.org/showthread.php?t=1549847&amp;page=3 http://ubuntuforums.org/showthread.php?t=1549847&amp;page=3]]<br />
+
[[http://ubuntuforums.org/showthread.php?t=1549847&amp;page=3|http://ubuntuforums.org/showthread.php?t=1549847&amp;page=3]]<br />
[[https://help.ubuntu.com/community/Grub2/ISOBoot/Examples 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|https://wiki.archlinux.org/index.php/GRUB]]

Please note that all contributions to GNU Radio are considered to be released under the Creative Commons Attribution-ShareAlike (see GNU Radio:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)