1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
13 #include <linux/kernel.h>
14 #include <linux/sizes.h>
17 * Image booting support
19 static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
20 char * const argv[], bootm_headers_t *images)
27 ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
30 /* Setup Linux kernel Image entry point */
33 debug("* kernel: default image load address = 0x%08lx\n",
36 ld = simple_strtoul(argv[0], NULL, 16);
37 debug("* kernel: cmdline image address = 0x%08lx\n", ld);
40 ret = booti_setup(ld, &relocated_addr, &image_size, false);
44 /* Handle BOOTM_STATE_LOADOS */
45 if (relocated_addr != ld) {
46 debug("Moving Image from 0x%lx to 0x%lx\n", ld, relocated_addr);
47 memmove((void *)relocated_addr, (void *)ld, image_size);
50 images->ep = relocated_addr;
51 lmb_reserve(&images->lmb, images->ep, le32_to_cpu(image_size));
54 * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
55 * have a header that provide this informaiton.
57 if (bootm_find_images(flag, argc, argv))
63 int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
70 if (booti_start(cmdtp, flag, argc, argv, &images))
74 * We are doing the BOOTM_STATE_LOADOS state ourselves, so must
75 * disable interrupts ourselves
77 bootm_disable_interrupts();
79 images.os.os = IH_OS_LINUX;
80 images.os.arch = IH_ARCH_ARM64;
81 ret = do_bootm_states(cmdtp, flag, argc, argv,
82 #ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
85 BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
92 #ifdef CONFIG_SYS_LONGHELP
93 static char booti_help_text[] =
94 "[addr [initrd[:size]] [fdt]]\n"
95 " - boot arm64 Linux Image stored in memory\n"
96 "\tThe argument 'initrd' is optional and specifies the address\n"
97 "\tof an initrd in memory. The optional parameter ':size' allows\n"
98 "\tspecifying the size of a RAW initrd.\n"
99 #if defined(CONFIG_OF_LIBFDT)
100 "\tSince booting a Linux kernel requires a flat device-tree, a\n"
101 "\tthird argument providing the address of the device-tree blob\n"
102 "\tis required. To boot a kernel with a device-tree blob but\n"
103 "\twithout an initrd image, use a '-' for the initrd argument.\n"
109 booti, CONFIG_SYS_MAXARGS, 1, do_booti,
110 "boot arm64 Linux Image image from memory", booti_help_text