|
From: | kbader94 |
Subject: | [PATCH v1 3/3] fb rotation - Add config option to grub-mkconfig to enable setting GRUB_FB_ROTATION in grub's config file. Setting GRUB_FB_ROTATION to 90, 180, 270, 'left', 'right', or 'inverted' will set the rotation for both grub AND linux. For linux, the changes are passed on to linux kernel entries if GRUB_GFXPAYLOAD_LINUX = 'keep'. |
Date: | Mon, 17 Jun 2024 22:14:45 -0600 |
Changes to be committed: modified: util/grub-mkconfig.in modified: util/grub.d/00_header.in modified: util/grub.d/10_linux.in Signed-off-by: kbader94 <kyle.bader94@gmail.com> --- util/grub-mkconfig.in | 1 + util/grub.d/00_header.in | 16 ++++++++++++++++ util/grub.d/10_linux.in | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index 32c480dae..b915fcf00 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -247,6 +247,7 @@ export GRUB_DEFAULT \ GRUB_DISABLE_RECOVERY \ GRUB_VIDEO_BACKEND \ GRUB_GFXMODE \ + GRUB_FB_ROTATION \ GRUB_BACKGROUND \ GRUB_THEME \ GRUB_GFXPAYLOAD_LINUX \ diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in index f86b69bad..990fce9ed 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -47,6 +47,22 @@ if [ -s \$prefix/grubenv ]; then load_env fi EOF + +# Set fb rotation for grub +if [ "x$GRUB_FB_ROTATION" != x ]; then + case "${GRUB_FB_ROTATION}" in + inverted | 180) + echo set rotation=180 + ;; + left | 90) + echo set rotation=90 + ;; + right | 270) + echo set rotation=270 + ;; + esac +fi + if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then cat <<EOF if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index cc393be7e..671373837 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -120,10 +120,42 @@ linux_entry () && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/" fi + + # Set fb rotation by default + case "${GRUB_FB_ROTATION}" in + inverted | 180) + args="$args fbcon=rotate:2" + ;; + left | 90) + args="$args fbcon=rotate:3" + ;; + right | 270) + args="$args fbcon=rotate:1" + ;; + esac + else if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then echo " load_video" | sed "s/^/$submenu_indentation/" fi + + if [ "x$GRUB_GFXPAYLOAD_LINUX" = "xkeep" ]; then + + # Set fb rotation if gfxpayload == keep + case "${GRUB_FB_ROTATION}" in + inverted | 180) + args="$args fbcon=rotate:2" + ;; + left | 90) + args="$args fbcon=rotate:3" + ;; + right | 270) + args="$args fbcon=rotate:1" + ;; + esac + + fi + echo " set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/" fi -- 2.34.1
[Prev in Thread] | Current Thread | [Next in Thread] |