-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script generated boot menu for all arches #1613
Changes from all commits
88123de
1b15932
9c8aa51
571cd94
255ec58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#! /bin/bash | ||
|
||
# Custom menu to ensure that we boot correctly | ||
# from local disk on UEFI | ||
# https://github.com/openSUSE/agama/issues/1609 | ||
# KIWI config | ||
|
||
dst="$1" | ||
|
||
if [ ! -d "$dst" ] ; then | ||
echo "fix_bootconfig.aarch64: image dir \"$dst\" not found" | ||
exit 1 | ||
fi | ||
|
||
# KIWI config which should normally be inherited | ||
# from a parent process in our case xorriso | ||
# but that's not the case. | ||
test -f $dst/.profile && . $dst/.profile | ||
|
||
# | ||
# Create grub.cfg | ||
# | ||
cat >$dst/boot/grub2/grub.cfg <<XXX | ||
# kiwi generated one time grub2 config file | ||
set btrfs_relative_path="y" | ||
export btrfs_relative_path | ||
search --file --set=root /boot/0x11cebed2 | ||
set default=0 | ||
if [ -n "\$extra_cmdline" ]; then | ||
submenu "Bootable snapshot \$snapshot_num" { | ||
menuentry "If OK, run snapper rollback and reboot." { true; } | ||
} | ||
fi | ||
if [ -n "\${iso_path}" ]; then | ||
isoboot="iso-scan/filename=\${iso_path}" | ||
fi | ||
set timeout=10 | ||
set timeout_style=menu | ||
if [ "\${grub_platform}" = "efi" ]; then | ||
echo "Please press 't' to show the boot menu on this console" | ||
fi | ||
set gfxmode=auto | ||
set font=(\$root)/boot/aarch64/loader/grub2/fonts/unicode.pf2 | ||
set ascii_font=grub2/themes/openSUSE/ascii.pf2 | ||
set sans_bold_14_font=grub2/themes/openSUSE/DejaVuSans-Bold14.pf2 | ||
set sans_10_font=grub2/themes/openSUSE/DejaVuSans10.pf2 | ||
set sans_12_font=grub2/themes/openSUSE/DejaVuSans12.pf2 | ||
if [ -f \${font} ];then | ||
loadfont \${font} | ||
fi | ||
if [ -f (\$root)/boot/\${ascii_font} ];then | ||
loadfont (\$root)/boot/\${ascii_font} | ||
fi | ||
if [ -f (\$root)/boot/\${sans_bold_14_font} ];then | ||
loadfont (\$root)/boot/\${sans_bold_14_font} | ||
fi | ||
if [ -f (\$root)/boot/\${sans_10_font} ];then | ||
loadfont (\$root)/boot/\${sans_10_font} | ||
fi | ||
if [ -f (\$root)/boot/\${sans_12_font} ];then | ||
loadfont (\$root)/boot/\${sans_12_font} | ||
fi | ||
if [ -f (\$root)/boot/grub2/themes/openSUSE/theme.txt ];then | ||
set theme=(\$root)/boot/grub2/themes/openSUSE/theme.txt | ||
fi | ||
terminal_input console | ||
terminal_output gfxterm | ||
menuentry "$kiwi_iname" --class os --unrestricted { | ||
set gfxpayload=keep | ||
echo Loading kernel... | ||
linux (\$root)/boot/aarch64/loader/linux \${extra_cmdline} \${isoboot} | ||
echo Loading initrd... | ||
initrd (\$root)/boot/aarch64/loader/initrd | ||
} | ||
menuentry "Failsafe -- $kiwi_iname" --class os --unrestricted { | ||
set gfxpayload=keep | ||
echo Loading kernel... | ||
linux (\$root)/boot/aarch64/loader/linux \${extra_cmdline} \${isoboot} ide=nodma apm=off noresume edd=off nomodeset 3 | ||
echo Loading initrd... | ||
initrd (\$root)/boot/aarch64/loader/initrd | ||
} | ||
menuentry "Mediacheck" --class os --unrestricted { | ||
set gfxpayload=keep | ||
echo Loading kernel... | ||
linux (\$root)/boot/aarch64/loader/linux mediacheck=1 plymouth.enable=0 \${isoboot} | ||
echo Loading initrd... | ||
initrd (\$root)/boot/aarch64/loader/initrd | ||
} | ||
menuentry "Boot from Hard Disk" --class opensuse --class gnu-linux --class gnu --class os { | ||
exit | ||
} | ||
if [ -f "/.snapshots/grub-snapshot.cfg" ]; then | ||
source "/.snapshots/grub-snapshot.cfg" | ||
fi | ||
if [ "\${grub_platform}" = "efi" ]; then | ||
hiddenentry "Text mode" --hotkey "t" { | ||
set textmode=true | ||
terminal_output console | ||
} | ||
fi | ||
XXX | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,11 @@ if [ ! -d "$dst" ] ; then | |
exit 1 | ||
fi | ||
|
||
# KIWI config which should normally be inherited | ||
# from a parent process in our case xorriso | ||
# but that's not the case. | ||
test -f $dst/.profile && . $dst/.profile | ||
|
||
# ---------------- | ||
|
||
# Note: | ||
|
@@ -74,22 +79,22 @@ chmod 644 $boot_dir/{initrd,linux} | |
cat >$dst/boot/grub2/grub.cfg <<XXX | ||
gfxmode=auto | ||
|
||
set default='Agama Live' | ||
set default="$kiwi_iname" | ||
|
||
insmod gettext | ||
|
||
if sleep --interruptible 0 ; then | ||
timeout=60 | ||
fi | ||
|
||
menuentry 'Agama Live' --class os --unrestricted { | ||
menuentry "$kiwi_iname" --class os --unrestricted { | ||
echo 'Loading kernel...' | ||
linux /boot/ppc64le/linux | ||
echo 'Loading initrd...' | ||
initrd /boot/ppc64le/initrd | ||
} | ||
|
||
menuentry 'Check Installation Media -- Agama Live' --class os --unrestricted { | ||
menuentry "Check Installation Media -- $kiwi_iname" --class os --unrestricted { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I felt that it would be nice to cosistently use $kiwi_iname across all arches. I did not dare to touch s390x. |
||
echo 'Loading kernel...' | ||
linux /boot/ppc64le/linux mediacheck=1 plymouth.enable=0 | ||
echo 'Loading initrd...' | ||
|
@@ -115,7 +120,7 @@ XXX | |
# | ||
cat >$dst/ppc/bootinfo.txt <<XXX | ||
<chrp-boot> | ||
<description>Agama Live</description> | ||
<description>$kiwi_iname</description> | ||
<os-name>openSuSE Tumbleweed</os-name> | ||
<boot-script>boot &device;:1,\boot\grub2\grub.elf</boot-script> | ||
</chrp-boot> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#! /bin/bash | ||
|
||
# Custom menu to ensure that we boot correctly | ||
# from local disk on UEFI | ||
# https://github.com/openSUSE/agama/issues/1609 | ||
# KIWI config | ||
|
||
dst="$1" | ||
|
||
if [ ! -d "$dst" ] ; then | ||
echo "fix_bootconfig.x86_64: image dir \"$dst\" not found" | ||
exit 1 | ||
fi | ||
|
||
# KIWI config which should normally be inherited | ||
# from a parent process in our case xorriso | ||
# but that's not the case. | ||
test -f $dst/.profile && . $dst/.profile | ||
|
||
# | ||
# Create grub.cfg | ||
# | ||
cat >$dst/boot/grub2/grub.cfg <<XXX | ||
# kiwi generated one time grub2 config file | ||
set btrfs_relative_path="y" | ||
export btrfs_relative_path | ||
search --file --set=root /boot/0xebe87947 | ||
set default=0 | ||
if [ -n "\$extra_cmdline" ]; then | ||
submenu "Bootable snapshot \$snapshot_num" { | ||
menuentry "If OK, run snapper rollback and reboot." { true; } | ||
} | ||
fi | ||
if [ -n "\${iso_path}" ]; then | ||
isoboot="iso-scan/filename=\${iso_path}" | ||
fi | ||
set timeout=10 | ||
set timeout_style=menu | ||
if [ "\${grub_platform}" = "efi" ]; then | ||
echo "Please press 't' to show the boot menu on this console" | ||
fi | ||
set gfxmode=auto | ||
set font=(\$root)/boot/x86_64/loader/grub2/fonts/unicode.pf2 | ||
set ascii_font=grub2/themes/openSUSE/ascii.pf2 | ||
set sans_bold_14_font=grub2/themes/openSUSE/DejaVuSans-Bold14.pf2 | ||
set sans_10_font=grub2/themes/openSUSE/DejaVuSans10.pf2 | ||
set sans_12_font=grub2/themes/openSUSE/DejaVuSans12.pf2 | ||
if [ -f \${font} ];then | ||
loadfont \${font} | ||
fi | ||
if [ -f (\$root)/boot/\${ascii_font} ];then | ||
loadfont (\$root)/boot/\${ascii_font} | ||
fi | ||
if [ -f (\$root)/boot/\${sans_bold_14_font} ];then | ||
loadfont (\$root)/boot/\${sans_bold_14_font} | ||
fi | ||
if [ -f (\$root)/boot/\${sans_10_font} ];then | ||
loadfont (\$root)/boot/\${sans_10_font} | ||
fi | ||
if [ -f (\$root)/boot/\${sans_12_font} ];then | ||
loadfont (\$root)/boot/\${sans_12_font} | ||
fi | ||
if [ -f (\$root)/boot/grub2/themes/openSUSE/theme.txt ];then | ||
set theme=(\$root)/boot/grub2/themes/openSUSE/theme.txt | ||
fi | ||
terminal_input console | ||
terminal_output gfxterm | ||
menuentry "$kiwi_iname" --class os --unrestricted { | ||
set gfxpayload=keep | ||
echo Loading kernel... | ||
linux (\$root)/boot/x86_64/loader/linux \${extra_cmdline} \${isoboot} | ||
echo Loading initrd... | ||
initrd (\$root)/boot/x86_64/loader/initrd | ||
} | ||
menuentry "Failsafe -- $kiwi_iname" --class os --unrestricted { | ||
set gfxpayload=keep | ||
echo Loading kernel... | ||
linux (\$root)/boot/x86_64/loader/linux \${extra_cmdline} \${isoboot} ide=nodma apm=off noresume edd=off nomodeset 3 | ||
echo Loading initrd... | ||
initrd (\$root)/boot/x86_64/loader/initrd | ||
} | ||
menuentry "Mediacheck" --class os --unrestricted { | ||
set gfxpayload=keep | ||
echo Loading kernel... | ||
linux (\$root)/boot/x86_64/loader/linux mediacheck=1 plymouth.enable=0 \${isoboot} | ||
echo Loading initrd... | ||
initrd (\$root)/boot/x86_64/loader/initrd | ||
} | ||
menuentry "Boot from Hard Disk" --class opensuse --class gnu-linux --class gnu --class os { | ||
if search --no-floppy --file /efi/boot/fallback.efi --set ; then | ||
for os in opensuse sles leap; do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like somebody exchanged opensuse for leap in the past ... so now Agama:Devel/agama-installer has leap too :-) |
||
if [ -f /efi/\$os/grub.efi ] ; then | ||
chainloader /efi/\$os/grub.efi | ||
boot | ||
fi | ||
done | ||
fi | ||
exit | ||
} | ||
if [ -f "/.snapshots/grub-snapshot.cfg" ]; then | ||
source "/.snapshots/grub-snapshot.cfg" | ||
fi | ||
if [ "\${grub_platform}" = "efi" ]; then | ||
hiddenentry "Text mode" --hotkey "t" { | ||
set textmode=true | ||
terminal_output console | ||
} | ||
fi | ||
XXX | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
------------------------------------------------------------------- | ||
Mon Sep 16 15:46:23 UTC 2024 - Lubos Kocman <[email protected]> | ||
|
||
- Define boot menu for all arches by scripts in config-cdroot | ||
newly added x86_64 and aarch64 write stock copies from kiwi | ||
generated grub.cfg | ||
|
||
- intel uefi boot fix from "Boot from disk item" (gh#openSUSE/agama#1609) | ||
|
||
- Keep -x on purpose for future trubleshooting (advice from Marcus) | ||
|
||
- Use $kiwi_iname instead of static agama-live reference in all of | ||
config-cdroom/* with exception of s390x, where for some reason | ||
we use SUSE Linux... string instead | ||
|
||
|
||
------------------------------------------------------------------- | ||
Mon Sep 9 15:55:16 UTC 2024 - Eugenio Paolantonio <[email protected]> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,18 @@ | |
# This script (a) adjusts the boot config, (b) runs xorriso, and (c) makes | ||
# it zIPL bootable on s390x. | ||
# | ||
set -ex | ||
|
||
# KIWI config | ||
test -f .profile && . .profile | ||
|
||
dst=${1#iso:} | ||
|
||
# KIWI config | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's important to do this after setting $dst. I was not able to get acccess to This was working (vars inherited, without copying the file) if the fix_bootconfig was called outside xorriso. |
||
# Copy it to $dst from where it can be later read by xorriso | ||
if [ -f .profile ]; then | ||
source .profile | ||
cp .profile "$dst" | ||
fi | ||
|
||
arch=`uname -m` | ||
|
||
# removing live root setting from command line - it's in /etc/cmdline.d instead | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that this block is needed since we have now static grub.cfg |
||
|
@@ -67,7 +73,7 @@ done | |
volid=${kiwi_install_volid:-$kiwi_iname} | ||
|
||
[ -x $bootfix ] && $bootfix $dst | ||
rm -f $dst/fix_bootconfig.* | ||
rm -f $dst/fix_bootconfig.* $dst/.profile | ||
|
||
case $arch in | ||
s390x) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you test if that exit works properly on arm? does it move to the next entry in boot menu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Josef, this was a copypaste from the Arm agama-installer without any modifications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but nope we currently only test on intel in openQA and I have no arm device at hand.