blob: 09ab331ee09c31d47c502f46791b0cd4bfd5915e [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Ladislav Michl9c743722016-07-12 20:28:14 +02002/*
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>
Ladislav Michl9c743722016-07-12 20:28:14 +02008 */
9#include <common.h>
10
11#define LINUX_ARM_ZIMAGE_MAGIC 0x016f2818
12
13struct 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
20int 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}