nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0022-Add-devicetree-loading.patch

5593c8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
5593c8
From: Peter Jones <pjones@redhat.com>
5593c8
Date: Tue, 14 Jan 2014 13:12:23 -0500
5593c8
Subject: [PATCH] Add devicetree loading
5593c8
5593c8
Signed-off-by: Peter Jones <pjones@redhat.com>
5593c8
5593c8
Switch to use APM Mustang device tree, for hardware testing.
5593c8
5593c8
Signed-off-by: David A. Marlin <d.marlin@redhat.com>
5593c8
5593c8
Use the default device tree from the grub default file
5593c8
5593c8
instead of hardcoding a value.
5593c8
5593c8
Signed-off-by: David A. Marlin <dmarlin@redhat.com>
5593c8
---
5593c8
 util/grub-mkconfig.in   |  3 ++-
5593c8
 util/grub.d/10_linux.in | 15 +++++++++++++++
5593c8
 2 files changed, 17 insertions(+), 1 deletion(-)
5593c8
5593c8
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
1c6ba0
index d3e879b8e5..8ea2315ebc 100644
5593c8
--- a/util/grub-mkconfig.in
5593c8
+++ b/util/grub-mkconfig.in
5593c8
@@ -248,7 +248,8 @@ export GRUB_DEFAULT \
5593c8
   GRUB_ENABLE_CRYPTODISK \
5593c8
   GRUB_BADRAM \
5593c8
   GRUB_OS_PROBER_SKIP_LIST \
5593c8
-  GRUB_DISABLE_SUBMENU
5593c8
+  GRUB_DISABLE_SUBMENU \
5593c8
+  GRUB_DEFAULT_DTB
5593c8
 
5593c8
 if test "x${grub_cfg}" != "x"; then
5593c8
   rm -f "${grub_cfg}.new"
5593c8
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
1c6ba0
index e8b01c0d0c..dc75a1c30b 100644
5593c8
--- a/util/grub.d/10_linux.in
5593c8
+++ b/util/grub.d/10_linux.in
5593c8
@@ -153,6 +153,13 @@ EOF
5593c8
     sed "s/^/$submenu_indentation/" << EOF
5593c8
 	echo	'$(echo "$message" | grub_quote)'
5593c8
 	initrd	$(echo $initrd_path)
5593c8
+EOF
5593c8
+  fi
5593c8
+  if test -n "${fdt}" ; then
5593c8
+    message="$(gettext_printf "Loading fdt ...")"
5593c8
+    sed "s/^/$submenu_indentation/" << EOF
5593c8
+	echo	'$(echo "$message" | grub_quote)'
5593c8
+	devicetree	${rel_dirname}/${fdt}
5593c8
 EOF
5593c8
   fi
5593c8
   sed "s/^/$submenu_indentation/" << EOF
5593c8
@@ -236,6 +243,14 @@ while [ "x$list" != "x" ] ; do
5593c8
     gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
5593c8
   fi
5593c8
 
5593c8
+  fdt=
5593c8
+  for i in "dtb-${version}" "dtb-${alt_version}"; do
5593c8
+    if test -f "${dirname}/${i}/${GRUB_DEFAULT_DTB}" ; then
5593c8
+      fdt="${i}/${GRUB_DEFAULT_DTB}"
5593c8
+      break
5593c8
+    fi
5593c8
+  done
5593c8
+
5593c8
   config=
5593c8
   for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
5593c8
     if test -e "${i}" ; then