Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archiso/mkarchiso
diff options
context:
space:
mode:
authornl6720 <nl6720@gmail.com>2020-09-17 14:17:27 +0300
committernl6720 <nl6720@gmail.com>2020-09-27 20:54:11 +0300
commitf34c95797d72574f9c284e5ed1e88be1eb7a0c05 (patch)
tree03b1414ab8c8f65de0405ec9f9c968ac48f9db3e /archiso/mkarchiso
parent8c047047ab62597d6ced826136bd97df5bf1598c (diff)
Calculate required efiboot.img size instead of hardcoding it
Use du to count the file size of the kernel(s), initramfs images and boot loader (and its configuration). This allows to compress initramfs with something other than xz, or have more than one kernel installed. Fixes https://gitlab.archlinux.org/archlinux/archiso/-/issues/62 .
Diffstat (limited to 'archiso/mkarchiso')
-rwxr-xr-xarchiso/mkarchiso11
1 files changed, 10 insertions, 1 deletions
diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index 3e33468..8adf232 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -540,12 +540,21 @@ _make_boot_on_fat() {
# Prepare efiboot.img::/EFI for EFI boot mode
_make_boot_uefi-x64.systemd-boot.esp() {
+ local efiboot_imgsize="0"
_msg_info "Setting up systemd-boot for UEFI booting..."
install -d -m 0755 -- "${isofs_dir}/EFI/archiso"
+ efiboot_imgsize="$(( (( (( $(du --apparent-size -bc \
+ "${airootfs_dir}/usr/lib/systemd/boot/efi/systemd-bootx64.efi" \
+ "${airootfs_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" \
+ "${profile}/efiboot/" \
+ "${airootfs_dir}/boot/vmlinuz-"* \
+ "${airootfs_dir}/boot/initramfs-"*".img" \
+ "${airootfs_dir}/boot/"{intel-uc.img,intel-ucode.img,amd-uc.img,amd-ucode.img,early_ucode.cpio,microcode.cpio} \
+ 2>/dev/null | awk 'END {print $1}') / 1048576 )) +1 )) * 1024 ))"
# The FAT image must be created with mkfs.fat not mformat, as some systems have issues with mformat made images:
# https://lists.gnu.org/archive/html/grub-devel/2019-04/msg00099.html
- mkfs.fat -C -n ARCHISO_EFI "${isofs_dir}/EFI/archiso/efiboot.img" 65536
+ mkfs.fat -C -n ARCHISO_EFI "${isofs_dir}/EFI/archiso/efiboot.img" "$efiboot_imgsize"
mmd -i "${isofs_dir}/EFI/archiso/efiboot.img" ::/EFI ::/EFI/BOOT
mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" \