Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornl6720 <nl6720@gmail.com>2023-09-11 18:35:08 +0300
committernl6720 <nl6720@gmail.com>2023-09-24 12:06:02 +0300
commit5e72546e89024a9e8095c75be6ca86312f5c376a (patch)
treeaf29c4caa802d9ebc6558533f9af58f212057509
parent519a5c004d6a8d3f4d75c95890641cc5e31a39be (diff)
mkarchiso: add uefi-ia32.systemd-boot.esp and uefi-ia32.systemd-boot.eltorito boot modes
The systemd 254.2-1 package ships with IA32 systemd-boot, so it is possible to use for booting on IA32 UEFI. Perhaps they will be useful in the future. At least for now, the baseline and releng profiles are not changed to use them. When the issues and headaches caused with GRUB reach a critical point, then we will switch.
-rw-r--r--CHANGELOG.rst2
-rwxr-xr-xarchiso/mkarchiso154
-rw-r--r--docs/README.profile.rst10
3 files changed, 135 insertions, 31 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index edd9895..a41b474 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -9,6 +9,8 @@ Added
-----
- Add bolt to releng for authorizing and otherwise managing Thunderbolt and USB4 devices.
+- Add ``uefi-ia32.systemd-boot.esp`` and ``uefi-ia32.systemd-boot.eltorito`` boot modes that use systemd-boot for IA32
+ UEFI. The boot modes of baseline and releng are not changed.
Changed
-------
diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index 15534bf..a727a1a 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -793,11 +793,9 @@ _make_bootmode_uefi-x64.grub.eltorito() {
_msg_info "Done!"
}
-# Prepare systemd-boot for booting when written to a disk (isohybrid)
-_make_bootmode_uefi-x64.systemd-boot.esp() {
+_make_common_bootmode_systemd-boot() {
local _file efiboot_imgsize
local _available_ucodes=()
- _msg_info "Setting up systemd-boot for UEFI booting..."
for _file in "${ucodes[@]}"; do
if [[ -e "${pacstrap_dir}/boot/${_file}" ]]; then
@@ -805,20 +803,41 @@ _make_bootmode_uefi-x64.systemd-boot.esp() {
fi
done
# Calculate the required FAT image size in bytes
- efiboot_files+=("${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi"
- "${pacstrap_dir}/usr/share/edk2-shell/x64/Shell_Full.efi"
- "${profile}/efiboot/"
+ # shellcheck disable=SC2076
+ if [[ " ${bootmodes[*]} " =~ ' uefi-x64.systemd-boot.esp ' || " ${bootmodes[*]} " =~ ' uefi-x64.systemd-boot.eltorito ' ]]; then
+ efiboot_files+=("${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi"
+ "${pacstrap_dir}/usr/share/edk2-shell/x64/Shell_Full.efi")
+ fi
+ # shellcheck disable=SC2076
+ if [[ " ${bootmodes[*]} " =~ ' uefi-ia32.systemd-boot.esp ' || " ${bootmodes[*]} " =~ ' uefi-ia32.systemd-boot.eltorito ' ]]; then
+ efiboot_files+=("${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootia32.efi"
+ "${pacstrap_dir}/usr/share/edk2-shell/ia32/Shell_Full.efi")
+ fi
+ efiboot_files+=("${profile}/efiboot/"
"${pacstrap_dir}/boot/vmlinuz-"*
"${pacstrap_dir}/boot/initramfs-"*".img"
"${_available_ucodes[@]}")
- efiboot_imgsize="$(du -bcs -- "${efiboot_files[@]}" \
- 2>/dev/null | awk 'END { print $1 }')"
+ 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"
+}
- # Copy systemd-boot EFI binary to the default/fallback boot path
- mcopy -i "${efibootimg}" \
- "${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" ::/EFI/BOOT/BOOTx64.EFI
+_make_common_bootmode_systemd-boot_conf.isofs() {
+ local _conf
+
+ # Copy systemd-boot configuration files
+ install -d -m 0755 -- "${isofs_dir}/loader/entries"
+ install -m 0644 -- "${profile}/efiboot/loader/loader.conf" "${isofs_dir}/loader/"
+ for _conf in "${profile}/efiboot/loader/entries/"*".conf"; do
+ sed "s|%ARCHISO_LABEL%|${iso_label}|g;
+ s|%INSTALL_DIR%|${install_dir}|g;
+ s|%ARCH%|${arch}|g" \
+ "${_conf}" >"${isofs_dir}/loader/entries/${_conf##*/}"
+ done
+}
+
+_make_common_bootmode_systemd-boot_conf.esp() {
+ local _conf
# Copy systemd-boot configuration files
mmd -i "${efibootimg}" ::/loader ::/loader/entries
@@ -830,6 +849,20 @@ _make_bootmode_uefi-x64.systemd-boot.esp() {
s|%ARCH%|${arch}|g" \
"${_conf}" | mcopy -i "${efibootimg}" - "::/loader/entries/${_conf##*/}"
done
+}
+
+# Prepare systemd-boot for booting when written to a disk (isohybrid)
+_make_bootmode_uefi-x64.systemd-boot.esp() {
+ _msg_info "Setting up systemd-boot for x64 UEFI booting..."
+
+ _run_once _make_common_bootmode_systemd-boot
+
+ # Copy systemd-boot EFI binary to the default/fallback boot path
+ mcopy -i "${efibootimg}" \
+ "${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" ::/EFI/BOOT/BOOTx64.EFI
+
+ # Copy systemd-boot configuration files
+ _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
@@ -839,9 +872,9 @@ _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.
- _make_boot_on_fat
+ _run_once _make_boot_on_fat
- _msg_info "Done! systemd-boot set up for UEFI booting successfully."
+ _msg_info "Done! systemd-boot set up for x64 UEFI booting successfully."
}
# Prepare systemd-boot for El Torito booting
@@ -861,14 +894,7 @@ _make_bootmode_uefi-x64.systemd-boot.eltorito() {
"${isofs_dir}/EFI/BOOT/BOOTx64.EFI"
# Copy systemd-boot configuration files
- install -d -m 0755 -- "${isofs_dir}/loader/entries"
- install -m 0644 -- "${profile}/efiboot/loader/loader.conf" "${isofs_dir}/loader/"
- for _conf in "${profile}/efiboot/loader/entries/"*".conf"; do
- sed "s|%ARCHISO_LABEL%|${iso_label}|g;
- s|%INSTALL_DIR%|${install_dir}|g;
- s|%ARCH%|${arch}|g" \
- "${_conf}" >"${isofs_dir}/loader/entries/${_conf##*/}"
- done
+ _run_once _make_common_bootmode_systemd-boot_conf.isofs
# edk2-shell based UEFI shell
# shellx64.efi is picked up automatically when on /
@@ -879,6 +905,58 @@ _make_bootmode_uefi-x64.systemd-boot.eltorito() {
_msg_info "Done!"
}
+_make_bootmode_uefi-ia32.systemd-boot.esp() {
+ _msg_info "Setting up systemd-boot for IA32 UEFI booting..."
+
+ _run_once _make_common_bootmode_systemd-boot
+
+ # Copy systemd-boot EFI binary to the default/fallback boot path
+ mcopy -i "${efibootimg}" \
+ "${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootia32.efi" ::/EFI/BOOT/BOOTIA32.EFI
+
+ # Copy systemd-boot configuration files
+ _run_once _make_common_bootmode_systemd-boot_conf.esp
+
+ # shellia32.efi is picked up automatically when on /
+ if [[ -e "${pacstrap_dir}/usr/share/edk2-shell/ia32/Shell_Full.efi" ]]; then
+ mcopy -i "${efibootimg}" \
+ "${pacstrap_dir}/usr/share/edk2-shell/ia32/Shell_Full.efi" ::/shellia32.efi
+ fi
+
+ # 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
+
+ _msg_info "Done! systemd-boot set up for IA32 UEFI booting successfully."
+}
+
+_make_bootmode_uefi-ia32.systemd-boot.eltorito() {
+ # El Torito UEFI boot requires an image containing the EFI system partition.
+ # uefi-ia32.systemd-boot.eltorito has the same requirements as uefi-ia32.systemd-boot.esp
+ _run_once _make_bootmode_uefi-ia32.systemd-boot.esp
+
+ # Additionally set up systemd-boot in ISO 9660. This allows creating a medium for the live environment by using
+ # manual partitioning and simply copying the ISO 9660 file system contents.
+ # This is not related to El Torito booting and no firmware uses these files.
+ _msg_info "Preparing an /EFI directory for the ISO 9660 file system..."
+ install -d -m 0755 -- "${isofs_dir}/EFI/BOOT"
+
+ # Copy systemd-boot EFI binary to the default/fallback boot path
+ install -m 0644 -- "${pacstrap_dir}/usr/lib/systemd/boot/efi/systemd-bootia32.efi" \
+ "${isofs_dir}/EFI/BOOT/BOOTIA32.EFI"
+
+ # Copy systemd-boot configuration files
+ _run_once _make_common_bootmode_systemd-boot_conf.isofs
+
+ # edk2-shell based UEFI shell
+ # shellia32.efi is picked up automatically when on /
+ if [[ -e "${pacstrap_dir}/usr/share/edk2-shell/ia32/Shell_Full.efi" ]]; then
+ install -m 0644 -- "${pacstrap_dir}/usr/share/edk2-shell/ia32/Shell_Full.efi" "${isofs_dir}/shellia32.efi"
+ fi
+
+ _msg_info "Done!"
+}
+
_validate_requirements_bootmode_bios.syslinux.mbr() {
# bios.syslinux.mbr requires bios.syslinux.eltorito
# shellcheck disable=SC2076
@@ -922,12 +1000,7 @@ _validate_requirements_bootmode_bios.syslinux.eltorito() {
_validate_requirements_bootmode_bios.syslinux.mbr
}
-_validate_requirements_bootmode_uefi-x64.systemd-boot.esp() {
- # shellcheck disable=SC2076
- if [[ " ${bootmodes[*]} " =~ ' uefi-x64.grub.esp ' ]]; then
- _msg_error "Validating '${bootmode}': cannot be used with bootmode uefi-x64.grub.esp!" 0
- fi
-
+_validate_requirements_common_systemd-boot() {
# Check if mkfs.fat is available
if ! command -v mkfs.fat &>/dev/null; then
(( validation_error=validation_error+1 ))
@@ -967,6 +1040,14 @@ _validate_requirements_bootmode_uefi-x64.systemd-boot.esp() {
fi
}
+_validate_requirements_bootmode_uefi-x64.systemd-boot.esp() {
+ # shellcheck disable=SC2076
+ if [[ " ${bootmodes[*]} " =~ ' uefi-x64.grub.esp ' ]]; then
+ _msg_error "Validating '${bootmode}': cannot be used with bootmode uefi-x64.grub.esp!" 0
+ fi
+ _validate_requirements_common_systemd-boot
+}
+
_validate_requirements_bootmode_uefi-x64.systemd-boot.eltorito() {
# shellcheck disable=SC2076
if [[ " ${bootmodes[*]} " =~ ' uefi-x64.grub.eltorito ' ]]; then
@@ -977,6 +1058,25 @@ _validate_requirements_bootmode_uefi-x64.systemd-boot.eltorito() {
_validate_requirements_bootmode_uefi-x64.systemd-boot.esp
}
+_validate_requirements_bootmode_uefi-ia32.systemd-boot.esp() {
+ # shellcheck disable=SC2076
+ if [[ " ${bootmodes[*]} " =~ ' uefi-ia32.grub.esp ' ]]; then
+ _msg_error "Validating '${bootmode}': cannot be used with bootmode uefi-ia32.grub.esp!" 0
+ fi
+
+ _validate_requirements_common_systemd-boot
+}
+
+_validate_requirements_bootmode_uefi-ia32.systemd-boot.eltorito() {
+ # shellcheck disable=SC2076
+ if [[ " ${bootmodes[*]} " =~ ' uefi-ia32.grub.eltorito ' ]]; then
+ _msg_error "Validating '${bootmode}': cannot be used with bootmode uefi-ia32.grub.eltorito!" 0
+ fi
+
+ # uefi-ia32.systemd-boot.eltorito has the exact same requirements as uefi-ia32.systemd-boot.esp
+ _validate_requirements_bootmode_uefi-x64.systemd-boot.esp
+}
+
_validate_requirements_bootmode_uefi-ia32.grub.esp() {
# Check if GRUB is available
if ! command -v grub-mkstandalone &>/dev/null; then
diff --git a/docs/README.profile.rst b/docs/README.profile.rst
index 0b5041a..5a0c0bd 100644
--- a/docs/README.profile.rst
+++ b/docs/README.profile.rst
@@ -48,10 +48,12 @@ The image file is constructed from some of the variables in ``profiledef.sh``: `
- ``bios.syslinux.eltorito``: Syslinux for x86 BIOS booting from an optical disc
- ``uefi-ia32.grub.esp``: GRUB for IA32 UEFI booting from a disk
- ``uefi-ia32.grub.eltorito``: GRUB for IA32 UEFI booting from an optical disc
- - ``uefi-x64.grub.esp``: GRUB for x86_64 UEFI booting from a disk
- - ``uefi-x64.grub.eltorito``: GRUB for x86_64 UEFI booting from an optical disc
- - ``uefi-x64.systemd-boot.esp``: systemd-boot for x86_64 UEFI booting from a disk
- - ``uefi-x64.systemd-boot.eltorito``: systemd-boot for x86_64 UEFI booting from an optical disc
+ - ``uefi-x64.grub.esp``: GRUB for x64 UEFI booting from a disk
+ - ``uefi-x64.grub.eltorito``: GRUB for x64 UEFI booting from an optical disc
+ - ``uefi-ia32.systemd-boot.esp``: systemd-boot for IA32 UEFI booting from a disk
+ - ``uefi-ia32.systemd-boot.eltorito``: systemd-boot for IA32UEFI booting from an optical disc
+ - ``uefi-x64.systemd-boot.esp``: systemd-boot for x64 UEFI booting from a disk
+ - ``uefi-x64.systemd-boot.eltorito``: systemd-boot for x64 UEFI booting from an optical disc
Note that BIOS El Torito boot mode must always be listed before UEFI El Torito boot mode.
* ``arch``: The architecture (e.g. ``x86_64``) to build the image for. This is also used to resolve the name of the packages
file (e.g. ``packages.x86_64``)