xref: /openbmc/u-boot/arch/arm/lib/zimage.c (revision 63e22517)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2016
4  * Ladislav Michl <ladis@linux-mips.org>
5  *
6  * bootz code:
7  * Copyright (C) 2012 Marek Vasut <marek.vasut@gmail.com>
8  */
9 #include <common.h>
10 
11 #define	LINUX_ARM_ZIMAGE_MAGIC	0x016f2818
12 
13 struct arm_z_header {
14 	uint32_t	code[9];
15 	uint32_t	zi_magic;
16 	uint32_t	zi_start;
17 	uint32_t	zi_end;
18 } __attribute__ ((__packed__));
19 
20 int bootz_setup(ulong image, ulong *start, ulong *end)
21 {
22 	struct arm_z_header *zi = (struct arm_z_header *)image;
23 
24 	if (zi->zi_magic != LINUX_ARM_ZIMAGE_MAGIC) {
25 #ifndef CONFIG_SPL_FRAMEWORK
26 		puts("Bad Linux ARM zImage magic!\n");
27 #endif
28 		return 1;
29 	}
30 
31 	*start = zi->zi_start;
32 	*end = zi->zi_end;
33 #ifndef CONFIG_SPL_FRAMEWORK
34 	printf("Kernel image @ %#08lx [ %#08lx - %#08lx ]\n",
35 	       image, *start, *end);
36 #endif
37 
38 	return 0;
39 }
40