[PATCH 4/4] ARM: zynq: add Zynq image bootm handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This adds a bootm handler for the Zynq image, to allow second
stage booting of a unchanged Zynq boot image.

Signed-off-by: Lucas Stach <dev@xxxxxxxxxx>
---
 arch/arm/mach-zynq/Makefile        |  2 +-
 arch/arm/mach-zynq/bootm-zynqimg.c | 49 ++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-zynq/bootm-zynqimg.c

diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile
index 3252247d176d..c88ab4666f0f 100644
--- a/arch/arm/mach-zynq/Makefile
+++ b/arch/arm/mach-zynq/Makefile
@@ -1 +1 @@
-obj-y += zynq.o
+obj-y += zynq.o bootm-zynqimg.o
diff --git a/arch/arm/mach-zynq/bootm-zynqimg.c b/arch/arm/mach-zynq/bootm-zynqimg.c
new file mode 100644
index 000000000000..e903ab667905
--- /dev/null
+++ b/arch/arm/mach-zynq/bootm-zynqimg.c
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <bootm.h>
+#include <common.h>
+#include <init.h>
+#include <memory.h>
+
+static int do_bootm_zynqimage(struct image_data *data)
+{
+	resource_size_t start, end;
+	void (*barebox)(void);
+	u32 *header;
+	int ret;
+
+	ret = memory_bank_first_find_space(&start, &end);
+	if (ret)
+		return ret;
+
+	ret = bootm_load_os(data, start);
+	if (ret)
+		return ret;
+
+	header = (u32*)start;
+	barebox = (void*)start + header[12];
+
+	if (data->verbose)
+		printf("Loaded barebox image to 0x%08lx\n",
+		       (unsigned long)barebox);
+
+	shutdown_barebox();
+
+	barebox();
+
+	return -EIO;
+}
+
+static struct image_handler zynq_image_handler = {
+	.name = "Zynq image",
+	.bootm = do_bootm_zynqimage,
+	.filetype = filetype_zynq_image,
+};
+
+static int zynq_register_image_handler(void)
+{
+	register_image_handler(&zynq_image_handler);
+
+	return 0;
+}
+late_initcall(zynq_register_image_handler);
-- 
2.23.0


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



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux