1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2011 The Chromium OS Authors.
12 #define LINUX_ARM_ZIMAGE_MAGIC 0x016f2818
19 } __attribute__ ((__packed__));
21 int bootz_setup(ulong image, ulong *start, ulong *end)
23 uint8_t *zimage = map_sysmem(image, 0);
24 struct arm_z_header *arm_hdr = (struct arm_z_header *)zimage;
27 if (memcmp(zimage + 0x202, "HdrS", 4) == 0) {
28 uint8_t setup_sects = *(zimage + 0x1f1);
30 le32_to_cpu(*(uint32_t *)(zimage + 0x1f4));
33 *end = (setup_sects + 1) * 512 + syssize * 16;
35 printf("setting up X86 zImage [ %ld - %ld ]\n",
37 } else if (le32_to_cpu(arm_hdr->zi_magic) == LINUX_ARM_ZIMAGE_MAGIC) {
38 *start = le32_to_cpu(arm_hdr->zi_start);
39 *end = le32_to_cpu(arm_hdr->zi_end);
41 printf("setting up ARM zImage [ %ld - %ld ]\n",
44 printf("Unrecognized zImage\n");
48 unmap_sysmem((void *)image);
53 int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
55 if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
56 bootstage_mark(BOOTSTAGE_ID_RUN_OS);
57 printf("## Transferring control to Linux (at address %08lx)...\n",
59 printf("sandbox: continuing, as we cannot run Linux\n");