split initrd if bigger than 700M

This commit is contained in:
Tobias Powalowski 2022-05-03 21:20:57 +02:00
parent 112fc2391d
commit 98495e1bd1
2 changed files with 31 additions and 5 deletions

View file

@ -53,7 +53,14 @@ _prepare_kernel_initramfs_files() {
[[ -f "/usr/share/archboot/patches/31-mkinitcpio.fixed" ]] && cp "/usr/share/archboot/patches/31-mkinitcpio.fixed" "/usr/bin/mkinitcpio"
#shellcheck disable=SC2154
mkinitcpio -c "${MKINITCPIO_CONFIG}" -k "${ALL_kver}" -g "${_ISODIR}/boot/initramfs_${_RUNNING_ARCH}.img" || exit 1
mkinitcpio -c "${MKINITCPIO_CONFIG}" -k "${ALL_kver}" -g "${_ISODIR}/boot/initramfs_${_RUNNING_ARCH}-pre.img" || exit 1
# grub on x86_64 reports too big if near 1GB
split -b 700M -d --additional-suffix=.img -a 1 \
"${_ISODIR}/boot/initramfs_${_RUNNING_ARCH}-pre.img" "${_ISODIR}/boot/initramfs_${_RUNNING_ARCH}-"
rm "${_ISODIR}/boot/initramfs_${_RUNNING_ARCH}-pre.img"
if [[ "$(find "${_ISODIR}/boot" -name *.img | wc -l)" -lt "2" ]]; then
mv "${_ISODIR}/boot/initramfs_${_RUNNING_ARCH}-0.img" "${_ISODIR}/boot/initramfs_${_RUNNING_ARCH}.img"
fi
mv "/usr/lib/initcpio/functions.old" "/usr/lib/initcpio/functions"
mv "/usr/bin/mkinitcpio.old" "/usr/bin/mkinitcpio"
install -m644 "${ALL_kver}" "${_ISODIR}/boot/vmlinuz_${_RUNNING_ARCH}"

View file

@ -68,7 +68,12 @@ if [ ${grub_platform} == "pc" ]; then
set gfxpayload=keep
_menu_running
linux /boot/vmlinuz_x86_64 rootfstype=ramfs console=ttyS0,115200 console=tty0
if [ -e /boot/initramfs_x86_64.img ]; then
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
else
initrd /boot/intel-ucode.img /boot/amd-ucode.img \
/boot/initramfs_x86_64-0.img /boot/initramfs_x86_64-1.img
fi
}
fi
@ -80,7 +85,12 @@ if [ ${grub_platform} == "efi" ]; then
set gfxpayload=keep
_menu_running
linux /boot/vmlinuz_x86_64 rootfstype=ramfs console=ttyS0,115200 console=tty0
if [ -e /boot/initramfs_x86_64.img ]; then
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
else
initrd /boot/intel-ucode.img /boot/amd-ucode.img \
/boot/initramfs_x86_64-0.img /boot/initramfs_x86_64-1.img
fi
}
submenu "UEFI Tools" {
@ -94,7 +104,11 @@ if [ ${grub_platform} == "efi" ]; then
set gfxpayload=keep
_menu_running
linux /boot/vmlinuz_aarch64 rootfstype=ramfs nr_cpus=1 console=ttyAMA0,115200 console=tty0 loglevel=4
if [.e /boot/initramfs_aarch64.img }; then
initrd /boot/amd-ucode.img /boot/initramfs_aarch64.img
else
initrd /boot/amd-ucode.img /boot/initramfs_aarch64-0.img /boot/initramfs_aarch64-1.img
fi
}
submenu "UEFI Tools" {
@ -107,7 +121,12 @@ if [ ${grub_platform} == "efi" ]; then
set gfxpayload=keep
_menu_running
linux /boot/vmlinuz_x86_64 _IA32_UEFI=1 rootfstype=ramfs console=ttyS0,115200 console=tty0
if [ -e /boot/initramfs_x86_64.img ]; then
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
else
initrd /boot/intel-ucode.img /boot/amd-ucode.img \
/boot/initramfs_x86_64-0.img /boot/initramfs_x86_64-1.img
fi
}
submenu "UEFI Tools" {