archiso/mkarchiso: do not hardcode the kernel and initramfs file names
All kernels and initramfs images from airootfs are copied to ${install_dir}/boot/ on both ISO 9660 and FAT. This allows providing multiple kernels. The kernel package needs to be added to packages.x86_64 and the boot loader configuration files created/adjusted appropriately. Support all possible microcode initrd file names.
This commit is contained in:
parent
83e4cb9fb9
commit
8276616f6f
@ -413,22 +413,22 @@ _make_bootmodes() {
|
|||||||
|
|
||||||
# Prepare kernel/initramfs ${install_dir}/boot/
|
# Prepare kernel/initramfs ${install_dir}/boot/
|
||||||
_make_boot_on_iso() {
|
_make_boot_on_iso() {
|
||||||
|
local ucode_image
|
||||||
_msg_info "Preparing kernel and intramfs for the ISO 9660 file system..."
|
_msg_info "Preparing kernel and intramfs for the ISO 9660 file system..."
|
||||||
install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/${arch}"
|
install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/${arch}"
|
||||||
install -m 0644 -- "${airootfs_dir}/boot/initramfs-linux.img" "${isofs_dir}/${install_dir}/boot/${arch}/"
|
install -m 0644 -- "${airootfs_dir}/boot/initramfs-"*".img" "${isofs_dir}/${install_dir}/boot/${arch}/"
|
||||||
install -m 0644 -- "${airootfs_dir}/boot/vmlinuz-linux" "${isofs_dir}/${install_dir}/boot/${arch}/"
|
install -m 0644 -- "${airootfs_dir}/boot/vmlinuz-"* "${isofs_dir}/${install_dir}/boot/${arch}/"
|
||||||
if [[ -e "${airootfs_dir}/boot/intel-ucode.img" ]]; then
|
|
||||||
install -m 0644 -- "${airootfs_dir}/boot/intel-ucode.img" "${isofs_dir}/${install_dir}/boot/"
|
for ucode_image in {intel-uc.img,intel-ucode.img,amd-uc.img,amd-ucode.img,early_ucode.cpio,microcode.cpio}; do
|
||||||
install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/licenses/intel-ucode/"
|
if [[ -e "${airootfs_dir}/boot/${ucode_image}" ]]; then
|
||||||
install -m 0644 -- "${airootfs_dir}/usr/share/licenses/intel-ucode/"* \
|
install -m 0644 -- "${airootfs_dir}/boot/${ucode_image}" "${isofs_dir}/${install_dir}/boot/"
|
||||||
"${isofs_dir}/${install_dir}/boot/licenses/intel-ucode/"
|
if [[ -e "${airootfs_dir}/usr/share/licenses/${ucode_image%.*}/" ]]; then
|
||||||
|
install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/licenses/${ucode_image%.*}/"
|
||||||
|
install -m 0644 -- "${airootfs_dir}/usr/share/licenses/${ucode_image%.*}/"* \
|
||||||
|
"${isofs_dir}/${install_dir}/boot/licenses/${ucode_image%.*}/"
|
||||||
fi
|
fi
|
||||||
if [[ -e "${airootfs_dir}/boot/amd-ucode.img" ]]; then
|
|
||||||
install -m 0644 -- "${airootfs_dir}/boot/amd-ucode.img" "${isofs_dir}/${install_dir}/boot/"
|
|
||||||
install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/licenses/amd-ucode/"
|
|
||||||
install -m 0644 -- "${airootfs_dir}/usr/share/licenses/amd-ucode/"* \
|
|
||||||
"${isofs_dir}/${install_dir}/boot/licenses/amd-ucode/"
|
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
_msg_info "Done!"
|
_msg_info "Done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,13 +450,16 @@ _make_boot_bios.syslinux.mbr() {
|
|||||||
install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/memdisk" "${isofs_dir}/${install_dir}/boot/syslinux/"
|
install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/memdisk" "${isofs_dir}/${install_dir}/boot/syslinux/"
|
||||||
|
|
||||||
_run_once _make_boot_on_iso
|
_run_once _make_boot_on_iso
|
||||||
_uname_r=$(file -b "${isofs_dir}/${install_dir}/boot/${arch}/vmlinuz-linux" | awk 'f{print;f=0} /version/{f=1}' RS=' ')
|
|
||||||
|
|
||||||
|
if [[ -e "${isofs_dir}/${install_dir}/boot/syslinux/hdt.c32" ]]; then
|
||||||
install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/syslinux/hdt"
|
install -d -m 0755 -- "${isofs_dir}/${install_dir}/boot/syslinux/hdt"
|
||||||
|
if [[ -e "${airootfs_dir}/usr/share/hwdata/pci.ids" ]]; then
|
||||||
gzip -c -9 "${airootfs_dir}/usr/share/hwdata/pci.ids" > \
|
gzip -c -9 "${airootfs_dir}/usr/share/hwdata/pci.ids" > \
|
||||||
"${isofs_dir}/${install_dir}/boot/syslinux/hdt/pciids.gz"
|
"${isofs_dir}/${install_dir}/boot/syslinux/hdt/pciids.gz"
|
||||||
gzip -c -9 "${airootfs_dir}/usr/lib/modules/${_uname_r}/modules.alias" > \
|
fi
|
||||||
|
find "${airootfs_dir}/usr/lib/modules" -name 'modules.alias' -print -exec gzip -c -9 '{}' ';' -quit > \
|
||||||
"${isofs_dir}/${install_dir}/boot/syslinux/hdt/modalias.gz"
|
"${isofs_dir}/${install_dir}/boot/syslinux/hdt/modalias.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
# Add other aditional/extra files to ${install_dir}/boot/
|
# Add other aditional/extra files to ${install_dir}/boot/
|
||||||
if [[ -e "${airootfs_dir}/boot/memtest86+/memtest.bin" ]]; then
|
if [[ -e "${airootfs_dir}/boot/memtest86+/memtest.bin" ]]; then
|
||||||
@ -473,10 +476,12 @@ _make_boot_bios.syslinux.mbr() {
|
|||||||
_make_boot_bios.syslinux.eltorito() {
|
_make_boot_bios.syslinux.eltorito() {
|
||||||
_msg_info "Setting up SYSLINUX for BIOS booting from an optical disc..."
|
_msg_info "Setting up SYSLINUX for BIOS booting from an optical disc..."
|
||||||
install -d -m 0755 -- "${isofs_dir}/isolinux"
|
install -d -m 0755 -- "${isofs_dir}/isolinux"
|
||||||
|
for _cfg in "${profile}/isolinux/"*".cfg"; do
|
||||||
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
||||||
s|%INSTALL_DIR%|${install_dir}|g;
|
s|%INSTALL_DIR%|${install_dir}|g;
|
||||||
s|%ARCH%|${arch}|g" \
|
s|%ARCH%|${arch}|g" \
|
||||||
"${profile}/isolinux/isolinux.cfg" > "${isofs_dir}/isolinux/isolinux.cfg"
|
"${_cfg}" > "${isofs_dir}/isolinux/${_cfg##*/}"
|
||||||
|
done
|
||||||
install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/isolinux.bin" "${isofs_dir}/isolinux/"
|
install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/isolinux.bin" "${isofs_dir}/isolinux/"
|
||||||
install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/isohdpfx.bin" "${isofs_dir}/isolinux/"
|
install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/isohdpfx.bin" "${isofs_dir}/isolinux/"
|
||||||
install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/ldlinux.c32" "${isofs_dir}/isolinux/"
|
install -m 0644 -- "${airootfs_dir}/usr/lib/syslinux/bios/ldlinux.c32" "${isofs_dir}/isolinux/"
|
||||||
@ -497,11 +502,12 @@ _make_efi() {
|
|||||||
install -d -m 0755 -- "${isofs_dir}/loader/entries"
|
install -d -m 0755 -- "${isofs_dir}/loader/entries"
|
||||||
install -m 0644 -- "${profile}/efiboot/loader/loader.conf" "${isofs_dir}/loader/"
|
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;
|
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
||||||
s|%INSTALL_DIR%|${install_dir}|g;
|
s|%INSTALL_DIR%|${install_dir}|g;
|
||||||
s|%ARCH%|${arch}|g" \
|
s|%ARCH%|${arch}|g" \
|
||||||
"${profile}/efiboot/loader/entries/archiso-x86_64-linux.conf" > \
|
"${_conf}" > "${isofs_dir}/loader/entries/${_conf##*/}"
|
||||||
"${isofs_dir}/loader/entries/archiso-x86_64-linux.conf"
|
done
|
||||||
|
|
||||||
# edk2-shell based UEFI shell
|
# edk2-shell based UEFI shell
|
||||||
# shellx64.efi is picked up automatically when on /
|
# shellx64.efi is picked up automatically when on /
|
||||||
@ -513,16 +519,21 @@ _make_efi() {
|
|||||||
|
|
||||||
# Prepare kernel/initramfs on efiboot.img
|
# Prepare kernel/initramfs on efiboot.img
|
||||||
_make_boot_on_fat() {
|
_make_boot_on_fat() {
|
||||||
|
local ucode_image all_ucode_images=()
|
||||||
_msg_info "Preparing kernel and intramfs for the FAT file system..."
|
_msg_info "Preparing kernel and intramfs for the FAT file system..."
|
||||||
mmd -i "${isofs_dir}/EFI/archiso/efiboot.img" \
|
mmd -i "${isofs_dir}/EFI/archiso/efiboot.img" \
|
||||||
"::/${install_dir}" "::/${install_dir}/boot" "::/${install_dir}/boot/${arch}"
|
"::/${install_dir}" "::/${install_dir}/boot" "::/${install_dir}/boot/${arch}"
|
||||||
mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" "${airootfs_dir}/boot/vmlinuz-linux" \
|
mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" "${airootfs_dir}/boot/vmlinuz-"* \
|
||||||
"${airootfs_dir}/boot/initramfs-linux.img" "::/${install_dir}/boot/${arch}/"
|
"${airootfs_dir}/boot/initramfs-"*".img" "::/${install_dir}/boot/${arch}/"
|
||||||
if [[ -e "${airootfs_dir}/boot/intel-ucode.img" ]]; then
|
for ucode_image in \
|
||||||
mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" "${airootfs_dir}/boot/intel-ucode.img" "::/${install_dir}/boot/"
|
"${airootfs_dir}/boot/"{intel-uc.img,intel-ucode.img,amd-uc.img,amd-ucode.img,early_ucode.cpio,microcode.cpio}
|
||||||
|
do
|
||||||
|
if [[ -e "${ucode_image}" ]]; then
|
||||||
|
all_ucode_images+=("${ucode_image}")
|
||||||
fi
|
fi
|
||||||
if [[ -e "${airootfs_dir}/boot/amd-ucode.img" ]]; then
|
done
|
||||||
mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" "${airootfs_dir}/boot/amd-ucode.img" "::/${install_dir}/boot/"
|
if (( ${#all_ucode_images[@]} )); then
|
||||||
|
mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" "${all_ucode_images[@]}" "::/${install_dir}/boot/"
|
||||||
fi
|
fi
|
||||||
_msg_info "Done!"
|
_msg_info "Done!"
|
||||||
}
|
}
|
||||||
@ -542,11 +553,12 @@ _make_boot_uefi-x64.systemd-boot.esp() {
|
|||||||
|
|
||||||
mmd -i "${isofs_dir}/EFI/archiso/efiboot.img" ::/loader ::/loader/entries
|
mmd -i "${isofs_dir}/EFI/archiso/efiboot.img" ::/loader ::/loader/entries
|
||||||
mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" "${profile}/efiboot/loader/loader.conf" ::/loader/
|
mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" "${profile}/efiboot/loader/loader.conf" ::/loader/
|
||||||
|
for _conf in "${profile}/efiboot/loader/entries/"*".conf"; do
|
||||||
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
||||||
s|%INSTALL_DIR%|${install_dir}|g;
|
s|%INSTALL_DIR%|${install_dir}|g;
|
||||||
s|%ARCH%|${arch}|g" \
|
s|%ARCH%|${arch}|g" \
|
||||||
"${profile}/efiboot/loader/entries/archiso-x86_64-linux.conf" \
|
"${_conf}" | mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" - "::/loader/entries/${_conf##*/}"
|
||||||
| mcopy -i "${isofs_dir}/EFI/archiso/efiboot.img" - ::/loader/entries/archiso-x86_64-linux.conf
|
done
|
||||||
|
|
||||||
# shellx64.efi is picked up automatically when on /
|
# shellx64.efi is picked up automatically when on /
|
||||||
if [[ -e "${airootfs_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" ]]; then
|
if [[ -e "${airootfs_dir}/usr/share/edk2-shell/x64/Shell_Full.efi" ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user