1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2000-2009
13 #include <linux/compiler.h>
15 int __weak bootz_setup(ulong image, ulong *start, ulong *end)
17 /* Please define bootz_setup() for your platform */
19 puts("Your platform's zImage format isn't supported yet!\n");
24 * zImage booting support
26 static int bootz_start(struct cmd_tbl *cmdtp, int flag, int argc,
27 char *const argv[], struct bootm_headers *images)
29 ulong zi_start, zi_end;
30 struct bootm_info bmi;
35 bmi.addr_img = argv[0];
37 bmi.conf_ramdisk = argv[1];
39 bmi.conf_fdt = argv[2];
40 /* do not set up argc and argv[] since nothing uses them */
42 ret = bootm_run_states(&bmi, BOOTM_STATE_START);
44 /* Setup Linux kernel zImage entry point */
46 images->ep = image_load_addr;
47 debug("* kernel: default image load address = 0x%08lx\n",
50 images->ep = hextoul(argv[0], NULL);
51 debug("* kernel: cmdline image address = 0x%08lx\n",
55 ret = bootz_setup(images->ep, &zi_start, &zi_end);
59 lmb_reserve(images->ep, zi_end - zi_start, LMB_NONE);
62 * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
63 * have a header that provide this informaiton.
65 if (bootm_find_images(image_load_addr, cmd_arg1(argc, argv),
66 cmd_arg2(argc, argv), images->ep,
73 int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
75 struct bootm_info bmi;
81 if (bootz_start(cmdtp, flag, argc, argv, &images))
85 * We are doing the BOOTM_STATE_LOADOS state ourselves, so must
86 * disable interrupts ourselves
88 bootm_disable_interrupts();
90 images.os.os = IH_OS_LINUX;
94 bmi.addr_img = argv[0];
96 bmi.conf_ramdisk = argv[1];
98 bmi.conf_fdt = argv[2];
99 bmi.cmd_name = "bootz";
101 ret = bootz_run(&bmi);
106 U_BOOT_LONGHELP(bootz,
107 "[addr [initrd[:size]] [fdt]]\n"
108 " - boot Linux zImage stored in memory\n"
109 "\tThe argument 'initrd' is optional and specifies the address\n"
110 "\tof the initrd in memory. The optional argument ':size' allows\n"
111 "\tspecifying the size of RAW initrd.\n"
112 #if defined(CONFIG_OF_LIBFDT)
113 "\tWhen booting a Linux kernel which requires a flat device-tree\n"
114 "\ta third argument is required which is the address of the\n"
115 "\tdevice-tree blob. To boot that kernel without an initrd image,\n"
116 "\tuse a '-' for the second argument. If you do not pass a third\n"
117 "\ta bd_info struct will be passed instead\n"
122 bootz, CONFIG_SYS_MAXARGS, 1, do_bootz,
123 "boot Linux zImage image from memory", bootz_help_text