3 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4 * Marius Groeger <mgroeger@sysgo.de>
6 * Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
8 * SPDX-License-Identifier: GPL-2.0+
14 #include <u-boot/zlib.h>
15 #include <asm/bootparam.h>
16 #include <asm/byteorder.h>
17 #include <asm/zimage.h>
19 #define COMMAND_LINE_OFFSET 0x9000
22 int do_bootm_linux(int flag, int argc, char * const argv[],
23 bootm_headers_t *images)
25 struct boot_params *base_ptr = NULL;
26 ulong os_data, os_len;
30 #if defined(CONFIG_FIT)
35 if (flag & BOOTM_STATE_OS_PREP)
37 if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
40 if (images->legacy_hdr_valid) {
41 hdr = images->legacy_hdr_os;
42 if (image_check_type(hdr, IH_TYPE_MULTI)) {
43 /* if multi-part image, we need to get first subimage */
44 image_multi_getimg(hdr, 0, &os_data, &os_len);
46 /* otherwise get image data */
47 os_data = image_get_data(hdr);
48 os_len = image_get_data_size(hdr);
50 #if defined(CONFIG_FIT)
51 } else if (images->fit_uname_os) {
54 ret = fit_image_get_data(images->fit_hdr_os,
55 images->fit_noffset_os, &data, &len);
57 puts("Can't get image data/size!\n");
60 os_data = (ulong)data;
64 puts("Could not find kernel image!\n");
68 #ifdef CONFIG_CMD_ZBOOT
69 base_ptr = load_zimage((void *)os_data, os_len, &load_address);
72 if (NULL == base_ptr) {
73 printf("## Kernel loading failed ...\n");
77 if (setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET,
79 images->rd_end - images->rd_start)) {
80 printf("## Setting up boot parameters failed ...\n");
84 boot_zimage(base_ptr, load_address);