All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] arm: properly handle a missing /chosen node in the DT
@ 2016-03-31 15:30 Alban Bedel
  2016-03-31 15:30 ` [PATCH 2/3] zImage-arm: Fix a return value check that use the wrong variable Alban Bedel
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alban Bedel @ 2016-03-31 15:30 UTC (permalink / raw)
  To: kexec; +Cc: Nikolaus Schulz, horms, Alban Bedel

From: Nikolaus Schulz <nikolaus.schulz@avionic-design.de>

When adding a new node to the DT in the setup_dtb_prop function, the
parent offset need be passed to fdt_add_subnode.  Currently a bogus
error code is used.  Fix that by adding the parent offset as an extra
function argument to setup_dtb_prop, and change the handling of the
/chosen node to operate on a relative path plus (zero) offset instead of
an absolute path.

Signed-off-by: Nikolaus Schulz <nikolaus.schulz@avionic-design.de>
---
 kexec/arch/arm/kexec-zImage-arm.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c
index d85ab9b..78518fd 100644
--- a/kexec/arch/arm/kexec-zImage-arm.c
+++ b/kexec/arch/arm/kexec-zImage-arm.c
@@ -257,8 +257,9 @@ int atag_arm_load(struct kexec_info *info, unsigned long base,
 	return 0;
 }
 
-static int setup_dtb_prop(char **bufp, off_t *sizep, const char *node_name,
-		const char *prop_name, const void *val, int len)
+static int setup_dtb_prop(char **bufp, off_t *sizep, int parentoffset,
+		const char *node_name, const char *prop_name,
+		const void *val, int len)
 {
 	char *dtb_buf;
 	off_t dtb_size;
@@ -273,14 +274,14 @@ static int setup_dtb_prop(char **bufp, off_t *sizep, const char *node_name,
 	dtb_size = *sizep;
 
 	/* check if the subnode has already exist */
-	off = fdt_path_offset(dtb_buf, node_name);
+	off = fdt_subnode_offset(dtb_buf, parentoffset, node_name);
 	if (off == -FDT_ERR_NOTFOUND) {
 		dtb_size += fdt_node_len(node_name);
 		fdt_set_totalsize(dtb_buf, dtb_size);
 		dtb_buf = xrealloc(dtb_buf, dtb_size);
 		if (dtb_buf == NULL)
 			die("xrealloc failed\n");
-		off = fdt_add_subnode(dtb_buf, off, node_name);
+		off = fdt_add_subnode(dtb_buf, parentoffset, node_name);
 	}
 
 	if (off < 0) {
@@ -496,7 +497,7 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
 				 *  Error should have been reported so
 				 *  directly return -1
 				 */
-				if (setup_dtb_prop(&dtb_buf, &dtb_length, "/chosen",
+				if (setup_dtb_prop(&dtb_buf, &dtb_length, 0, "chosen",
 						"bootargs", command_line,
 						strlen(command_line) + 1))
 					return -1;
@@ -542,11 +543,11 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
 			start = cpu_to_be32((unsigned long)(initrd_base));
 			end = cpu_to_be32((unsigned long)(initrd_base + initrd_size));
 
-			if (setup_dtb_prop(&dtb_buf, &dtb_length, "/chosen",
+			if (setup_dtb_prop(&dtb_buf, &dtb_length, 0, "chosen",
 					"linux,initrd-start", &start,
 					sizeof(start)))
 				return -1;
-			if (setup_dtb_prop(&dtb_buf, &dtb_length, "/chosen",
+			if (setup_dtb_prop(&dtb_buf, &dtb_length, 0, "chosen",
 					"linux,initrd-end", &end,
 					sizeof(end)))
 				return -1;
-- 
2.8.0


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-06  0:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31 15:30 [PATCH 1/3] arm: properly handle a missing /chosen node in the DT Alban Bedel
2016-03-31 15:30 ` [PATCH 2/3] zImage-arm: Fix a return value check that use the wrong variable Alban Bedel
2016-03-31 15:31 ` [PATCH 3/3] zImage-arm: Add support for booting android images Alban Bedel
2016-04-05  6:33 ` [PATCH 1/3] arm: properly handle a missing /chosen node in the DT Simon Horman
2016-04-05  9:34   ` Nikolaus Schulz
2016-04-05  9:37     ` Nikolaus Schulz
2016-04-06  0:30     ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.