]> Git Repo - J-u-boot.git/blame - cmd/bootz.c
Merge tag 'efi-2025-01-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
[J-u-boot.git] / cmd / bootz.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
5db28905
TR
2/*
3 * (C) Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, [email protected].
5db28905
TR
5 */
6
5db28905
TR
7#include <bootm.h>
8#include <command.h>
8e8ccfe1 9#include <image.h>
36bf446b 10#include <irq_func.h>
5db28905 11#include <lmb.h>
f7ae49fc 12#include <log.h>
5db28905
TR
13#include <linux/compiler.h>
14
15int __weak bootz_setup(ulong image, ulong *start, ulong *end)
16{
17 /* Please define bootz_setup() for your platform */
18
19 puts("Your platform's zImage format isn't supported yet!\n");
20 return -1;
21}
22
23/*
24 * zImage booting support
25 */
09140113 26static int bootz_start(struct cmd_tbl *cmdtp, int flag, int argc,
d9d7c20b 27 char *const argv[], struct bootm_headers *images)
5db28905 28{
5db28905 29 ulong zi_start, zi_end;
a6c49161
SG
30 struct bootm_info bmi;
31 int ret;
5db28905 32
a6c49161
SG
33 bootm_init(&bmi);
34 if (argc)
35 bmi.addr_img = argv[0];
36 if (argc > 1)
37 bmi.conf_ramdisk = argv[1];
38 if (argc > 2)
39 bmi.conf_fdt = argv[2];
40 /* do not set up argc and argv[] since nothing uses them */
41
b5d397f4 42 ret = bootm_run_states(&bmi, BOOTM_STATE_START);
5db28905
TR
43
44 /* Setup Linux kernel zImage entry point */
45 if (!argc) {
bb872dd9 46 images->ep = image_load_addr;
5db28905 47 debug("* kernel: default image load address = 0x%08lx\n",
bb872dd9 48 image_load_addr);
5db28905 49 } else {
7e5f460e 50 images->ep = hextoul(argv[0], NULL);
5db28905
TR
51 debug("* kernel: cmdline image address = 0x%08lx\n",
52 images->ep);
53 }
54
55 ret = bootz_setup(images->ep, &zi_start, &zi_end);
56 if (ret != 0)
57 return 1;
58
ed17a33f 59 lmb_reserve(images->ep, zi_end - zi_start);
5db28905
TR
60
61 /*
62 * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
63 * have a header that provide this informaiton.
64 */
8632b36b
SG
65 if (bootm_find_images(image_load_addr, cmd_arg1(argc, argv),
66 cmd_arg2(argc, argv), images->ep,
3ac85bdc 67 zi_end - zi_start))
5db28905
TR
68 return 1;
69
70 return 0;
71}
72
09140113 73int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
5db28905 74{
a6c49161 75 struct bootm_info bmi;
3405c9b6 76 int ret;
5db28905
TR
77
78 /* Consume 'bootz' */
79 argc--; argv++;
80
81 if (bootz_start(cmdtp, flag, argc, argv, &images))
82 return 1;
83
84 /*
85 * We are doing the BOOTM_STATE_LOADOS state ourselves, so must
86 * disable interrupts ourselves
87 */
88 bootm_disable_interrupts();
89
90 images.os.os = IH_OS_LINUX;
31fda96b 91
a6c49161
SG
92 bootm_init(&bmi);
93 if (argc)
94 bmi.addr_img = argv[0];
95 if (argc > 1)
96 bmi.conf_ramdisk = argv[1];
97 if (argc > 2)
98 bmi.conf_fdt = argv[2];
99 bmi.cmd_name = "bootz";
100
3405c9b6 101 ret = bootz_run(&bmi);
5db28905
TR
102
103 return ret;
104}
105
3616218b 106U_BOOT_LONGHELP(bootz,
5db28905
TR
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"
118#endif
3616218b 119 );
5db28905
TR
120
121U_BOOT_CMD(
122 bootz, CONFIG_SYS_MAXARGS, 1, do_bootz,
123 "boot Linux zImage image from memory", bootz_help_text
124);
This page took 0.273814 seconds and 4 git commands to generate.