simplify grub, enable custom grub setup, add archboot background

This commit is contained in:
Tobias Powalowski 2022-02-25 19:23:00 +01:00
parent 190b6c1d89
commit e7a2943544
9 changed files with 92 additions and 105 deletions

View file

@ -3,6 +3,7 @@
_LINUX_FIRMWARE="linux-firmware"
# grub config to use
_GRUB_CONFIG="/usr/share/archboot/grub/grub.cfg"
_GRUB_BACKGROUND="/usr/share/archboot/grub/archboot-background.png"
### server setup
# release directory
_DIR="$(date +%Y.%m)"

View file

@ -12,7 +12,8 @@ echo "Starting ISO creation ..."
_prepare_kernel_initramfs_files || exit 1
_prepare_fedora_shim_bootloaders_aarch64 || exit 1
_prepare_efitools_uefi || exit 1
_prepare_uefi_AA64_GRUB_USB_files || exit 1
_prepare_uefi_AA64 || exit 1
_prepare_background || exit 1
_reproducibility
_prepare_uefi_image || exit 1
_reproducibility

View file

@ -11,10 +11,11 @@ _prepare_shim_files || exit 1
_upload_efi_files shim-fedora || exit 1
_cleanup shim-fedora || exit 1
mkdir -m 777 grub-efi
_prepare_uefi_X64_GRUB_USB_files || exit 1
_prepare_uefi_IA32_GRUB_USB_files || exit 1
_grub_cfg
_prepare_uefi_X64 || exit 1
_prepare_uefi_IA32 || exit 1
archboot-aarch64-create-container.sh grub-aarch64
_prepare_uefi_AA64_GRUB_USB_files || exit 1
_prepare_uefi_AA64 || exit 1
_cleanup grub-aarch64 || exit 1
_upload_efi_files grub-efi
_cleanup grub-efi || exit 1

View file

@ -13,8 +13,9 @@ _prepare_kernel_initramfs_files || exit 1
_prepare_fedora_shim_bootloaders_x86_64 || exit 1
_prepare_uefi_shell_tianocore || exit 1
_prepare_efitools_uefi || exit 1
_prepare_uefi_X64_GRUB_USB_files || exit 1
_prepare_uefi_IA32_GRUB_USB_files || exit 1
_prepare_uefi_X64 || exit 1
_prepare_uefi_IA32 || exit 1
_prepare_background || exit 1
_reproducibility
_prepare_uefi_image || exit 1
_reproducibility

View file

