]> code.delx.au - monosys/commitdiff
multiboot: Add a menu item to attempt booting images from ram.
authorGreg Darke <greg@tsukasa.net.au>
Thu, 19 May 2022 06:05:25 +0000 (16:05 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Fri, 27 May 2022 12:08:53 +0000 (22:08 +1000)
This is useful if you have a machine with lots of ram (at least 1GiB
larger than the iso) in the machine, and would like to remove the USB
stick after the image has booted.

This has been tested on the Arch, Ubuntu, and Tails images.

hacks/multiboot-setup

index f6a62220f6f9d4243bda77ddd0cec1b025f0d3ac..1358aa572e60b3bc185c943641cc493586e17c44 100755 (executable)
@@ -108,12 +108,19 @@ insmod part_msdos
 insmod progress
 insmod regexp
 search --set=root --label $PARTITION_LABEL
+set maybe_to_ram=''
+
+menuentry "Copy ISO image to ram before booting" {
+  # copytoram is used by arch
+  # toram is used by casper based images (tails, Ubuntu, etc)
+  set maybe_to_ram="copytoram toram"
+}
 
 function setup_arch {
   menuentry "\$1" {
     loopback loop \$1
     echo "Loading kernel..."
-    linux (loop)/arch/boot/x86_64/vmlinuz-* img_label=${PARTITION_LABEL} img_loop=\$1 archisobasedir=arch earlymodules=loop
+    linux (loop)/arch/boot/x86_64/vmlinuz-* img_label=${PARTITION_LABEL} img_loop=\$1 archisobasedir=arch earlymodules=loop \$maybe_to_ram
     echo "Loading initrd (and microcode if they exist)..."
     initrd (loop)/arch/boot/*.img (loop)/arch/boot/x86_64/initramfs-*.img
   }
@@ -189,7 +196,7 @@ function setup_tails {
   menuentry "\$1" {
     loopback loop \$1
     echo "Loading kernel..."
-    linux (loop)/live/vmlinuz* initrd=/live/initrd.img boot=live config iso-scan/filename=\$1 findiso=\$1 nopersistence noprompt timezone=Etc/UTC noautologin module=Tails slab_nomerge slub_debug=FZP mce=0 vsyscall=none page_poison=1 init_on_free=1 mds=full,nosmt splash quiet
+    linux (loop)/live/vmlinuz* initrd=/live/initrd.img boot=live config iso-scan/filename=\$1 findiso=\$1 nopersistence noprompt timezone=Etc/UTC noautologin module=Tails slab_nomerge slub_debug=FZP mce=0 vsyscall=none page_poison=1 init_on_free=1 mds=full,nosmt splash quiet \$maybe_to_ram
     echo "Loading initrd..."
     initrd (loop)/live/initrd*
   }