- Fixes and improvements in the boot menu for x86_64 and aarch64:
- Fixed boot from hard disk in the legacy BIOS mode (x86_64 only)
- Added "p" keyboard shortcut to interactively configure the root
password for the installer live system
- Added support for serial console
- Disable plymouth graphical boot when the grub boot menu is
switched to text mode with the "t" keyboard shortcut
- Fixed failed image build because of missing configuration options
for the "image-janitor" tool
176 lines
5.2 KiB
Bash
Executable file
176 lines
5.2 KiB
Bash
Executable file
#! /bin/bash
|
|
|
|
# Custom menu to ensure that we boot correctly
|
|
# from local disk on UEFI
|
|
# https://github.com/openSUSE/agama/issues/1609
|
|
# KIWI config
|
|
|
|
set -e
|
|
|
|
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
|
|
|
|
arch=$(uname -m)
|
|
profile=$(echo "$kiwi_profiles" | tr "_" " ")
|
|
label="$profile ($arch)"
|
|
|
|
if [ -d "$dst/boot/grub2/themes/SLE" ]; then
|
|
theme="SLE"
|
|
else
|
|
theme="openSUSE"
|
|
fi
|
|
|
|
#
|
|
# Create grub.cfg
|
|
#
|
|
cat >$dst/boot/grub2/grub.cfg <<XXX
|
|
# Agama generated grub2 config file
|
|
insmod serial
|
|
insmod read
|
|
|
|
set btrfs_relative_path="y"
|
|
export btrfs_relative_path
|
|
set default=0
|
|
if [ -n "\${iso_path}" ]; then
|
|
isoboot="iso-scan/filename=\${iso_path}"
|
|
fi
|
|
set timeout=60
|
|
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/$theme/ascii.pf2
|
|
set sans_bold_14_font=grub2/themes/$theme/DejaVuSans-Bold14.pf2
|
|
set sans_10_font=grub2/themes/$theme/DejaVuSans10.pf2
|
|
set sans_12_font=grub2/themes/$theme/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/$theme/theme.txt ];then
|
|
set theme=(\$root)/boot/grub2/themes/$theme/theme.txt
|
|
fi
|
|
|
|
# if serial port is successfully configured allow input/output to it as well
|
|
if serial --unit=0 --speed=9600; then
|
|
terminal_input console serial
|
|
terminal_output gfxterm serial
|
|
set extra_output=serial
|
|
# this detects that a serial port is present but that does not mean a serial
|
|
# console is attached there so we cannot for example disable plymouth
|
|
else
|
|
terminal_input console
|
|
terminal_output gfxterm
|
|
fi
|
|
|
|
if [ "\${grub_platform}" != "efi" ]; then
|
|
# classic BIOS boot, try booting from MBR from the first disk
|
|
menuentry "Boot from Hard Disk" --class os --unrestricted {
|
|
insmod file
|
|
|
|
# check if the first disk contains a valid boot sector
|
|
if file --is-x86-bios-bootsector (hd0)+1; then
|
|
chainloader (hd0)+1
|
|
else
|
|
echo "The first disk does not seem to be bootable."
|
|
echo ""
|
|
echo "If you are sure the system can boot from hard disk"
|
|
echo "then remove the installation medium and reboot the machine."
|
|
echo ""
|
|
echo "Press Enter to return ..."
|
|
read -s
|
|
fi
|
|
}
|
|
fi
|
|
|
|
menuentry "Install $label" --class os --unrestricted {
|
|
set gfxpayload=keep
|
|
echo Loading kernel...
|
|
linux (\$root)/boot/x86_64/loader/linux \${isoboot} splash=silent \${plymouth} \${live_options}
|
|
echo Loading initrd...
|
|
initrd (\$root)/boot/x86_64/loader/initrd
|
|
}
|
|
menuentry "Failsafe -- Install $label" --class os --unrestricted {
|
|
set gfxpayload=keep
|
|
echo Loading kernel...
|
|
linux (\$root)/boot/x86_64/loader/linux \${isoboot} ide=nodma apm=off noresume edd=off nomodeset 3 \${live_options}
|
|
echo Loading initrd...
|
|
initrd (\$root)/boot/x86_64/loader/initrd
|
|
}
|
|
menuentry "Check Installation Medium" --class os --unrestricted {
|
|
set gfxpayload=keep
|
|
echo Loading kernel...
|
|
linux (\$root)/boot/x86_64/loader/linux mediacheck=1 plymouth.enable=0 \${isoboot} \${live_options}
|
|
echo Loading initrd...
|
|
initrd (\$root)/boot/x86_64/loader/initrd
|
|
}
|
|
menuentry "Rescue System" --class os --unrestricted {
|
|
set gfxpayload=keep
|
|
echo Loading kernel...
|
|
linux (\$root)/boot/x86_64/loader/linux \${isoboot} $RESCUE_SYSTEM_BOOT_SETTINGS
|
|
echo Loading initrd...
|
|
initrd (\$root)/boot/x86_64/loader/initrd
|
|
}
|
|
|
|
hiddenentry "Text mode" --hotkey "t" {
|
|
set textmode=true
|
|
set plymouth="plymouth.enable=0"
|
|
terminal_output console \${extra_output}
|
|
}
|
|
|
|
hiddenentry "Set Live system password" --hotkey "p" {
|
|
echo "Enter the new root password for the installer live system:"
|
|
read -s live_password
|
|
echo "Retype the password again:"
|
|
read -s live_password_confirmed
|
|
|
|
if [ "\${live_password}" != "\${live_password_confirmed}" ]; then
|
|
echo "ERROR: The passwords do not match!"
|
|
echo "Press Enter to return ..."
|
|
read -s
|
|
else
|
|
if [ -z "\${live_password}" ]; then
|
|
echo "ERROR: The password cannot be empty!"
|
|
echo "Press Enter to return ..."
|
|
read -s
|
|
else
|
|
set live_options="live.password=\${live_password}"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
if [ "\${grub_platform}" = "efi" ]; then
|
|
menuentry "UEFI Firmware Settings" {
|
|
fwsetup --is-supported
|
|
if [ "\$?" = 0 ]; then
|
|
fwsetup
|
|
else
|
|
echo "Your firmware doesn't support setup menu entry from a boot loader"
|
|
echo "Press Enter to return ..."
|
|
read -s
|
|
fi
|
|
}
|
|
fi
|
|
XXX
|