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

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