Years ago, I used GRUB and memdisk to boot directly from ISO images I kept in /boot/. Things like SpinRite, F4UBD, PLPBT and so on. It was pretty straightforward on 32-bit Linux using GRUB.
Then GRUB2 came along and I found it frustrating. What made it even worse was that much of what I found on the Internet was specific to Ubuntu and the non-standard way in which Ubuntu implements things. As well, for the Ubuntu crowd, solutions were presented as recipes, so copy-paste ruled the day without any explanation as to why certain settings were chosen and what options were available. In other words, it was difficult to translate these "solutions" to anything but Ubuntu Linux.
For Mageia, it is helpful to know what the distro uses as the default directories. Mageia provides the following file:
# /etc/grub-customizer/grub.cfg
# Configuration file for grub-customizer
#(not to be confused with grub.cfg for grub2)#Command name changes for
Mageia.MKCONFIG_CMD=grub2-mkconfig
INSTALL_CMD=grub2-install
MKFONT_CMD=grub2-mkfont
# These are the default configuration file locations used by grub2 in Mageia.
CFG_DIR=/etc/grub.d
OUTPUT_DIR=/boot/grub2
OUTPUT_FILE=/boot/grub2/grub.cfg
SETTINGS_FILE=/etc/default/grub
Also note that to avoid confusion with GRUB commands, all GRUB2 commands in Mageia are prefixed with grub2-*.
Where Is the GRUB2 Bootloader Installed?
Reboot your machine and enter the GRUB2 menu and press C which brings you to the GRUB2 command prompt. For now, the only one that you need is: ls.
To discover this, the following two commands are useful.
$ sudo grub2-probe -t device /boot/grub2
which in my case, returns /dev/sdc1.
To discover the UUID of the device,
$sudo grub2-probe -t fs_uuid /boot/grub2
Let's create a custom GRUB2 menu entry for F4UBCD. Falcon 4's Universal Boot CD is Grub4DOS-based and provides many system utilities as well as a running Windows MiniXP . The intent is to provide tools to repair computer systems. The ISO image contains a readme.txt file with a plethora of information The information about the ISO image is:
But what kind of ISO image is it? Standard or Hybrid? Using fdisk -l on the image, a hybrid ISO image will look like a hard drive with partitions, a standard ISO image will look like this:
Here's what a custom script will look like to boot a grub4dos ISP image, F4UBCD.iso.
menuentry "F4UBCD" {
This is our first line that provides the name of the menu entry to GRUB2; it always ends with a left curly bracket. The entire menu entry will end with a right curly bracket.
These three lines load modules necessary for GRUB2 to look inside the image. These modules provide iso9660 support which is needed to read optical discs that use this filesystem, provide support for MS-DOS (MBR) partitions and partitioning tables and provide support for MS-DOS (MBR) partitions and partitioning tables.
chainloader (hd2,0)+1
}
This line invokes the chainloader on the hard drive discovered above.
RESOURCES
https://help-grub.gnu.narkive.com/nLb4Hafg/grub-2-how-boot-iso-with-memdisk
https://askubuntu.com/questions/1254298/boot-ubuntu-iso-pure-from-ramdisk-memdisk
http://www.ultimatebootcd.com/forums/viewtopic.php?p=9108#p9108
http://www.panticz.de/MultiBootUSB
https://www.gnu.org/software/grub/grub-documentation.html
https://pccloud9.com/Files/F4UBCD-4.61.iso
https://help.ubuntu.com/community/Grub2/CustomMenus
https://help.ubuntu.com/community/Grub2/ISOBoot
https://help.ubuntu.com/community/Grub2/ISOBoot/Examples
2
https://wiki.gentoo.org/wiki/GRUB2/Chainloading
https://unix.stackexchange.com/questions/15015/how-to-boot-from-iso-with-grub2-burg-boot-loader
Comments