@ -9,6 +9,7 @@ _SHIM_RPM="x86_64/shim-x64-${_SHIM_VERSION}-${_SHIM_RELEASE}.x86_64.rpm"
_SHIM32_RPM="x86_64/shim-ia32-${_SHIM_VERSION}-${_SHIM_RELEASE}.x86_64.rpm"
_SHIM_AA64_RPM="aarch64/shim-aa64-${_SHIM_VERSION}-${_SHIM_RELEASE}.aarch64.rpm"
_ARCH_SERVERDIR="/home/tpowa/public_html/archboot-helper/bootloader"
_GRUB_ISO="/usr/share/archboot/grub/grub-iso.cfg"
_prepare_shim_files () {
# download packages from fedora server
@ -35,23 +36,23 @@ _prepare_shim_files () {
}
# build grubXXX with all modules: http://bugs.archlinux.org/task/71382
_prepare_uefi_X64_GRUB_USB_files() {
_prepare_uefi_X64() {
echo "Prepare X64 Grub ..."
### Hint: https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/grub.macros#_407
grub-mkstandalone -d /usr/lib/grub/x86_64-efi -O x86_64-efi --sbat=/usr/share/grub/sbat.csv --modules="all_video boot btrfs cat configfile cryptodisk echo efi_gop efi_uga efifwsetup efinet ext2 f2fs fat font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gzio halt hfsplus http iso9660 loadenv loopback linux lvm lsefi lsefimmap luks luks2 mdraid09 mdraid1x minicmd net normal part_apple part_msdos part_gpt password_pbkdf2 pgp png reboot regexp search search_fs_uuid search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs zstd backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard" --fonts="unicode" --locales="" --themes="" -o grub-efi/grubx64.efi "boot/grub/grub.cfg=${_GRUB_CONFIG}"
grub-mkstandalone -d /usr/lib/grub/x86_64-efi -O x86_64-efi --sbat=/usr/share/grub/sbat.csv --modules="all_video boot btrfs cat configfile cryptodisk echo efi_gop efi_uga efifwsetup efinet ext2 f2fs fat font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gzio halt hfsplus http iso9660 loadenv loopback linux lvm lsefi lsefimmap luks luks2 mdraid09 mdraid1x minicmd net normal part_apple part_msdos part_gpt password_pbkdf2 pgp png reboot regexp search search_fs_uuid search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs zstd backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard" --fonts="unicode" --locales="" --themes="" -o grub-efi/grubx64.efi "boot/grub/grub.cfg=${_GRUB_ISO}"
}
_prepare_uefi_IA32_GRUB_USB_files() {
_prepare_uefi_IA32() {
echo "Prepare IA32 Grub ..."
### Hint: https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/grub.macros#_407
grub-mkstandalone -d /usr/lib/grub/i386-efi -O i386-efi --sbat=/usr/share/grub/sbat.csv --modules="all_video boot btrfs cat configfile cryptodisk echo efi_gop efi_uga efifwsetup efinet ext2 f2fs fat font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gzio halt hfsplus http iso9660 loadenv loopback linux lvm lsefi lsefimmap luks luks2 mdraid09 mdraid1x minicmd net normal part_apple part_msdos part_gpt password_pbkdf2 pgp png reboot regexp search search_fs_uuid search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs zstd backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard" --fonts="unicode" --locales="" --themes="" -o grub-efi/grubia32.efi "boot/grub/grub.cfg=${_GRUB_CONFIG}"
grub-mkstandalone -d /usr/lib/grub/i386-efi -O i386-efi --sbat=/usr/share/grub/sbat.csv --modules="all_video boot btrfs cat configfile cryptodisk echo efi_gop efi_uga efifwsetup efinet ext2 f2fs fat font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gzio halt hfsplus http iso9660 loadenv loopback linux lvm lsefi lsefimmap luks luks2 mdraid09 mdraid1x minicmd net normal part_apple part_msdos part_gpt password_pbkdf2 pgp png reboot regexp search search_fs_uuid search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs zstd backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard" --fonts="unicode" --locales="" --themes="" -o grub-efi/grubia32.efi "boot/grub/grub.cfg=${_GRUB_ISO}"
}
# build grubXXX with all modules: http://bugs.archlinux.org/task/71382
_prepare_uefi_AA64_GRUB_USB_files() {
_prepare_uefi_AA64() {
echo "Prepare AA64 Grub ..."
### Hint: https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/grub.macros#_407
systemd-nspawn -q -D grub-aarch64 grub-mkstandalone -d /usr/lib/grub/arm64-efi -O arm64-efi --sbat=/usr/share/grub/sbat.csv --modules="all_video boot btrfs cat configfile cryptodisk echo efi_gop efifwsetup efinet ext2 f2fs fat font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gzio halt hfsplus http iso9660 loadenv loopback linux lvm lsefi lsefimmap luks luks2 mdraid09 mdraid1x minicmd net normal part_apple part_msdos part_gpt password_pbkdf2 pgp png reboot regexp search search_fs_uuid search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs zstd chain tpm" --fonts="unicode" --locales="" --themes="" -o /grubaa64.efi "boot/grub/grub.cfg=${_GRUB_CONFIG}"
systemd-nspawn -q -D grub-aarch64 grub-mkstandalone -d /usr/lib/grub/arm64-efi -O arm64-efi --sbat=/usr/share/grub/sbat.csv --modules="all_video boot btrfs cat configfile cryptodisk echo efi_gop efifwsetup efinet ext2 f2fs fat font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gzio halt hfsplus http iso9660 loadenv loopback linux lvm lsefi lsefimmap luks luks2 mdraid09 mdraid1x minicmd net normal part_apple part_msdos part_gpt password_pbkdf2 pgp png reboot regexp search search_fs_uuid search_fs_file search_label serial sleep syslinuxcfg test tftp video xfs zstd chain tpm" --fonts="unicode" --locales="" --themes="" -o /grubaa64.efi "boot/grub/grub.cfg=${_GRUB_ISO}"
mv grub-aarch64/grubaa64.efi grub-efi/
}

View file

@ -105,22 +105,28 @@ _prepare_uefi_shell_tianocore() {
}
# build grubXXX with all modules: http://bugs.archlinux.org/task/71382
_prepare_uefi_X64_GRUB_USB_files() {
_prepare_uefi_X64() {
echo "Prepare X64 Grub ..."
cp /usr/share/archboot/bootloader/grubx64.efi "${_ISODIR}/EFI/BOOT/"
}
_prepare_uefi_IA32_GRUB_USB_files() {
_prepare_uefi_IA32() {
echo "Prepare IA32 Grub ..."
cp /usr/share/archboot/bootloader/grubia32.efi "${_ISODIR}/EFI/BOOT/"
}
# build grubXXX with all modules: http://bugs.archlinux.org/task/71382
_prepare_uefi_AA64_GRUB_USB_files() {
_prepare_uefi_AA64() {
echo "Prepare AA64 Grub ..."
cp /usr/share/archboot/bootloader/grubaa64.efi "${_ISODIR}/EFI/BOOT/"
}
_prepare_background() {
echo "Prepare Grub background ..."
[[ -d "${_ISODIR}/boot/grub" ]] || mkdir -p "${_ISODIR}/boot/grub"
cp ${_GRUB_BACKGROUND} "${_ISODIR}/boot/grub/archboot-background.png"
}
_reproducibility() {
# Reproducibility: set all timestamps to 0
# from /usr/bin/mkinitcpio
@ -146,7 +152,7 @@ _grub_mkrescue() {
# --set_all_file_dates for all files
# --modification-date= for boot.catalog
echo "Generating ${_RUNNING_ARCH} hybrid ISO ..."
grub-mkrescue --set_all_file_dates 'Jan 1 00:00:00 UTC 1970' --modification-date=1970010100000000 --compress=xz --fonts="unicode" --locales="" --themes="" -o "${_IMAGENAME}.iso" "${_ISODIR}"/ "boot/grub/grub.cfg=${_GRUB_CONFIG}" &> "${_IMAGENAME}.log"
grub-mkrescue --set_all_file_dates 'Jan 1 00:00:00 UTC 1970' --modification-date=1970010100000000 --compress=xz --fonts="unicode" --locales="" --themes="" -o "${_IMAGENAME}.iso" "${_ISODIR}"/ "boot/grub/grub-archboot.cfg=${_GRUB_CONFIG}" &> "${_IMAGENAME}.log"
}
_reproducibility_iso() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View file

@ -0,0 +1,6 @@
insmod part_gpt
insmod part_msdos
insmod fat
search --no-floppy --set=root --file /boot/grub/grub-archboot.cfg
configfile "/boot/grub/grub-archboot.cfg"

View file

@ -1,19 +1,12 @@
insmod part_gpt
insmod part_msdos
insmod fat
if [ ${grub_platform} == "efi" ]; then
insmod all_video
insmod efi_gop
if [ ${grub_cpu} == "x86_64" ]; then
insmod efi_uga
fi
if [ ${grub_cpu} == "i386" ]; then
elif [ ${grub_cpu} == "i386" ]; then
insmod efi_uga
fi
fi
if [ "\${grub_platform}" == "pc" ]; then
elif [ ${grub_platform} == "pc" ]; then
insmod vbe
insmod vga
fi
@ -24,62 +17,20 @@ insmod video_cirrus
insmod font
insmod serial
serial --unit=0 --speed=115200
if loadfont "${prefix}/fonts/unicode.pf2" ; then
if loadfont /boot/grub/fonts/unicode.pf2 ; then
insmod gfxterm
set gfxmode="auto"
terminal_input console serial
terminal_output gfxterm serial
fi
if [ ${grub_platform} == "efi" ]; then
if [ ${grub_cpu} == "i386" ]; then
set default="Arch Linux x86_64 Archboot - EFI MIXED MODE"
fi
if [ ${grub_cpu} == "x86_64" ]; then
set default="Arch Linux x86_64 Archboot"
fi
if [ ${grub_cpu} == "arm64" ]; then
set default="Arch Linux AA64 Archboot"
fi
fi
if [ ${grub_platform} == "pc" ]; then
set default="Arch Linux X86_64 Archboot - BIOS Mode"
background_image /boot/grub/archboot-background.png
fi
set timeout="10"
if [ ${grub_platform} == "efi" ]; then
if [ ${grub_cpu} == "arm64" ]; then
menuentry "Arch Linux AA64 Archboot" {
set gfxpayload=keep
search --no-floppy --set=root --file /boot/vmlinuz_aarch64
linux /boot/vmlinuz_aarch64 cgroup_disable=memory rootfstype=ramfs audit=0 nr_cpus=1 add_efi_memmap
initrd /boot/amd-ucode.img /boot/initramfs_aarch64.img
}
fi
if [ ${grub_cpu} == "x86_64" ]; then
menuentry "Arch Linux x86_64 Archboot" {
set gfxpayload=keep
search --no-floppy --set=root --file /boot/vmlinuz_x86_64
linux /boot/vmlinuz_x86_64 cgroup_disable=memory rootfstype=ramfs add_efi_memmap
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
}
fi
if [ ${grub_cpu} == "i386" ]; then
menuentry "Arch Linux x86_64 Archboot - EFI MIXED MODE" {
set gfxpayload=keep
search --no-floppy --set=root --file /boot/vmlinuz_x86_64
linux /boot/vmlinuz_x86_64 cgroup_disable=memory _IA32_UEFI=1 rootfstype=ramfs add_efi_memmap
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
}
fi
fi
if [ ${grub_platform} == "pc" ]; then
set default="Arch Linux X86_64 Archboot - BIOS Mode"
menuentry "Arch Linux x86_64 Archboot - BIOS Mode" {
set gfxpayload=keep
search --no-floppy --set=root --file /boot/vmlinuz_x86_64
linux /boot/vmlinuz_x86_64 cgroup_disable=memory rootfstype=ramfs
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
}
@ -87,47 +38,66 @@ fi
if [ ${grub_platform} == "efi" ]; then
if [ ${grub_cpu} == "x86_64" ]; then
menuentry "Secure Boot KeyTool" {
search --no-floppy --set=root --file /EFI/tools/KeyTool.efi
chainloader /EFI/tools/KeyTool.efi
set default="Arch Linux x86_64 Archboot"
menuentry "Arch Linux x86_64 Archboot" {
set gfxpayload=keep
linux /boot/vmlinuz_x86_64 cgroup_disable=memory rootfstype=ramfs add_efi_memmap
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
}
menuentry "Secure Boot HashTool" {
search --no-floppy --set=root --file /EFI/tools/HashTool.efi
chainloader /EFI/tools/HashTool.efi
}
fi
if [ ${grub_cpu} == "arm64" ]; then
submenu "UEFI Tools" {
menuentry "Secure Boot KeyTool" {
search --no-floppy --set=root --file /EFI/tools/KeyTool.efi
chainloader /EFI/tools/KeyTool.efi
}
chainloader /EFI/tools/KeyTool.efi
}
menuentry "Secure Boot HashTool" {
search --no-floppy --set=root --file /EFI/tools/HashTool.efi
chainloader /EFI/tools/HashTool.efi
}
fi
if [ ${grub_cpu} == "i386" ]; then
menuentry "UEFI Shell IA32 v2" {
search --no-floppy --set=root --file /EFI/tools/shellia32_v2.efi
chainloader /EFI/tools/shellia32_v2.efi
}
menuentry "Secure Boot HashTool" {
chainloader /EFI/tools/HashTool.efi
}
menuentry "UEFI Shell X64 v2" {
chainloader /EFI/tools/shellx64_v2.efi
}
menuentry "UEFI Shell IA32 v1" {
search --no-floppy --set=root --file /EFI/tools/shellia32_v1.efi
chainloader /EFI/tools/shellia32_v1.efi
menuentry "UEFI Shell X64 v1" {
chainloader /EFI/tools/shellx64_v1.efi
}
}
fi
if [ ${grub_cpu} == "x86_64" ]; then
menuentry "UEFI Shell X64 v2" {
search --no-floppy --set=root --file /EFI/tools/shellx64_v2.efi
chainloader /EFI/tools/shellx64_v2.efi
elif [ ${grub_cpu} == "arm64" ]; then
set default="Arch Linux AA64 Archboot"
menuentry "Arch Linux AA64 Archboot" {
set gfxpayload=keep
linux /boot/vmlinuz_aarch64 cgroup_disable=memory rootfstype=ramfs audit=0 nr_cpus=1 add_efi_memmap
initrd /boot/amd-ucode.img /boot/initramfs_aarch64.img
}
submenu "UEFI Tools" {
menuentry "Secure Boot KeyTool" {
chainloader /EFI/tools/KeyTool.efi
}
menuentry "UEFI Shell X64 v1" {
search --no-floppy --set=root --file /EFI/tools/shellx64_v1.efi
chainloader /EFI/tools/shellx64_v1.efi
menuentry "Secure Boot HashTool" {
chainloader /EFI/tools/HashTool.efi
}
}
elif [ ${grub_cpu} == "i386" ]; then
set default="Arch Linux x86_64 Archboot - EFI MIXED MODE"
menuentry "Arch Linux x86_64 Archboot - EFI MIXED MODE" {
set gfxpayload=keep
linux /boot/vmlinuz_x86_64 cgroup_disable=memory _IA32_UEFI=1 rootfstype=ramfs add_efi_memmap
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img
}
submenu "UEFI Tools" {
menuentry "UEFI Shell IA32 v2" {
chainloader /EFI/tools/shellia32_v2.efi
}
menuentry "UEFI Shell IA32 v1" {
chainloader /EFI/tools/shellia32_v1.efi
}
}
fi
menuentry "Enter Firmware Setup" {