[HOWTO] use the from=/path_to/porteus.iso cheatcode

When pointed to an .iso file, the from= cheatcode is designed to allow users to boot the Porteus ISO image directly from a hard drive or flash drive without extracting the full ISO image to disk. This comes in handy if you would like to quickly test out a new ISO image or if you have limited storage space (on a flash drive, for example) and don't want to have two copies of every module sitting around on disk.

In order to use this cheatcode, you need to have the kernel (/boot/syslinux/vmlinuz) and initrd (/boot/syslinux/initrd.xz) extracted from the ISO and placed in a location that can be seen by your bootloader. Your bootloader's config file must then be pointed to this kernel and initrd, as well as to the ISO image using the from=/path_to/porteus.iso cheatcode. Extracting the kernel and initrd can be done through a GUI using archival software (such as 7zip, winrar or wincdemu in windows), or from the CLI in Porteus using the commands below:

Open a terminal and execute these commands as root (modify the paths and file names to suit your needs):

mkdir -p /mnt/sdb2/linux-images/boot/

This will create a directory to hold the needed files. The ISO will go in /linux-images/, and the kernel and initrd will go in /linux-images/boot. The files don't have to be set up this way, but it helps keep things tidy.

cp /path/to/your/iso /mnt/sdb2/linux-images/latest-porteus.iso

This copies the ISO to your new directory. You can use mv instead of cp if you don't want to retain the ISO image in whatever location you've stored it.

mloop /mnt/sdb2/linux-images/latest-porteus.iso

This loop-mounts the ISO image and makes the contents available at /mnt/loop

cp /mnt/loop/boot/syslinux/vmlinuz /mnt/sdb2/linux-images/boot/
cp /mnt/loop/boot/syslinux/initrd.xz /mnt/sdb2/linux-images/boot/

This copies the kernel and initrd from the ISO to your new directory.

Once the files are in place, the most important thing is to make sure your bootloader is properly pointed to all three files (kernel, intird and ISO image). In this example, we have an existing Porteus installation on /dev/sdb2, so we're modifying an existing porteus.cfg file at /mnt/sdb2/boot/syslinux/porteus.cfg to add the following entry:

LABEL xconf
MENU LABEL KDE-Latest Porteus
KERNEL /linux-images/boot/syslinux/vmlinuz
APPEND initrd=/linux-images/boot/syslinux/initrd.xz from=/dev/sdb2/linux-images/latest-porteus.iso

TEXT HELP
Run Porteus the best way we can.
Try to autoconfigure graphics
card and use the maximum
allowed resolution
ENDTEXT

Save the config file, then reboot and select the new 'KDE-Latest Porteus' option from the SYSLINUX menu. The bootloader will load the kernel and initrd from the hard drive or flash drive (/dev/sdb2 in the example above) and then linuxrc will mount the ISO and load the xzm modules from it. Booting will continue from there as normal.


NOTES:

1) There should not be any line breaks between the cheatcodes in your config file; they must all be on the APPEND line.

2) The full path to the ISO is not required although it is recommended to avoid searching through all devices.

3) If you update your Porteus ISO to a newer version, you need to update the unpacked kernel and initrd so they match the kernel and initrd inside the ISO image.


A more complex example:

In this example we are using lilo to boot a porteus ISO from a hard disk with multiple partitions, with saved changes and a rootcopy directory on the hard disk. This is what the lilo.conf would look like:

# Porteus
label = Porteus
image = /boot/syslinux/vmlinuz-ps1
initrd = /boot/syslinux/initrd-ps.xz1
append = "from=/dev/sda5/iso_images/porteus-v1.2-x86_64.iso changes=/dev/sda4/porteus_changes rootcopy=/dev/sda4/porteus_rootcopy extramod=/dev/sda4/porteus_xzm login=root copy2ram nohd nocd"