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" _LINUX_FIRMWARE="linux-firmware"
# grub config to use # grub config to use
_GRUB_CONFIG="/usr/share/archboot/grub/grub.cfg" _GRUB_CONFIG="/usr/share/archboot/grub/grub.cfg"
_GRUB_BACKGROUND="/usr/share/archboot/grub/archboot-background.png"
### server setup ### server setup
# release directory # release directory
_DIR="$(date +%Y.%m)" _DIR="$(date +%Y.%m)"

View file

@ -12,7 +12,8 @@ echo "Starting ISO creation ..."
_prepare_kernel_initramfs_files || exit 1 _prepare_kernel_initramfs_files || exit 1
_prepare_fedora_shim_bootloaders_aarch64 || exit 1 _prepare_fedora_shim_bootloaders_aarch64 || exit 1
_prepare_efitools_uefi || 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 _reproducibility
_prepare_uefi_image || exit 1 _prepare_uefi_image || exit 1
_reproducibility _reproducibility

View file

@ -11,10 +11,11 @@ _prepare_shim_files || exit 1
_upload_efi_files shim-fedora || exit 1 _upload_efi_files shim-fedora || exit 1
_cleanup shim-fedora || exit 1 _cleanup shim-fedora || exit 1
mkdir -m 777 grub-efi mkdir -m 777 grub-efi
_prepare_uefi_X64_GRUB_USB_files || exit 1 _grub_cfg
_prepare_uefi_IA32_GRUB_USB_files || exit 1 _prepare_uefi_X64 || exit 1
_prepare_uefi_IA32 || exit 1
archboot-aarch64-create-container.sh grub-aarch64 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 _cleanup grub-aarch64 || exit 1
_upload_efi_files grub-efi _upload_efi_files grub-efi
_cleanup grub-efi || exit 1 _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_fedora_shim_bootloaders_x86_64 || exit 1
_prepare_uefi_shell_tianocore || exit 1 _prepare_uefi_shell_tianocore || exit 1
_prepare_efitools_uefi || exit 1 _prepare_efitools_uefi || exit 1
_prepare_uefi_X64_GRUB_USB_files || exit 1 _prepare_uefi_X64 || exit 1
_prepare_uefi_IA32_GRUB_USB_files || exit 1 _prepare_uefi_IA32 || exit 1
_prepare_background || exit 1
_reproducibility _reproducibility
_prepare_uefi_image || exit 1 _prepare_uefi_image || exit 1
_reproducibility _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" _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" _SHIM_AA64_RPM="aarch64/shim-aa64-${_SHIM_VERSION}-${_SHIM_RELEASE}.aarch64.rpm"
_ARCH_SERVERDIR="/home/tpowa/public_html/archboot-helper/bootloader" _ARCH_SERVERDIR="/home/tpowa/public_html/archboot-helper/bootloader"
_GRUB_ISO="/usr/share/archboot/grub/grub-iso.cfg"
_prepare_shim_files () { _prepare_shim_files () {
# download packages from fedora server # download packages from fedora server
@ -35,23 +36,23 @@ _prepare_shim_files () {
} }
# build grubXXX with all modules: http://bugs.archlinux.org/task/71382 # build grubXXX with all modules: http://bugs.archlinux.org/task/71382
_prepare_uefi_X64_GRUB_USB_files() { _prepare_uefi_X64() {
echo "Prepare X64 Grub ..." echo "Prepare X64 Grub ..."
### Hint: https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/grub.macros#_407 ### 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 ..." echo "Prepare IA32 Grub ..."
### Hint: https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/grub.macros#_407 ### 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 # build grubXXX with all modules: http://bugs.archlinux.org/task/71382
_prepare_uefi_AA64_GRUB_USB_files() { _prepare_uefi_AA64() {
echo "Prepare AA64 Grub ..." echo "Prepare AA64 Grub ..."
### Hint: https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/grub.macros#_407 ### 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/ 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 # build grubXXX with all modules: http://bugs.archlinux.org/task/71382
_prepare_uefi_X64_GRUB_USB_files() { _prepare_uefi_X64() {
echo "Prepare X64 Grub ..." echo "Prepare X64 Grub ..."
cp /usr/share/archboot/bootloader/grubx64.efi "${_ISODIR}/EFI/BOOT/" cp /usr/share/archboot/bootloader/grubx64.efi "${_ISODIR}/EFI/BOOT/"
} }
_prepare_uefi_IA32_GRUB_USB_files() { _prepare_uefi_IA32() {
echo "Prepare IA32 Grub ..." echo "Prepare IA32 Grub ..."
cp /usr/share/archboot/bootloader/grubia32.efi "${_ISODIR}/EFI/BOOT/" cp /usr/share/archboot/bootloader/grubia32.efi "${_ISODIR}/EFI/BOOT/"
} }
# build grubXXX with all modules: http://bugs.archlinux.org/task/71382 # build grubXXX with all modules: http://bugs.archlinux.org/task/71382
_prepare_uefi_AA64_GRUB_USB_files() { _prepare_uefi_AA64() {
echo "Prepare AA64 Grub ..." echo "Prepare AA64 Grub ..."
cp /usr/share/archboot/bootloader/grubaa64.efi "${_ISODIR}/EFI/BOOT/" 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() {
# Reproducibility: set all timestamps to 0 # Reproducibility: set all timestamps to 0
# from /usr/bin/mkinitcpio # from /usr/bin/mkinitcpio
@ -146,7 +152,7 @@ _grub_mkrescue() {
# --set_all_file_dates for all files # --set_all_file_dates for all files
# --modification-date= for boot.catalog # --modification-date= for boot.catalog
echo "Generating ${_RUNNING_ARCH} hybrid ISO ..." 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() { _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 if [ ${grub_platform} == "efi" ]; then
insmod all_video insmod all_video
insmod efi_gop insmod efi_gop
if [ ${grub_cpu} == "x86_64" ]; then if [ ${grub_cpu} == "x86_64" ]; then
insmod efi_uga insmod efi_uga
fi elif [ ${grub_cpu} == "i386" ]; then
if [ ${grub_cpu} == "i386" ]; then
insmod efi_uga insmod efi_uga
fi fi
fi elif [ ${grub_platform} == "pc" ]; then
if [ "\${grub_platform}" == "pc" ]; then
insmod vbe insmod vbe
insmod vga insmod vga
fi fi
@ -24,62 +17,20 @@ insmod video_cirrus
insmod font insmod font
insmod serial insmod serial
serial --unit=0 --speed=115200 serial --unit=0 --speed=115200
if loadfont "${prefix}/fonts/unicode.pf2" ; then if loadfont /boot/grub/fonts/unicode.pf2 ; then
insmod gfxterm insmod gfxterm
set gfxmode="auto" set gfxmode="auto"
terminal_input console serial terminal_input console serial
terminal_output gfxterm serial terminal_output gfxterm serial
fi background_image /boot/grub/archboot-background.png
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"
fi fi
set timeout="10" 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 if [ ${grub_platform} == "pc" ]; then
set default="Arch Linux X86_64 Archboot - BIOS Mode"
menuentry "Arch Linux x86_64 Archboot - BIOS Mode" { menuentry "Arch Linux x86_64 Archboot - BIOS Mode" {
set gfxpayload=keep set gfxpayload=keep
search --no-floppy --set=root --file /boot/vmlinuz_x86_64
linux /boot/vmlinuz_x86_64 cgroup_disable=memory rootfstype=ramfs linux /boot/vmlinuz_x86_64 cgroup_disable=memory rootfstype=ramfs
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs_x86_64.img 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_platform} == "efi" ]; then
if [ ${grub_cpu} == "x86_64" ]; then if [ ${grub_cpu} == "x86_64" ]; then
menuentry "Secure Boot KeyTool" { set default="Arch Linux x86_64 Archboot"
search --no-floppy --set=root --file /EFI/tools/KeyTool.efi
chainloader /EFI/tools/KeyTool.efi 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" { submenu "UEFI Tools" {
search --no-floppy --set=root --file /EFI/tools/HashTool.efi
chainloader /EFI/tools/HashTool.efi
}
fi
if [ ${grub_cpu} == "arm64" ]; then
menuentry "Secure Boot KeyTool" { 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" { menuentry "Secure Boot HashTool" {
search --no-floppy --set=root --file /EFI/tools/HashTool.efi chainloader /EFI/tools/HashTool.efi
chainloader /EFI/tools/HashTool.efi }
}
fi menuentry "UEFI Shell X64 v2" {
if [ ${grub_cpu} == "i386" ]; then chainloader /EFI/tools/shellx64_v2.efi
menuentry "UEFI Shell IA32 v2" { }
search --no-floppy --set=root --file /EFI/tools/shellia32_v2.efi
chainloader /EFI/tools/shellia32_v2.efi
}
menuentry "UEFI Shell IA32 v1" { menuentry "UEFI Shell X64 v1" {
search --no-floppy --set=root --file /EFI/tools/shellia32_v1.efi chainloader /EFI/tools/shellx64_v1.efi
chainloader /EFI/tools/shellia32_v1.efi }
} }
fi elif [ ${grub_cpu} == "arm64" ]; then
if [ ${grub_cpu} == "x86_64" ]; then set default="Arch Linux AA64 Archboot"
menuentry "UEFI Shell X64 v2" {
search --no-floppy --set=root --file /EFI/tools/shellx64_v2.efi menuentry "Arch Linux AA64 Archboot" {
chainloader /EFI/tools/shellx64_v2.efi 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" { menuentry "Secure Boot HashTool" {
search --no-floppy --set=root --file /EFI/tools/shellx64_v1.efi chainloader /EFI/tools/HashTool.efi
chainloader /EFI/tools/shellx64_v1.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 fi
menuentry "Enter Firmware Setup" { menuentry "Enter Firmware Setup" {