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