GRUB optimisations (#4213)

* Add wallpaper to grup, set fixed screen size, enable hidpi mode on lightdm

* Enable graphics terminal on UEFI x86, ARM64 can't test

* Missing folder

* Enable `Plymouth`

* Add proper HiDpi support and enable intel graphics auto probing

Tested on Intel and Nvidia, both works OOB. Plymouth works as expected, no text logs on screen, if OEM vendor logo is present, it picks it up auto, otherwise shows armbian (chip) logo

Co-authored-by: hzy <hzyitc@outlook.com>
This commit is contained in:
Igor Pečovnik
2022-09-23 09:35:07 +02:00
committed by GitHub
parent 93093220ea
commit 9006c54f70
7 changed files with 39 additions and 6 deletions

View File

@@ -2,3 +2,5 @@
export BOARD_NAME="UEFI arm64"
export BOARDFAMILY="uefi-arm64"
export KERNEL_TARGET="current,edge"
export BOOT_LOGO=desktop

View File

@@ -2,3 +2,5 @@
export BOARD_NAME="UEFI x86"
export BOARDFAMILY="uefi-x86"
export KERNEL_TARGET="current,edge"
export BOOT_LOGO=desktop

View File

@@ -1,7 +1,7 @@
enable_extension "grub"
export SERIALCON="tty1" # Cant reasonably expect UEFI stuff to have a serial console. Customize if otherwise.
export SKIP_BOOTSPLASH="yes" # No splash.
export UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-1} # Default 1-second timeout for GRUB menu.
export UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-3} # Default 3-seconds timeout for GRUB menu.
export BOARD_FIRMWARE_INSTALL="-full" # Install full firmware for UEFI boards
case "${BRANCH}" in

View File

@@ -1,5 +1,6 @@
# Important: LINUXFAMILY and ARCH are defined _before_ including the common family include
[[ "$BUILD_DESKTOP" == yes && "$RELEASE" == jammy ]] && enable_extension "nvidia"
export UEFI_GRUB_TERMINAL="gfxterm"
export LINUXFAMILY="x86"
export ARCH="amd64"
source "${BASH_SOURCE%/*}/include/uefi_common.inc"

View File

@@ -6,6 +6,7 @@ function extension_prepare_config__prepare_flash_kernel() {
export UEFI_GRUB_DISABLE_OS_PROBER="${UEFI_GRUB_DISABLE_OS_PROBER:-}" # 'true' will disable os-probing, useful for SD cards.
export UEFI_GRUB_DISTRO_NAME="${UEFI_GRUB_DISTRO_NAME:-Armbian}" # Will be used on grub menu display
export UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-0} # Small timeout by default
export GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT:-}" # Cmdline by default
export UEFI_ENABLE_BIOS_AMD64="${UEFI_ENABLE_BIOS_AMD64:-yes}" # Enable BIOS too if target is amd64
export UEFI_EXPORT_KERNEL_INITRD="${UEFI_EXPORT_KERNEL_INITRD:-no}" # Export kernel and initrd for direct kernel boot "kexec"
# User config overrides.
@@ -91,6 +92,10 @@ pre_umount_final_image__install_grub() {
GRUB_DISABLE_OS_PROBER=true
grubCfgFragHostSide
# copy Armbian GRUB wallpaper
mkdir -p "${MOUNT}"/usr/share/images/grub/
cp "${SRC}"/packages/blobs/splash/grub.png "${MOUNT}"/usr/share/images/grub/wallpaper.png
# Mount the chroot...
mount_chroot "$chroot_target/" # this already handles /boot/efi which is required for it to work.
@@ -135,18 +140,31 @@ pre_umount_final_image__900_export_kernel_and_initramfs() {
}
configure_grub() {
display_alert "GRUB EFI kernel cmdline" "console=${SERIALCON} distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT}" ""
[[ -n "$SERIALCON" ]] \
&& GRUB_CMDLINE_LINUX_DEFAULT+=" console=${SERIALCON}"
if [[ "_${SERIALCON}_" != "__" ]]; then
cat <<-grubCfgFrag >>"${MOUNT}"/etc/default/grub.d/98-armbian.cfg
GRUB_CMDLINE_LINUX_DEFAULT="console=${SERIALCON}" # extra Kernel cmdline is configured here
grubCfgFrag
[[ "$BOOT_LOGO" == "yes" || "$BOOT_LOGO" == "desktop" && "$BUILD_DESKTOP" == "yes" ]] \
&& GRUB_CMDLINE_LINUX_DEFAULT+=" quiet splash plymouth.ignore-serial-consoles i915.force_probe=* loglevel=3" \
|| GRUB_CMDLINE_LINUX_DEFAULT+=" splash=verbose i915.force_probe=*"
# Enable Armbian Wallpaper on GRUB
if [[ "${VENDOR}" == Armbian ]]; then
mkdir -p "${MOUNT}"/usr/share/desktop-base/
cat <<-grubWallpaper >>"${MOUNT}"/usr/share/desktop-base/grub_background.sh
WALLPAPER=/usr/share/images/grub/wallpaper.png
COLOR_NORMAL=white/black
COLOR_HIGHLIGHT=black/white
grubWallpaper
fi
display_alert "GRUB EFI kernel cmdline" "${GRUB_CMDLINE_LINUX_DEFAULT} distro=${UEFI_GRUB_DISTRO_NAME} timeout=${UEFI_GRUB_TIMEOUT}" ""
cat <<-grubCfgFrag >>"${MOUNT}"/etc/default/grub.d/98-armbian.cfg
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT}"
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_GFXMODE=1024x768
GRUB_GFXPAYLOAD=keep
grubCfgFrag
if [[ "a${UEFI_GRUB_DISABLE_OS_PROBER}" != "a" ]]; then

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@@ -314,6 +314,16 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then
systemctl is-system-running --wait >/dev/null
clear
# enable hiDPI support
if [[ "$(cat /sys/class/graphics/fb0/virtual_size 2>/dev/null | cut -d, -f1)" -gt 1920 ]]; then
# lightdm
[[ -f /etc/lightdm/slick-greeter.conf ]] && echo "enable-hidpi = on" >> /etc/lightdm/slick-greeter.conf
# xfce
[[ -f /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml ]] && sed -i 's|<property name="WindowScalingFactor" type="int" value=".*|<property name="WindowScalingFactor" type="int" value="2">|g' /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml
setfont /usr/share/consolefonts/Uni3-TerminusBold32x16.psf.gz
fi
echo -e "Welcome to \e[1m\e[97mARMBIAN\x1B[0m! \n"
echo -e "Documentation: \e[1m\e[92mhttps://docs.armbian.com\x1B[0m | Community: \e[1m\e[92mhttps://forum.armbian.com\x1B[0m\n"
GET_IP=$(bash /etc/update-motd.d/30-armbian-sysinfo | grep IP | sed "s/.*IP://" | sed 's/^[ \t]*//')