Bug#929427: grub-common: Please add support for devicetree command

Dimitri John Ledkov xnox at ubuntu.com
Thu May 23 11:22:57 BST 2019


Package: grub-common
Version: 2.02+dfsg1-18
Severity: normal
Tags: patch

Dear Maintainer,

I am booting from an arm64 laptop, with secureboot turned off, and I
need to provide a devicetree blob for the time being.

I adjusted flash-kernel database, to install device tree blob into
/boot, however 10_linux in grub doesn't automatically pick it up.

The attached patch adds tests in 10_linux, similar to how initrd is
detected and generates menu entries with devicetree command and I
manage to boot and upgrade kernels on arm64 laptop.

Please consider including this patch in Debian.

Regards,

Dimitri.
-------------- next part --------------
>From 96ddabed632d330f5f32c49478c5004678aa3265 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <xnox at ubuntu.com>
Date: Wed, 22 May 2019 19:57:29 +0100
Subject: [PATCH] Add devicetree command, if a dtb is present.

Specically support dtb paths as installed by flash-kernel.

Signed-off-by: Dimitri John Ledkov <xnox at ubuntu.com>
---
 util/grub.d/10_linux.in | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 024bd5c63..012088026 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -193,6 +193,17 @@ EOF
     fi
     sed "s/^/$submenu_indentation/" << EOF
 	initrd	${rel_dirname}/${initrd}
+EOF
+  fi
+  if test -n "${dtb}" ; then
+    if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
+      message="$(gettext_printf "Loading device tree blob...")"
+      sed "s/^/$submenu_indentation/" << EOF
+	echo	'$(echo "$message" | grub_quote)'
+EOF
+    fi
+    sed "s/^/$submenu_indentation/" << EOF
+	devicetree	${rel_dirname}/${dtb}
 EOF
   fi
   sed "s/^/$submenu_indentation/" << EOF
@@ -310,6 +321,14 @@ while [ "x$list" != "x" ] ; do
     fi
   done
 
+  dtb=
+  for i in "dtb-${version}" "dtb-${alt_version}" "dtb"; do
+    if test -e "${dirname}/${i}" ; then
+      dtb="$i"
+      break
+    fi
+  done
+
   config=
   for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
     if test -e "${i}" ; then
-- 
2.20.1



More information about the Pkg-grub-devel mailing list