From bb503b90308ea12542c85dea9b799e11632158a6 Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Fri, 1 Jan 2021 03:15:33 +0100 Subject: [PATCH 1/6] add optional pv tool use pv to give feedback on copying the airootfs to RAM when copytoram kernel parameter is given --- archiso/initcpio/hooks/archiso | 15 ++++++++++++++- archiso/initcpio/install/archiso | 1 + .../loader/entries/archiso-x86_64-linux-ram.conf | 7 +++++++ configs/baseline/packages.x86_64 | 1 + configs/baseline/syslinux/syslinux-linux.cfg | 6 ++++++ 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 configs/baseline/efiboot/loader/entries/archiso-x86_64-linux-ram.conf diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso index 1b848ce..485fb0f 100644 --- a/archiso/initcpio/hooks/archiso +++ b/archiso/initcpio/hooks/archiso @@ -69,10 +69,23 @@ _mnt_sfs() { # defined via initcpio's parse_cmdline() if [ "${copytoram}" = "y" ]; then msg -n ":: Copying squashfs image to RAM..." - if ! cp -- "${img}" "/run/archiso/copytoram/${img_fullname}" ; then + + # in case we have pv use it to display copy progress feedback otherwise + # fallback to using plain cp + if [ -x /usr/bin/pv ]; then + echo "" + (pv "${img}" > "/run/archiso/copytoram/${img_fullname}") + local rc=$? + else + (cp -- "${img}" "/run/archiso/copytoram/${img_fullname}") + local rc=$? + fi + + if [ $rc != 0 ]; then echo "ERROR: while copy '${img}' to '/run/archiso/copytoram/${img_fullname}'" launch_interactive_shell fi + img="/run/archiso/copytoram/${img_fullname}" msg "done." fi diff --git a/archiso/initcpio/install/archiso b/archiso/initcpio/install/archiso index 74948c7..df0f6b5 100644 --- a/archiso/initcpio/install/archiso +++ b/archiso/initcpio/install/archiso @@ -18,6 +18,7 @@ build() { add_binary truncate add_binary gpg add_binary grep + add_binary pv add_file /usr/lib/udev/rules.d/60-cdrom_id.rules add_file /usr/lib/udev/rules.d/10-dm.rules diff --git a/configs/baseline/efiboot/loader/entries/archiso-x86_64-linux-ram.conf b/configs/baseline/efiboot/loader/entries/archiso-x86_64-linux-ram.conf new file mode 100644 index 0000000..c5e9ab9 --- /dev/null +++ b/configs/baseline/efiboot/loader/entries/archiso-x86_64-linux-ram.conf @@ -0,0 +1,7 @@ +# +# SPDX-License-Identifier: GPL-3.0-or-later + +title Arch Linux (x86_64, UEFI) Copy to RAM +linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux +initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img +options archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram diff --git a/configs/baseline/packages.x86_64 b/configs/baseline/packages.x86_64 index cadea18..224f7f0 100644 --- a/configs/baseline/packages.x86_64 +++ b/configs/baseline/packages.x86_64 @@ -6,6 +6,7 @@ linux mkinitcpio mkinitcpio-archiso openssh +pv qemu-guest-agent syslinux virtualbox-guest-utils-nox diff --git a/configs/baseline/syslinux/syslinux-linux.cfg b/configs/baseline/syslinux/syslinux-linux.cfg index 867d815..ced6801 100644 --- a/configs/baseline/syslinux/syslinux-linux.cfg +++ b/configs/baseline/syslinux/syslinux-linux.cfg @@ -6,3 +6,9 @@ MENU LABEL Arch Linux (x86_64, BIOS) LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz-linux INITRD /%INSTALL_DIR%/boot/%ARCH%/initramfs-linux.img APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% + +LABEL arch-ram +MENU LABEL Arch Linux (x86_64, BIOS) Copy to RAM +LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz-linux +INITRD /%INSTALL_DIR%/boot/%ARCH%/initramfs-linux.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram From c9cdb6d4b933fcd9cd06ff7d0544a3496b9d70bc Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Tue, 5 Jan 2021 13:04:39 +0000 Subject: [PATCH 2/6] Apply 1 suggestion(s) to 1 file(s) --- archiso/initcpio/hooks/archiso | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso index 485fb0f..d897ae1 100644 --- a/archiso/initcpio/hooks/archiso +++ b/archiso/initcpio/hooks/archiso @@ -72,7 +72,7 @@ _mnt_sfs() { # in case we have pv use it to display copy progress feedback otherwise # fallback to using plain cp - if [ -x /usr/bin/pv ]; then + if command -v pv > /dev/null 2>&1; then echo "" (pv "${img}" > "/run/archiso/copytoram/${img_fullname}") local rc=$? From 16742d12902353e13e422fbba64bb9639a3552ea Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Mon, 5 Apr 2021 23:41:18 +0200 Subject: [PATCH 3/6] Update README.bootparams Explain the purpose of optionally adding the "pv" program to the package list. --- docs/README.bootparams | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/README.bootparams b/docs/README.bootparams index bcafc0e..da1fcda 100644 --- a/docs/README.bootparams +++ b/docs/README.bootparams @@ -24,7 +24,9 @@ INDEX * archisobasedir= Set the base directory where all files reside. Default: "arch" * copytoram= If set to "y" or just "copytoram" without arguments, - all SquashFS are copied to "RAM". + all SquashFS are copied to "RAM". If you add the package + "pv" to the packages.x86_64 it is used to display the copy + progress. Default: (unset) * checksum= If set to "y" or just "checksum" without arguments, performs a self-test of all files inside ${install_dir}, From 9c783a8e719ecc0f113786e22ac14ca834fc07bd Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Mon, 5 Apr 2021 23:53:24 +0200 Subject: [PATCH 4/6] Reorder UEFI boot menu entries --- .../{archiso-x86_64-linux.conf => 01-archiso-x86_64-linux.conf} | 0 ...o-x86_64-linux-ram.conf => 02-archiso-x86_64-linux-ram.conf} | 0 configs/baseline/efiboot/loader/loader.conf | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename configs/baseline/efiboot/loader/entries/{archiso-x86_64-linux.conf => 01-archiso-x86_64-linux.conf} (100%) rename configs/baseline/efiboot/loader/entries/{archiso-x86_64-linux-ram.conf => 02-archiso-x86_64-linux-ram.conf} (100%) diff --git a/configs/baseline/efiboot/loader/entries/archiso-x86_64-linux.conf b/configs/baseline/efiboot/loader/entries/01-archiso-x86_64-linux.conf similarity index 100% rename from configs/baseline/efiboot/loader/entries/archiso-x86_64-linux.conf rename to configs/baseline/efiboot/loader/entries/01-archiso-x86_64-linux.conf diff --git a/configs/baseline/efiboot/loader/entries/archiso-x86_64-linux-ram.conf b/configs/baseline/efiboot/loader/entries/02-archiso-x86_64-linux-ram.conf similarity index 100% rename from configs/baseline/efiboot/loader/entries/archiso-x86_64-linux-ram.conf rename to configs/baseline/efiboot/loader/entries/02-archiso-x86_64-linux-ram.conf diff --git a/configs/baseline/efiboot/loader/loader.conf b/configs/baseline/efiboot/loader/loader.conf index 1ea5ce5..beacd81 100644 --- a/configs/baseline/efiboot/loader/loader.conf +++ b/configs/baseline/efiboot/loader/loader.conf @@ -2,4 +2,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later timeout 3 -default archiso-x86_64-linux.conf +default 01-archiso-x86_64-linux.conf From 15f4ef4938c8ce380639512aabf3c98b2e596317 Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Tue, 6 Apr 2021 00:56:16 +0200 Subject: [PATCH 5/6] Fence add_binary for pv --- archiso/initcpio/install/archiso | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/archiso/initcpio/install/archiso b/archiso/initcpio/install/archiso index df0f6b5..c64e10e 100644 --- a/archiso/initcpio/install/archiso +++ b/archiso/initcpio/install/archiso @@ -18,7 +18,12 @@ build() { add_binary truncate add_binary gpg add_binary grep - add_binary pv + + if command -v pv > /dev/null 2>&1; then + add_binary pv + else + warning 'pv not found; falling back to cp for copy to RAM' + fi add_file /usr/lib/udev/rules.d/60-cdrom_id.rules add_file /usr/lib/udev/rules.d/10-dm.rules From 31427eca7a3a6eea80fa2e3910e5805bee14c0c4 Mon Sep 17 00:00:00 2001 From: Simon Wilper Date: Tue, 6 Apr 2021 22:21:11 +0200 Subject: [PATCH 6/6] Apply copytoram Boot Option Menu Entries also to releng --- ...inux-ram.conf => 02-archiso-x86_64-ram-linux.conf} | 0 ...x86_64-linux.conf => 01-archiso-x86_64-linux.conf} | 0 ...linux.conf => 02-archiso-x86_64-speech-linux.conf} | 0 .../loader/entries/03-archiso-x86_64-ram-linux.conf | 9 +++++++++ configs/releng/efiboot/loader/loader.conf | 2 +- configs/releng/syslinux/archiso_sys-linux.cfg | 11 +++++++++++ 6 files changed, 21 insertions(+), 1 deletion(-) rename configs/baseline/efiboot/loader/entries/{02-archiso-x86_64-linux-ram.conf => 02-archiso-x86_64-ram-linux.conf} (100%) rename configs/releng/efiboot/loader/entries/{archiso-x86_64-linux.conf => 01-archiso-x86_64-linux.conf} (100%) rename configs/releng/efiboot/loader/entries/{archiso-x86_64-speech-linux.conf => 02-archiso-x86_64-speech-linux.conf} (100%) create mode 100644 configs/releng/efiboot/loader/entries/03-archiso-x86_64-ram-linux.conf diff --git a/configs/baseline/efiboot/loader/entries/02-archiso-x86_64-linux-ram.conf b/configs/baseline/efiboot/loader/entries/02-archiso-x86_64-ram-linux.conf similarity index 100% rename from configs/baseline/efiboot/loader/entries/02-archiso-x86_64-linux-ram.conf rename to configs/baseline/efiboot/loader/entries/02-archiso-x86_64-ram-linux.conf diff --git a/configs/releng/efiboot/loader/entries/archiso-x86_64-linux.conf b/configs/releng/efiboot/loader/entries/01-archiso-x86_64-linux.conf similarity index 100% rename from configs/releng/efiboot/loader/entries/archiso-x86_64-linux.conf rename to configs/releng/efiboot/loader/entries/01-archiso-x86_64-linux.conf diff --git a/configs/releng/efiboot/loader/entries/archiso-x86_64-speech-linux.conf b/configs/releng/efiboot/loader/entries/02-archiso-x86_64-speech-linux.conf similarity index 100% rename from configs/releng/efiboot/loader/entries/archiso-x86_64-speech-linux.conf rename to configs/releng/efiboot/loader/entries/02-archiso-x86_64-speech-linux.conf diff --git a/configs/releng/efiboot/loader/entries/03-archiso-x86_64-ram-linux.conf b/configs/releng/efiboot/loader/entries/03-archiso-x86_64-ram-linux.conf new file mode 100644 index 0000000..9eba5a9 --- /dev/null +++ b/configs/releng/efiboot/loader/entries/03-archiso-x86_64-ram-linux.conf @@ -0,0 +1,9 @@ +# +# SPDX-License-Identifier: GPL-3.0-or-later + +title Arch Linux install medium (x86_64, UEFI, Copy to RAM) +linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux +initrd /%INSTALL_DIR%/boot/intel-ucode.img +initrd /%INSTALL_DIR%/boot/amd-ucode.img +initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img +options archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram diff --git a/configs/releng/efiboot/loader/loader.conf b/configs/releng/efiboot/loader/loader.conf index 767d225..4f6252f 100644 --- a/configs/releng/efiboot/loader/loader.conf +++ b/configs/releng/efiboot/loader/loader.conf @@ -2,4 +2,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later timeout 15 -default archiso-x86_64-linux.conf +default 01-archiso-x86_64-linux.conf diff --git a/configs/releng/syslinux/archiso_sys-linux.cfg b/configs/releng/syslinux/archiso_sys-linux.cfg index e2b4edd..e1894c1 100644 --- a/configs/releng/syslinux/archiso_sys-linux.cfg +++ b/configs/releng/syslinux/archiso_sys-linux.cfg @@ -21,3 +21,14 @@ MENU LABEL Arch Linux install medium (x86_64, BIOS) with ^speech LINUX /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux INITRD /%INSTALL_DIR%/boot/intel-ucode.img,/%INSTALL_DIR%/boot/amd-ucode.img,/%INSTALL_DIR%/boot/x86_64/initramfs-linux.img APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% accessibility=on + +# Copy to RAM boot option +LABEL arch64ram +TEXT HELP +Boot the Arch Linux install medium on BIOS with Copy-to-RAM option +It allows you to install Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Arch Linux install medium (x86_64, BIOS, Copy to RAM) +LINUX /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux +INITRD /%INSTALL_DIR%/boot/intel-ucode.img,/%INSTALL_DIR%/boot/amd-ucode.img,/%INSTALL_DIR%/boot/x86_64/initramfs-linux.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram