nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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