From b3a69b224c382e1c28958eb25d5547a781bd90e3 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sat, 13 Jan 2024 16:11:25 +0100 Subject: [PATCH] Custom enhancements --- .gitignore | 1 + archiso/mkarchiso | 33 +++++++++++++++---- .../etc/mkinitcpio.conf.d/archiso.conf | 2 +- .../airootfs/etc/xdg/reflector/reflector.conf | 2 +- configs/releng/airootfs/usr/local/bin/mnt.sh | 10 ++++++ configs/releng/packages.x86_64 | 1 + configs/releng/profiledef.sh | 5 ++- 7 files changed, 42 insertions(+), 12 deletions(-) create mode 100755 configs/releng/airootfs/usr/local/bin/mnt.sh diff --git a/.gitignore b/.gitignore index 74a0a52..3864af2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea *~ archiso-*.tar.gz* work/ diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 53a638c..963ea27 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -550,7 +550,7 @@ _make_efibootimg() { fi # Create the default/fallback boot path in which a boot loaders will be placed later. - mmd -i "${efibootimg}" ::/EFI ::/EFI/BOOT + mmd -i "${efibootimg}" ::/EFI ::/EFI/BOOT ::/EFI/Linux } # Copy GRUB files to ISO 9660 which is used by both IA32 UEFI and x64 UEFI @@ -851,10 +851,25 @@ _make_common_bootmode_systemd-boot() { efiboot_files+=("${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootia32.efi" "${pacstrap_dir}/usr/share/edk2-shell/ia32/Shell_Full.efi") fi + mkdir -p "${pacstrap_dir}/boot/efi" + ukify_args=(build) + ukify_args+=(--linux "${pacstrap_dir}/boot/vmlinuz-"*) + for ucode in "${_available_ucodes[@]}" + do + ukify_args+=(--initrd "${ucode}") + done + ukify_args+=(--initrd "${pacstrap_dir}/boot/initramfs-"*".img") + ukify_args+=(--cmdline "archisobasedir=${install_dir} archisodevice=UUID=${iso_uuid}") + ukify_args+=(--output "${pacstrap_dir}/boot/efi/linux-ukify.efi") + # TODO will be moved to /usr/bin (actually already happened) + /usr/lib/systemd/ukify "${ukify_args[@]}" + sbctl sign "${pacstrap_dir}/boot/efi/linux-ukify.efi" efiboot_files+=("${work_dir}/loader/" - "${pacstrap_dir}/boot/vmlinuz-"* - "${pacstrap_dir}/boot/initramfs-"*".img" - "${_available_ucodes[@]}") + #"${pacstrap_dir}/boot/vmlinuz-"* + #"${pacstrap_dir}/boot/initramfs-"*".img" + "${pacstrap_dir}/boot/efi/linux-ukify.efi" + #"${_available_ucodes[@]}" + ) efiboot_imgsize="$(du -bcs -- "${efiboot_files[@]}" 2>/dev/null | awk 'END { print $1 }')" # Create a FAT image for the EFI system partition _make_efibootimg "$efiboot_imgsize" @@ -890,17 +905,21 @@ _make_bootmode_uefi-x64.systemd-boot.esp() { _msg_info "Setting up systemd-boot for x64 UEFI booting..." # Prepare configuration files - _run_once _make_common_bootmode_systemd-boot_conf + #_run_once _make_common_bootmode_systemd-boot_conf # Prepare a FAT image for the EFI system partition _run_once _make_common_bootmode_systemd-boot # Copy systemd-boot EFI binary to the default/fallback boot path + sbctl sign "${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" mcopy -i "${efibootimg}" \ "${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" ::/EFI/BOOT/BOOTx64.EFI + mcopy -i "${efibootimg}" \ + "${pacstrap_dir}/boot/efi/linux-ukify.efi" ::/EFI/Linux/linux-ukify.efi + # Copy systemd-boot configuration files - _run_once _make_common_bootmode_systemd-boot_conf.esp + #_run_once _make_common_bootmode_systemd-boot_conf.esp # shellx64.efi is picked up automatically when on / if [[ -e "${pacstrap_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" ]]; then @@ -910,7 +929,7 @@ _make_bootmode_uefi-x64.systemd-boot.esp() { # Copy kernel and initramfs to FAT image. # systemd-boot can only access files from the EFI system partition it was launched from. - _run_once _make_boot_on_fat + #_run_once _make_boot_on_fat _msg_info "Done! systemd-boot set up for x64 UEFI booting successfully." } diff --git a/configs/releng/airootfs/etc/mkinitcpio.conf.d/archiso.conf b/configs/releng/airootfs/etc/mkinitcpio.conf.d/archiso.conf index b4b3095..659ba6f 100644 --- a/configs/releng/airootfs/etc/mkinitcpio.conf.d/archiso.conf +++ b/configs/releng/airootfs/etc/mkinitcpio.conf.d/archiso.conf @@ -1,2 +1,2 @@ HOOKS=(base udev modconf kms memdisk archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs block filesystems keyboard) -COMPRESSION="xz" +COMPRESSION="zstd" diff --git a/configs/releng/airootfs/etc/xdg/reflector/reflector.conf b/configs/releng/airootfs/etc/xdg/reflector/reflector.conf index 7c830d2..fda3390 100644 --- a/configs/releng/airootfs/etc/xdg/reflector/reflector.conf +++ b/configs/releng/airootfs/etc/xdg/reflector/reflector.conf @@ -4,5 +4,5 @@ --ipv4 --ipv6 --protocol https ---latest 20 +--latest 5 --sort rate diff --git a/configs/releng/airootfs/usr/local/bin/mnt.sh b/configs/releng/airootfs/usr/local/bin/mnt.sh new file mode 100755 index 0000000..dbaabdd --- /dev/null +++ b/configs/releng/airootfs/usr/local/bin/mnt.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -euxo pipefail + +loadkeys de +cryptsetup open /dev/disk/by-uuid/bb5f4eb8-dd2a-445b-9452-23eb44368170 luks-root +sleep 1 +mount /dev/mapper/rootvg-rootvol /mnt +arch-chroot /mnt /bin/bash -c "mount -a" +arch-chroot /mnt /bin/zsh diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index e2a3e64..25b2ac6 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -128,3 +128,4 @@ wvdial xfsprogs xl2tpd zsh +systemd-ukify diff --git a/configs/releng/profiledef.sh b/configs/releng/profiledef.sh index 5cba1b5..aeba502 100644 --- a/configs/releng/profiledef.sh +++ b/configs/releng/profiledef.sh @@ -8,9 +8,7 @@ iso_application="Arch Linux Live/Rescue CD" iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)" install_dir="arch" buildmodes=('iso') -bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito' - 'uefi-ia32.grub.esp' 'uefi-x64.grub.esp' - 'uefi-ia32.grub.eltorito' 'uefi-x64.grub.eltorito') +bootmodes=('uefi-x64.systemd-boot.esp') arch="x86_64" pacman_conf="pacman.conf" airootfs_image_type="squashfs" @@ -23,4 +21,5 @@ file_permissions=( ["/usr/local/bin/choose-mirror"]="0:0:755" ["/usr/local/bin/Installation_guide"]="0:0:755" ["/usr/local/bin/livecd-sound"]="0:0:755" + ["/usr/local/bin/mnt.sh"]="0:0:755" )