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

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