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

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