2 * (C) Copyright 2000-2009
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
12 #include <linux/compiler.h>
14 int __weak bootz_setup(ulong image, ulong *start, ulong *end)
16 /* Please define bootz_setup() for your platform */
18 puts("Your platform's zImage format isn't supported yet!\n");
23 * zImage booting support
25 static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
26 char * const argv[], bootm_headers_t *images)
29 ulong zi_start, zi_end;
31 ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
34 /* Setup Linux kernel zImage entry point */
36 images->ep = load_addr;
37 debug("* kernel: default image load address = 0x%08lx\n",
40 images->ep = simple_strtoul(argv[0], NULL, 16);
41 debug("* kernel: cmdline image address = 0x%08lx\n",
45 ret = bootz_setup(images->ep, &zi_start, &zi_end);
49 lmb_reserve(&images->lmb, images->ep, zi_end - zi_start);
52 * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
53 * have a header that provide this informaiton.
55 if (bootm_find_images(flag, argc, argv))
61 int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
68 if (bootz_start(cmdtp, flag, argc, argv, &images))
72 * We are doing the BOOTM_STATE_LOADOS state ourselves, so must
73 * disable interrupts ourselves
75 bootm_disable_interrupts();
77 images.os.os = IH_OS_LINUX;
78 ret = do_bootm_states(cmdtp, flag, argc, argv,
79 BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
86 #ifdef CONFIG_SYS_LONGHELP
87 static char bootz_help_text[] =
88 "[addr [initrd[:size]] [fdt]]\n"
89 " - boot Linux zImage stored in memory\n"
90 "\tThe argument 'initrd' is optional and specifies the address\n"
91 "\tof the initrd in memory. The optional argument ':size' allows\n"
92 "\tspecifying the size of RAW initrd.\n"
93 #if defined(CONFIG_OF_LIBFDT)
94 "\tWhen booting a Linux kernel which requires a flat device-tree\n"
95 "\ta third argument is required which is the address of the\n"
96 "\tdevice-tree blob. To boot that kernel without an initrd image,\n"
97 "\tuse a '-' for the second argument. If you do not pass a third\n"
98 "\ta bd_info struct will be passed instead\n"
104 bootz, CONFIG_SYS_MAXARGS, 1, do_bootz,
105 "boot Linux zImage image from memory", bootz_help_text