Blame SOURCES/0084-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Mark Salter <msalter@redhat.com>
d9d99f
Date: Mon, 17 Apr 2017 08:44:29 -0400
d9d99f
Subject: [PATCH] arm64: make sure fdt has #address-cells and #size-cells
d9d99f
 properties
d9d99f
d9d99f
Recent upstream changes to kexec-tools relies on #address-cells
d9d99f
and #size-cells properties in the FDT. If grub2 needs to create
d9d99f
a chosen node, it is likely because firmware did not provide one.
d9d99f
In that case, set #address-cells and #size-cells properties to
d9d99f
make sure they exist.
d9d99f
---
d9d99f
 grub-core/loader/arm64/linux.c | 16 +++++++++++++++-
d9d99f
 1 file changed, 15 insertions(+), 1 deletion(-)
d9d99f
d9d99f
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
d9d99f
index a1ac7a38867..93b5cd306eb 100644
d9d99f
--- a/grub-core/loader/arm64/linux.c
d9d99f
+++ b/grub-core/loader/arm64/linux.c
d9d99f
@@ -80,7 +80,21 @@ finalize_params_linux (void)
d9d99f
 
d9d99f
   node = grub_fdt_find_subnode (fdt, 0, "chosen");
d9d99f
   if (node < 0)
d9d99f
-    node = grub_fdt_add_subnode (fdt, 0, "chosen");
d9d99f
+    {
d9d99f
+      /*
d9d99f
+       * If we have to create a chosen node, Make sure we
d9d99f
+       * have #address-cells and #size-cells properties.
d9d99f
+       */
d9d99f
+      retval = grub_fdt_set_prop32(fdt, 0, "#address-cells", 2);
d9d99f
+      if (retval)
d9d99f
+	goto failure;
d9d99f
+
d9d99f
+      retval = grub_fdt_set_prop32(fdt, 0, "#size-cells", 2);
d9d99f
+      if (retval)
d9d99f
+	goto failure;
d9d99f
+
d9d99f
+      node = grub_fdt_add_subnode (fdt, 0, "chosen");
d9d99f
+    }
d9d99f
 
d9d99f
   if (node < 1)
d9d99f
     goto failure;