[PATCH v3 2/2] kexec: pass initrd position by dtb

Wang Nan wangnan0 at huawei.com
Thu Mar 20 03:33:57 EDT 2014


This patch append the position of initrd to dtb when loading arm kernel
and initrd without using atag.

Signed-off-by: Wang Nan <wangnan0 at huawei.com>
Cc: Simon Horman <horms at verge.net.au>
Cc: Dave Young <dyoung at redhat.com>
Cc: Geng Hui <hui.geng at huawei.com>
---
 kexec/arch/arm/kexec-zImage-arm.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c
index 977254e..886a718 100644
--- a/kexec/arch/arm/kexec-zImage-arm.c
+++ b/kexec/arch/arm/kexec-zImage-arm.c
@@ -461,6 +461,19 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
 		if (ramdisk) {
 			add_segment(info, ramdisk_buf, initrd_size,
 			            initrd_base, initrd_size);
+
+			unsigned long start, end;
+			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",
+					"linux,initrd-start", &start,
+					sizeof(start)))
+				return -1;
+			if (setup_dtb_prop(&dtb_buf, &dtb_length, "/chosen",
+					"linux,initrd-end", &end,
+					sizeof(end)))
+				return -1;
 		}
 
 		/* Stick the dtb at the end of the initrd and page
-- 
1.8.3.4




More information about the kexec mailing list