From 283d3141f2edea0f10a9ec45cc2ce48b960c7aa0 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Wed, 16 Aug 2023 13:53:37 +0200 Subject: [PATCH] Use diferent base images for livecd grub artifacts (#376) --- packages/livecd/grub2/build.yaml | 22 ++++-- packages/livecd/grub2/collection.yaml | 6 +- .../livecd/grub2/config/grub_live_bios.cfg | 70 +++++++++++++++++++ 3 files changed, 88 insertions(+), 10 deletions(-) create mode 100644 packages/livecd/grub2/config/grub_live_bios.cfg diff --git a/packages/livecd/grub2/build.yaml b/packages/livecd/grub2/build.yaml index 216cca2..2f5efc5 100644 --- a/packages/livecd/grub2/build.yaml +++ b/packages/livecd/grub2/build.yaml @@ -1,7 +1,7 @@ +{{if eq .Values.name "grub2"}} image: "opensuse/leap:15.4" prelude: -- zypper in -y git {{if .Values.arch }} {{if eq .Values.arch "amd64"}} - zypper in -y --no-recommends syslinux @@ -11,10 +11,8 @@ prelude: - zypper cc - grub2-mkimage -O i386-pc -o /usr/share/grub2/i386-pc/core.img -p /boot/grub2 -d /usr/share/grub2/i386-pc ext2 iso9660 linux echo configfile search_label search_fs_file search search_fs_uuid ls normal gzio png fat gettext font minicmd gfxterm gfxmenu all_video xfs btrfs lvm luks gcry_rijndael gcry_sha256 gcry_sha512 crypto cryptodisk test true loadenv part_gpt part_msdos biosdisk vga vbe chain boot - cat /usr/share/grub2/i386-pc/cdboot.img /usr/share/grub2/i386-pc/core.img > /usr/share/grub2/i386-pc/eltorito.img -- git clone https://github.com/kairos-io/kairos && cd kairos && git checkout -b v"{{.Values.kairos_tag}}" steps: -{{if eq .Values.name "grub2"}} - mkdir -p /boot/x86_64/loader {{if .Values.arch }} {{if eq .Values.arch "amd64"}} @@ -29,19 +27,31 @@ steps: - cp -p /usr/share/grub2/i386-pc/eltorito.img /usr/share/grub2/i386-pc/boot_hybrid.img /boot/x86_64/loader {{end}} {{end}} -- cp -p kairos/overlay/files-iso/boot/grub2/grub.cfg /boot/grub2/grub.cfg +- cp -p config/grub_live_bios.cfg /boot/grub2/grub.cfg {{end}} + {{if eq .Values.name "grub2-efi-image"}} +image: "opensuse/tumbleweed" +prelude: +{{if .Values.arch }} + {{if eq .Values.arch "amd64"}} +- zypper in -y shim grub2-x86_64-efi + {{end}} + {{if eq .Values.arch "arm64"}} +- zypper in -y shim grub2-arm64-efi + {{end}} +{{end}} +- zypper cc +steps: +- mkdir -p /EFI/BOOT {{if .Values.arch }} {{if eq .Values.arch "amd64"}} -- mkdir -p /EFI/BOOT # For removable drives the name of the efi needs to be bootx64.efi - cp /usr/share/efi/x86_64/shim.efi /EFI/BOOT/bootx64.efi - cp /usr/share/efi/x86_64/grub.efi /EFI/BOOT/grub.efi - cp /usr/share/efi/x86_64/MokManager.efi /EFI/BOOT/MokManager.efi {{end}} {{if eq .Values.arch "arm64"}} -- mkdir -p /EFI/BOOT # For removable drives the name of the efi needs to be bootaa64.efi - cp /usr/share/efi/aarch64/shim.efi /EFI/BOOT/bootaa64.efi - cp /usr/share/efi/aarch64/grub.efi /EFI/BOOT/grub.efi diff --git a/packages/livecd/grub2/collection.yaml b/packages/livecd/grub2/collection.yaml index d6b03a2..8af9522 100644 --- a/packages/livecd/grub2/collection.yaml +++ b/packages/livecd/grub2/collection.yaml @@ -1,11 +1,9 @@ packages: - name: "grub2" category: "livecd" - version: "0.0.9" + version: "0.0.10" description: "Grub2 booloader for live systems" - kairos_tag: "1.6.0" - name: "grub2-efi-image" category: "livecd" - version: "0.0.9" - kairos_tag: "1.6.0" + version: "0.0.10" description: "Grub2 booloader EFI image for live systems" diff --git a/packages/livecd/grub2/config/grub_live_bios.cfg b/packages/livecd/grub2/config/grub_live_bios.cfg new file mode 100644 index 0000000..49b8ba6 --- /dev/null +++ b/packages/livecd/grub2/config/grub_live_bios.cfg @@ -0,0 +1,70 @@ + +search --file --set=root /boot/kernel +set default=0 +set timeout=10 +set timeout_style=menu +set linux=linux +set initrd=initrd +if [ "${grub_cpu}" = "x86_64" -o "${grub_cpu}" = "i386" -o "${grub_cpu}" = "arm64" ];then + if [ "${grub_platform}" = "efi" ]; then + if [ "${grub_cpu}" != "arm64" ]; then + set linux=linuxefi + set initrd=initrdefi + fi + fi +fi +if [ "${grub_platform}" = "efi" ]; then + echo "Please press 't' to show the boot menu on this console" +fi +set font=($root)/boot/${grub_cpu}/loader/grub2/fonts/unicode.pf2 +if [ -f ${font} ];then + loadfont ${font} +fi +menuentry "Kairos" --class os --unrestricted { + echo Loading kernel... + $linux ($root)/boot/kernel cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs net.ifnames=1 console=tty1 console=ttyS0 rd.cos.disable vga=795 nomodeset nodepair.enable selinux=0 rd.live.overlay.overlayfs + echo Loading initrd... + $initrd ($root)/boot/initrd +} + +menuentry "Kairos (manual)" --class os --unrestricted { + echo Loading kernel... + $linux ($root)/boot/kernel cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs net.ifnames=1 console=tty1 console=ttyS0 rd.cos.disable vga=795 nomodeset selinux=0 rd.live.overlay.overlayfs + echo Loading initrd... + $initrd ($root)/boot/initrd +} + +menuentry "kairos (interactive install)" --class os --unrestricted { + echo Loading kernel... + $linux ($root)/boot/kernel cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs net.ifnames=1 console=tty1 console=ttyS0 rd.cos.disable vga=795 nomodeset interactive-install selinux=0 rd.live.overlay.overlayfs + echo Loading initrd... + $initrd ($root)/boot/initrd +} + +menuentry "Kairos (remote recovery mode)" --class os --unrestricted { + echo Loading kernel... + $linux ($root)/boot/kernel cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs net.ifnames=1 console=tty1 console=ttyS0 rd.cos.disable vga=795 nomodeset kairos.remote_recovery_mode selinux=0 rd.live.overlay.overlayfs + echo Loading initrd... + $initrd ($root)/boot/initrd +} + +menuentry "Kairos (boot local node from livecd)" --class os --unrestricted { + echo Loading kernel... + $linux ($root)/boot/kernel cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs net.ifnames=1 console=tty1 console=ttyS0 kairos.boot_live_mode vga=795 nomodeset selinux=0 rd.live.overlay.overlayfs + echo Loading initrd... + $initrd ($root)/boot/initrd +} + +menuentry "Kairos (debug)" --class os --unrestricted { + echo Loading kernel... + $linux ($root)/boot/kernel cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs net.ifnames=1 console=tty0 rd.debug rd.shell rd.cos.disable rd.immucore.debug vga=795 nomodeset selinux=0 rd.live.overlay.overlayfs + echo Loading initrd... + $initrd ($root)/boot/initrd +} + +if [ "${grub_platform}" = "efi" ]; then + hiddenentry "Text mode" --hotkey "t" { + set textmode=true + terminal_output console + } +fi