mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
grub: fixes for wallpaper / gfxmode / submenu /etc
- Debian working - Ubuntu's grub needs more work
This commit is contained in:
committed by
igorpecovnik
parent
ea952814d1
commit
89a7cc971b
@@ -140,19 +140,6 @@ pre_umount_final_image__install_grub() {
|
||||
# Mount the chroot...
|
||||
mount_chroot "$chroot_target/" # this already handles /boot/efi which is required for it to work.
|
||||
|
||||
# update-grub is secretly `grub-mkconfig` under wraps, but the actual work is done by /etc/grub.d/10-linux
|
||||
# that decides based on 'test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"' so that _must_ exist.
|
||||
# If it does NOT exist, then a reference to a /dev/devYpX is used, and will fail to boot.
|
||||
# Irony: let's use grub-probe to find out the UUID of the root partition, and then create a symlink to it.
|
||||
# Another: on some systems (eg, not Docker) the thing might already exist due to udev actually working.
|
||||
# shellcheck disable=SC2016 # some wierd escaping going on there.
|
||||
chroot_custom "$chroot_target" mkdir -pv '/dev/disk/by-uuid/"$(grub-probe --target=fs_uuid /)"' "||" true
|
||||
|
||||
display_alert "Creating GRUB config..." "grub-mkconfig" ""
|
||||
chroot_custom "$chroot_target" update-grub || {
|
||||
exit_with_error "update-grub failed!"
|
||||
}
|
||||
|
||||
if [[ "${UEFI_GRUB_TARGET_BIOS}" != "" ]]; then
|
||||
display_alert "Installing GRUB BIOS..." "${UEFI_GRUB_TARGET_BIOS} device ${LOOP}" ""
|
||||
chroot_custom "$chroot_target" grub-install --target=${UEFI_GRUB_TARGET_BIOS} "${LOOP}" || {
|
||||
@@ -166,6 +153,19 @@ pre_umount_final_image__install_grub() {
|
||||
exit_with_error "${install_grub_cmdline} failed!"
|
||||
}
|
||||
|
||||
# update-grub is secretly `grub-mkconfig` under wraps, but the actual work is done by /etc/grub.d/10-linux
|
||||
# that decides based on 'test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"' so that _must_ exist.
|
||||
# If it does NOT exist, then a reference to a /dev/devYpX is used, and will fail to boot.
|
||||
# Irony: let's use grub-probe to find out the UUID of the root partition, and then create a symlink to it.
|
||||
# Another: on some systems (eg, not Docker) the thing might already exist due to udev actually working.
|
||||
# shellcheck disable=SC2016 # some wierd escaping going on there.
|
||||
chroot_custom "$chroot_target" mkdir -pv '/dev/disk/by-uuid/"$(grub-probe --target=fs_uuid /)"' "||" true
|
||||
|
||||
display_alert "Creating GRUB config..." "grub-mkconfig" ""
|
||||
chroot_custom "$chroot_target" update-grub || {
|
||||
exit_with_error "update-grub failed!"
|
||||
}
|
||||
|
||||
### Sanity check. The produced "/boot/grub/grub.cfg" should:
|
||||
declare -i has_failed_sanity_check=0
|
||||
|
||||
@@ -190,6 +190,13 @@ pre_umount_final_image__install_grub() {
|
||||
exit_with_error "GRUB config sanity check failed, image will be unbootable; see above errors"
|
||||
fi
|
||||
|
||||
# Check and warn if the wallpaper was not picked up by grub-mkconfig.
|
||||
if ! grep -q "background_image" "${chroot_target}/boot/grub/grub.cfg"; then
|
||||
display_alert "GRUB mkconfig problem" "no wallpaper detected in generated grub.cfg" "warn"
|
||||
else
|
||||
display_alert "GRUB config sanity check passed" "wallpaper setup" "debug"
|
||||
fi
|
||||
|
||||
# Remove host-side config.
|
||||
rm -f "${MOUNT}"/etc/default/grub.d/99-armbian-host-side.cfg
|
||||
|
||||
@@ -234,6 +241,8 @@ configure_grub() {
|
||||
GRUB_TIMEOUT_STYLE=menu # Show the menu with Kernel options (Armbian or -generic)...
|
||||
GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT} # ... for ${UEFI_GRUB_TIMEOUT} seconds, then boot the Armbian default.
|
||||
GRUB_DISTRIBUTOR="${UEFI_GRUB_DISTRO_NAME}" # On GRUB menu will show up as "Armbian GNU/Linux" (will show up in some UEFI BIOS boot menu (F8?) as "armbian", not on others)
|
||||
GRUB_DISABLE_SUBMENU=y # Do not put all kernel options into a submenu, instead, list them all on the main menu.
|
||||
GRUB_DISABLE_OS_PROBER=false # Have to be explicit about enabling os-prober
|
||||
GRUB_GFXMODE=1024x768
|
||||
GRUB_GFXPAYLOAD=keep
|
||||
grubCfgFrag
|
||||
|
||||
Reference in New Issue
Block a user