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.bade...@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


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to