Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archiso
diff options
context:
space:
mode:
Diffstat (limited to 'archiso')
-rwxr-xr-xarchiso/mkarchiso154
1 files changed, 127 insertions, 27 deletions
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