Booting Puppy ISO files, enhanced loopback.cfg, utility to do it
Here are a couple of CLI utilities to enhance booting Puppy ISO files as a grub2 loopback device.
1) mk-grub2-cfgs generates an enhanced 'loopback.cfg' and a slightly enhanced 'grub.cfg',
as alternatives to the ones already in a release Puppy ISO file.
This utility takes a single parameter, the $NAME of the Puppy to use in the grub2 config files.
If no parameter is given, "Puppy Linux" is used as the $NAME.
The enhancements to 'loopback.cg' are:
support for an optional second passed grub variable, $rootuuid.
support for optional presence of 'local-initrd.gz'.
displays a message on the console indicating which files are being loaded by the 'initrd' line.
and adds 'pfix=fsckp'.
The $rootuuid grub variable contains the UUID of the partition where the ISO file resides.
If a $rootuuid variable is found, it is used, else the config file attempts to generate it.
Any $rootuuid variable is passed on to Puppy's 'isoboot' script as an "img_dev=" boot parameter.
This means that the 'isoboot' script does not have to wait 5 seconds in case of a slow device,
and it does not have to search each partition looking for the specified ISO file.
The $rootuuid is processed this way because booting utilities frequently do not provide it,
and Puppy will most likely still boot without it, just not as efficiently.
I found this variable name being used in the Manjaro grub2 stuff. (I did not just make it up.)
Run mk-grub2-cfgs.
Use an ISO editor like "ISOMaster" to replace the /boot/grub/loopback.cfg with the new loopback.cfg.
The current woof-ce initrd.gz supports this, so there is no need for a special Puppy download.
Since the grub2 installed on your computer is booting Puppy using the files contined in the ISO file,
it does not matter if the edited ISO file is just a "data" ISO.
Being able to easily add files to, and remove files from, the ISO is an advantage of this approach.
This utility should disappear if/when the appropriate changes are made to '/woof-code/support/mk_iso.sh'.
It has been created by extracting the relevant parts of 'mk_iso.sh' and changing them.
So it should be no problem to generate a woof-ce patch.
2) mk-img-boot-entries creates boot entries for the grub2 in your computer
so it can boot using the contents of a specified ISO file utilizing it's /boot/grub/loopback.cfg.
It accepts 2 parameters with the form <partition>:<relative path>.
The first parameter specifies the location of the ISO files to be processed.
Each image file in this location is processed,
if it contains a /boot/grub/loopback.cfg, a boot entry is generated, otherwise it is ignored.
The second paramater specfies the grub file to contain the generated boot entries,
this file is replaced by each run of the utility, and must be on the partition where grub2 is installed.
If the config file $HOME/.config/img-boot-entries.conf exists, this will be used for the parameters
if none are supplied on the command line.
If the utility creates the file /images.cfg, then /grub.cfg needs to be edited to include:
Code: Select all
if [ -e /images.cfg ]; then
source /images.cfg
fi
A separate file is used, so it can be simply replaced by each run of the utility.
The concept is, if you add or delete an image file to the specified location,
then run mk-img-boot-entries, when you reboot, the image files available for booting via the grub2 menu has been updated.
This utility works with current Puppy release ISO files, it does not require mk-grub2-cfgs,
but without the patched /boot/grub/loopback.cfg, the boot will be slower.
It might also work with any ISO file that contains a /boot/grub/loopback.cfg,
since the generated boot entries do not contain anything peculiar to Puppy.
How does it all work?
It starts with Puppy ISO files containing a "rich" /boot/grub/loopback.cfg.
Hence mk-grub2-cfgs.
Your computer boots a partition containing grub2.
There are entries in the menu to boot an image file as a loopback device.
These entries could be generated by mk-img-boot-entries.
The selected entry should do the following:
set and make avaiiable a $rootuuid variable for the UUID of the patition containing the ISO file
set and make available an $iso_path variable for the relative path/filename of the ISO file
read /boot/grub/loopback.cfg from the ISO file, and activate it's grub menu
read vmlinuz, ucode.cpio, initrd.gz, local-initrd.gz, from the ISO file, and load them using the parameters defined by the selected boot entry in /boot/grub/loopback.cfg.
If you boot a Puppy ISO file, the 'isoboot' script locates the ISO file and mounts it as a loop device.
The 'init' script continues the boot using the files in the ISO file.
Note1: The grub within the ISO file is never used by this process, it can be safely removed from the ISO file.
If removing grub files from the ISO, make sure you leave:
/boot/grub/loopback.cfg
/boot/grub/font.pf2 (used by loopback.cfg)
Note2: Ventoy does not use this process, so does not trigger 'isoboot'.
Booting currrent Puppy Linux ISO files with current Ventoy, produces grief. Don't bother.
Files
Edit: I have removed the 'mk-img-boot-entries.gz' because it has a bug. For replacement see viewtopic.php?p=103718#p103718