dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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