blob: a41e1ccf8a65ad47fdad6802941d0172a2d41390 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenk591dda52002-11-18 00:14:45 +00002/*
Gabe Black1cf51212011-12-05 12:09:23 +00003 * Copyright (c) 2011 The Chromium OS Authors.
wdenk591dda52002-11-18 00:14:45 +00004 * (C) Copyright 2002
Albert ARIBAUD60fbc8d2011-08-04 18:45:45 +02005 * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
wdenk591dda52002-11-18 00:14:45 +00006 */
7
wdenk57b2d802003-06-27 21:31:46 +00008/*
Graeme Russ45fc1d82011-04-13 19:43:26 +10009 * Linux x86 zImage and bzImage loading
wdenk57b2d802003-06-27 21:31:46 +000010 *
11 * based on the procdure described in
wdenk591dda52002-11-18 00:14:45 +000012 * linux/Documentation/i386/boot.txt
13 */
14
Simon Glass842ff442020-11-04 09:59:13 -070015#define LOG_CATEGORY LOGC_BOOT
16
wdenk591dda52002-11-18 00:14:45 +000017#include <common.h>
Simon Glass7b48ce82020-11-05 10:33:46 -070018#include <bootm.h>
Simon Glassed38aef2020-05-10 11:40:03 -060019#include <command.h>
Simon Glass83c2e492019-08-01 09:46:50 -060020#include <env.h>
Simon Glass02c51202021-03-15 18:00:23 +130021#include <init.h>
Simon Glass8f3f7612019-11-14 12:57:42 -070022#include <irq_func.h>
Simon Glass842ff442020-11-04 09:59:13 -070023#include <log.h>
Ivan Gorinov901bb0b2018-03-26 18:06:54 -070024#include <malloc.h>
Simon Glass84305a12023-07-12 09:04:43 -060025#include <mapmem.h>
Simon Glass858fed12020-04-08 16:57:36 -060026#include <acpi/acpi_table.h>
wdenk591dda52002-11-18 00:14:45 +000027#include <asm/io.h>
28#include <asm/ptrace.h>
29#include <asm/zimage.h>
wdenk591dda52002-11-18 00:14:45 +000030#include <asm/byteorder.h>
Simon Glassaa83f2b2014-10-19 21:11:20 -060031#include <asm/bootm.h>
Graeme Russ1bab1042010-04-24 00:05:49 +100032#include <asm/bootparam.h>
Simon Glassb73d48f2021-09-24 18:30:20 -060033#include <asm/efi.h>
Simon Glass02c51202021-03-15 18:00:23 +130034#include <asm/global_data.h>
Vadim Bendebury8cd22c82012-10-23 18:04:34 +000035#ifdef CONFIG_SYS_COREBOOT
36#include <asm/arch/timestamp.h>
37#endif
Stefan Reinauer2e5225e2012-10-23 18:04:37 +000038#include <linux/compiler.h>
Simon Glass8ee28542020-11-04 09:59:14 -070039#include <linux/ctype.h>
Ivan Gorinov901bb0b2018-03-26 18:06:54 -070040#include <linux/libfdt.h>
wdenk591dda52002-11-18 00:14:45 +000041
Simon Glass02c51202021-03-15 18:00:23 +130042DECLARE_GLOBAL_DATA_PTR;
43
wdenk591dda52002-11-18 00:14:45 +000044/*
45 * Memory lay-out:
wdenk57b2d802003-06-27 21:31:46 +000046 *
wdenk591dda52002-11-18 00:14:45 +000047 * relative to setup_base (which is 0x90000 currently)
wdenk57b2d802003-06-27 21:31:46 +000048 *
49 * 0x0000-0x7FFF Real mode kernel
wdenk591dda52002-11-18 00:14:45 +000050 * 0x8000-0x8FFF Stack and heap
51 * 0x9000-0x90FF Kernel command line
52 */
Graeme Russ883c6032011-11-08 02:33:15 +000053#define DEFAULT_SETUP_BASE 0x90000
54#define COMMAND_LINE_OFFSET 0x9000
55#define HEAP_END_OFFSET 0x8e00
wdenk591dda52002-11-18 00:14:45 +000056
Graeme Russ883c6032011-11-08 02:33:15 +000057#define COMMAND_LINE_SIZE 2048
wdenk591dda52002-11-18 00:14:45 +000058
Simon Glass48800f42020-09-05 14:50:38 -060059/**
60 * struct zboot_state - Current state of the boot
61 *
62 * @bzimage_addr: Address of the bzImage to boot
63 * @bzimage_size: Size of the bzImage, or 0 to detect this
64 * @initrd_addr: Address of the initial ramdisk, or 0 if none
65 * @initrd_size: Size of the initial ramdisk, or 0 if none
66 * @load_address: Address where the bzImage is moved before booting, either
67 * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR
Simon Glass1931b192020-09-05 14:50:44 -060068 * @base_ptr: Pointer to the boot parameters, typically at address
69 * DEFAULT_SETUP_BASE
Simon Glass5e956d12020-11-09 07:12:24 -070070 * @cmdline: Environment variable containing the 'override' command line, or
71 * NULL to use the one in the setup block
Simon Glass48800f42020-09-05 14:50:38 -060072 */
73struct zboot_state {
74 ulong bzimage_addr;
75 ulong bzimage_size;
76 ulong initrd_addr;
77 ulong initrd_size;
78 ulong load_address;
Simon Glass1931b192020-09-05 14:50:44 -060079 struct boot_params *base_ptr;
Simon Glass5e956d12020-11-09 07:12:24 -070080 char *cmdline;
Simon Glass48800f42020-09-05 14:50:38 -060081} state;
82
Simon Glassd9b3c982020-09-05 14:50:43 -060083enum {
84 ZBOOT_STATE_START = BIT(0),
Simon Glass24d26f72020-09-05 14:50:46 -060085 ZBOOT_STATE_LOAD = BIT(1),
Simon Glass30634832020-09-05 14:50:47 -060086 ZBOOT_STATE_SETUP = BIT(2),
87 ZBOOT_STATE_INFO = BIT(3),
88 ZBOOT_STATE_GO = BIT(4),
Simon Glassd9b3c982020-09-05 14:50:43 -060089
Simon Glassaad0d762020-09-05 14:50:50 -060090 /* This one doesn't execute automatically, so stop the count before 5 */
91 ZBOOT_STATE_DUMP = BIT(5),
Simon Glass30634832020-09-05 14:50:47 -060092 ZBOOT_STATE_COUNT = 5,
Simon Glassd9b3c982020-09-05 14:50:43 -060093};
94
wdenk591dda52002-11-18 00:14:45 +000095static void build_command_line(char *command_line, int auto_boot)
96{
97 char *env_command_line;
wdenk57b2d802003-06-27 21:31:46 +000098
wdenk591dda52002-11-18 00:14:45 +000099 command_line[0] = '\0';
wdenk57b2d802003-06-27 21:31:46 +0000100
Simon Glass64b723f2017-08-03 12:22:12 -0600101 env_command_line = env_get("bootargs");
wdenk57b2d802003-06-27 21:31:46 +0000102
wdenk591dda52002-11-18 00:14:45 +0000103 /* set console= argument if we use a serial console */
Graeme Russ883c6032011-11-08 02:33:15 +0000104 if (!strstr(env_command_line, "console=")) {
Simon Glass64b723f2017-08-03 12:22:12 -0600105 if (!strcmp(env_get("stdout"), "serial")) {
wdenk57b2d802003-06-27 21:31:46 +0000106
wdenk591dda52002-11-18 00:14:45 +0000107 /* We seem to use serial console */
wdenk57b2d802003-06-27 21:31:46 +0000108 sprintf(command_line, "console=ttyS0,%s ",
Simon Glass64b723f2017-08-03 12:22:12 -0600109 env_get("baudrate"));
wdenk591dda52002-11-18 00:14:45 +0000110 }
111 }
wdenk57b2d802003-06-27 21:31:46 +0000112
Graeme Russ883c6032011-11-08 02:33:15 +0000113 if (auto_boot)
wdenk591dda52002-11-18 00:14:45 +0000114 strcat(command_line, "auto ");
wdenk57b2d802003-06-27 21:31:46 +0000115
Graeme Russ883c6032011-11-08 02:33:15 +0000116 if (env_command_line)
wdenk591dda52002-11-18 00:14:45 +0000117 strcat(command_line, env_command_line);
Simon Glasseeb01222021-01-24 10:06:09 -0700118#ifdef DEBUG
119 printf("Kernel command line:");
120 puts(command_line);
121 printf("\n");
122#endif
wdenk591dda52002-11-18 00:14:45 +0000123}
124
Gabe Black540c2622011-12-05 12:09:26 +0000125static int kernel_magic_ok(struct setup_header *hdr)
wdenk591dda52002-11-18 00:14:45 +0000126{
Graeme Russ1bab1042010-04-24 00:05:49 +1000127 if (KERNEL_MAGIC != hdr->boot_flag) {
Gabe Black1cf51212011-12-05 12:09:23 +0000128 printf("Error: Invalid Boot Flag "
129 "(found 0x%04x, expected 0x%04x)\n",
130 hdr->boot_flag, KERNEL_MAGIC);
wdenk591dda52002-11-18 00:14:45 +0000131 return 0;
Graeme Russ1bab1042010-04-24 00:05:49 +1000132 } else {
133 printf("Valid Boot Flag\n");
Gabe Black540c2622011-12-05 12:09:26 +0000134 return 1;
wdenk591dda52002-11-18 00:14:45 +0000135 }
Gabe Black540c2622011-12-05 12:09:26 +0000136}
wdenk57b2d802003-06-27 21:31:46 +0000137
Simon Glassdf30d412020-09-05 14:50:40 -0600138static int get_boot_protocol(struct setup_header *hdr, bool verbose)
Gabe Black540c2622011-12-05 12:09:26 +0000139{
140 if (hdr->header == KERNEL_V2_MAGIC) {
Simon Glassdf30d412020-09-05 14:50:40 -0600141 if (verbose)
142 printf("Magic signature found\n");
Gabe Black540c2622011-12-05 12:09:26 +0000143 return hdr->version;
wdenk591dda52002-11-18 00:14:45 +0000144 } else {
145 /* Very old kernel */
Simon Glassdf30d412020-09-05 14:50:40 -0600146 if (verbose)
147 printf("Magic signature not found\n");
Gabe Black540c2622011-12-05 12:09:26 +0000148 return 0x0100;
wdenk591dda52002-11-18 00:14:45 +0000149 }
Gabe Black540c2622011-12-05 12:09:26 +0000150}
151
Ivan Gorinov901bb0b2018-03-26 18:06:54 -0700152static int setup_device_tree(struct setup_header *hdr, const void *fdt_blob)
153{
Simon Glassdf30d412020-09-05 14:50:40 -0600154 int bootproto = get_boot_protocol(hdr, false);
Ivan Gorinov901bb0b2018-03-26 18:06:54 -0700155 struct setup_data *sd;
156 int size;
157
158 if (bootproto < 0x0209)
159 return -ENOTSUPP;
160
161 if (!fdt_blob)
162 return 0;
163
164 size = fdt_totalsize(fdt_blob);
165 if (size < 0)
166 return -EINVAL;
167
168 size += sizeof(struct setup_data);
169 sd = (struct setup_data *)malloc(size);
170 if (!sd) {
171 printf("Not enough memory for DTB setup data\n");
172 return -ENOMEM;
173 }
174
175 sd->next = hdr->setup_data;
176 sd->type = SETUP_DTB;
177 sd->len = fdt_totalsize(fdt_blob);
178 memcpy(sd->data, fdt_blob, sd->len);
179 hdr->setup_data = (unsigned long)sd;
180
181 return 0;
182}
183
Simon Glass531efde2023-07-12 09:04:44 -0600184const char *zimage_get_kernel_version(struct boot_params *params,
Simon Glassdf30d412020-09-05 14:50:40 -0600185 void *kernel_base)
186{
187 struct setup_header *hdr = &params->hdr;
188 int bootproto;
Simon Glass8ee28542020-11-04 09:59:14 -0700189 const char *s, *end;
Simon Glassdf30d412020-09-05 14:50:40 -0600190
191 bootproto = get_boot_protocol(hdr, false);
Simon Glass531efde2023-07-12 09:04:44 -0600192 log_debug("bootproto %x, hdr->setup_sects %x\n", bootproto,
193 hdr->setup_sects);
Simon Glassdf30d412020-09-05 14:50:40 -0600194 if (bootproto < 0x0200 || hdr->setup_sects < 15)
195 return NULL;
196
Simon Glass8ee28542020-11-04 09:59:14 -0700197 /* sanity-check the kernel version in case it is missing */
Simon Glass531efde2023-07-12 09:04:44 -0600198 log_debug("hdr->kernel_version %x, str at %p\n", hdr->kernel_version,
199 kernel_base + hdr->kernel_version + 0x200);
Simon Glass8ee28542020-11-04 09:59:14 -0700200 for (s = kernel_base + hdr->kernel_version + 0x200, end = s + 0x100; *s;
201 s++) {
202 if (!isprint(*s))
203 return NULL;
204 }
205
Simon Glassdf30d412020-09-05 14:50:40 -0600206 return kernel_base + hdr->kernel_version + 0x200;
207}
208
Gabe Black540c2622011-12-05 12:09:26 +0000209struct boot_params *load_zimage(char *image, unsigned long kernel_size,
Simon Glassd98a5bd2014-10-10 08:21:56 -0600210 ulong *load_addressp)
Gabe Black540c2622011-12-05 12:09:26 +0000211{
212 struct boot_params *setup_base;
Simon Glassdf30d412020-09-05 14:50:40 -0600213 const char *version;
Gabe Black540c2622011-12-05 12:09:26 +0000214 int setup_size;
215 int bootproto;
216 int big_image;
217
218 struct boot_params *params = (struct boot_params *)image;
219 struct setup_header *hdr = &params->hdr;
220
221 /* base address for real-mode segment */
222 setup_base = (struct boot_params *)DEFAULT_SETUP_BASE;
223
224 if (!kernel_magic_ok(hdr))
225 return 0;
wdenk57b2d802003-06-27 21:31:46 +0000226
wdenk591dda52002-11-18 00:14:45 +0000227 /* determine size of setup */
Graeme Russ1bab1042010-04-24 00:05:49 +1000228 if (0 == hdr->setup_sects) {
Simon Glass9d8ca9f2020-11-04 09:59:15 -0700229 log_warning("Setup Sectors = 0 (defaulting to 4)\n");
wdenk591dda52002-11-18 00:14:45 +0000230 setup_size = 5 * 512;
231 } else {
Graeme Russ1bab1042010-04-24 00:05:49 +1000232 setup_size = (hdr->setup_sects + 1) * 512;
wdenk591dda52002-11-18 00:14:45 +0000233 }
wdenk57b2d802003-06-27 21:31:46 +0000234
Simon Glass9d8ca9f2020-11-04 09:59:15 -0700235 log_debug("Setup Size = 0x%8.8lx\n", (ulong)setup_size);
Graeme Russ1bab1042010-04-24 00:05:49 +1000236
Graeme Russ883c6032011-11-08 02:33:15 +0000237 if (setup_size > SETUP_MAX_SIZE)
wdenk591dda52002-11-18 00:14:45 +0000238 printf("Error: Setup is too large (%d bytes)\n", setup_size);
wdenk57b2d802003-06-27 21:31:46 +0000239
Gabe Black540c2622011-12-05 12:09:26 +0000240 /* determine boot protocol version */
Simon Glassdf30d412020-09-05 14:50:40 -0600241 bootproto = get_boot_protocol(hdr, true);
Gabe Black540c2622011-12-05 12:09:26 +0000242
Simon Glass9d8ca9f2020-11-04 09:59:15 -0700243 log_debug("Using boot protocol version %x.%02x\n",
244 (bootproto & 0xff00) >> 8, bootproto & 0xff);
Gabe Black540c2622011-12-05 12:09:26 +0000245
Simon Glass531efde2023-07-12 09:04:44 -0600246 version = zimage_get_kernel_version(params, image);
Simon Glassdf30d412020-09-05 14:50:40 -0600247 if (version)
248 printf("Linux kernel version %s\n", version);
249 else
250 printf("Setup Sectors < 15 - Cannot print kernel version\n");
Gabe Black540c2622011-12-05 12:09:26 +0000251
wdenk591dda52002-11-18 00:14:45 +0000252 /* Determine image type */
Graeme Russ883c6032011-11-08 02:33:15 +0000253 big_image = (bootproto >= 0x0200) &&
254 (hdr->loadflags & BIG_KERNEL_FLAG);
wdenk57b2d802003-06-27 21:31:46 +0000255
Graeme Russ1bab1042010-04-24 00:05:49 +1000256 /* Determine load address */
Gabe Black1cf51212011-12-05 12:09:23 +0000257 if (big_image)
Simon Glassd98a5bd2014-10-10 08:21:56 -0600258 *load_addressp = BZIMAGE_LOAD_ADDR;
Gabe Black1cf51212011-12-05 12:09:23 +0000259 else
Simon Glassd98a5bd2014-10-10 08:21:56 -0600260 *load_addressp = ZIMAGE_LOAD_ADDR;
wdenk57b2d802003-06-27 21:31:46 +0000261
Gabe Blackc67a9482011-12-05 12:09:24 +0000262 printf("Building boot_params at 0x%8.8lx\n", (ulong)setup_base);
263 memset(setup_base, 0, sizeof(*setup_base));
264 setup_base->hdr = params->hdr;
wdenk57b2d802003-06-27 21:31:46 +0000265
Gabe Black540c2622011-12-05 12:09:26 +0000266 if (bootproto >= 0x0204)
267 kernel_size = hdr->syssize * 16;
268 else
269 kernel_size -= setup_size;
wdenk57b2d802003-06-27 21:31:46 +0000270
wdenk57b2d802003-06-27 21:31:46 +0000271 if (bootproto == 0x0100) {
Graeme Russ883c6032011-11-08 02:33:15 +0000272 /*
273 * A very old kernel MUST have its real-mode code
274 * loaded at 0x90000
275 */
Simon Glassca37a392017-01-16 07:03:35 -0700276 if ((ulong)setup_base != 0x90000) {
wdenk591dda52002-11-18 00:14:45 +0000277 /* Copy the real-mode kernel */
Graeme Russ883c6032011-11-08 02:33:15 +0000278 memmove((void *)0x90000, setup_base, setup_size);
279
wdenk591dda52002-11-18 00:14:45 +0000280 /* Copy the command line */
Graeme Russ883c6032011-11-08 02:33:15 +0000281 memmove((void *)0x99000,
Gabe Black1cf51212011-12-05 12:09:23 +0000282 (u8 *)setup_base + COMMAND_LINE_OFFSET,
Graeme Russ883c6032011-11-08 02:33:15 +0000283 COMMAND_LINE_SIZE);
wdenk57b2d802003-06-27 21:31:46 +0000284
Graeme Russ883c6032011-11-08 02:33:15 +0000285 /* Relocated */
Gabe Black1cf51212011-12-05 12:09:23 +0000286 setup_base = (struct boot_params *)0x90000;
wdenk591dda52002-11-18 00:14:45 +0000287 }
wdenk57b2d802003-06-27 21:31:46 +0000288
wdenk591dda52002-11-18 00:14:45 +0000289 /* It is recommended to clear memory up to the 32K mark */
Gabe Black1cf51212011-12-05 12:09:23 +0000290 memset((u8 *)0x90000 + setup_size, 0,
291 SETUP_MAX_SIZE - setup_size);
wdenk591dda52002-11-18 00:14:45 +0000292 }
wdenk57b2d802003-06-27 21:31:46 +0000293
Gabe Black540c2622011-12-05 12:09:26 +0000294 if (big_image) {
295 if (kernel_size > BZIMAGE_MAX_SIZE) {
296 printf("Error: bzImage kernel too big! "
297 "(size: %ld, max: %d)\n",
298 kernel_size, BZIMAGE_MAX_SIZE);
299 return 0;
300 }
301 } else if ((kernel_size) > ZIMAGE_MAX_SIZE) {
302 printf("Error: zImage kernel too big! (size: %ld, max: %d)\n",
303 kernel_size, ZIMAGE_MAX_SIZE);
304 return 0;
305 }
306
Simon Glassd98a5bd2014-10-10 08:21:56 -0600307 printf("Loading %s at address %lx (%ld bytes)\n",
308 big_image ? "bzImage" : "zImage", *load_addressp, kernel_size);
Gabe Black540c2622011-12-05 12:09:26 +0000309
Simon Glassd98a5bd2014-10-10 08:21:56 -0600310 memmove((void *)*load_addressp, image + setup_size, kernel_size);
Gabe Black540c2622011-12-05 12:09:26 +0000311
312 return setup_base;
313}
314
315int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
Simon Glass12d93ab2020-09-05 14:50:51 -0600316 ulong initrd_addr, ulong initrd_size, ulong cmdline_force)
Gabe Black540c2622011-12-05 12:09:26 +0000317{
318 struct setup_header *hdr = &setup_base->hdr;
Simon Glassdf30d412020-09-05 14:50:40 -0600319 int bootproto = get_boot_protocol(hdr, false);
Gabe Black540c2622011-12-05 12:09:26 +0000320
Simon Glass842ff442020-11-04 09:59:13 -0700321 log_debug("Setup E820 entries\n");
Simon Glass0de9c372021-07-10 21:15:21 -0600322 if (IS_ENABLED(CONFIG_COREBOOT_SYSINFO)) {
Simon Glass02c51202021-03-15 18:00:23 +1300323 setup_base->e820_entries = cb_install_e820_map(
324 ARRAY_SIZE(setup_base->e820_map), setup_base->e820_map);
Simon Glass0de9c372021-07-10 21:15:21 -0600325 } else {
326 setup_base->e820_entries = install_e820_map(
327 ARRAY_SIZE(setup_base->e820_map), setup_base->e820_map);
Simon Glass02c51202021-03-15 18:00:23 +1300328 }
Graeme Russ1bab1042010-04-24 00:05:49 +1000329
Gabe Black540c2622011-12-05 12:09:26 +0000330 if (bootproto == 0x0100) {
331 setup_base->screen_info.cl_magic = COMMAND_LINE_MAGIC;
332 setup_base->screen_info.cl_offset = COMMAND_LINE_OFFSET;
333 }
wdenk591dda52002-11-18 00:14:45 +0000334 if (bootproto >= 0x0200) {
Simon Glassd67ff032020-09-05 14:50:41 -0600335 hdr->type_of_loader = 0x80; /* U-Boot version 0 */
wdenk591dda52002-11-18 00:14:45 +0000336 if (initrd_addr) {
Gabe Black1cf51212011-12-05 12:09:23 +0000337 printf("Initial RAM disk at linear address "
338 "0x%08lx, size %ld bytes\n",
wdenk591dda52002-11-18 00:14:45 +0000339 initrd_addr, initrd_size);
wdenk57b2d802003-06-27 21:31:46 +0000340
Graeme Russ1bab1042010-04-24 00:05:49 +1000341 hdr->ramdisk_image = initrd_addr;
342 hdr->ramdisk_size = initrd_size;
wdenk591dda52002-11-18 00:14:45 +0000343 }
344 }
wdenk57b2d802003-06-27 21:31:46 +0000345
wdenk591dda52002-11-18 00:14:45 +0000346 if (bootproto >= 0x0201) {
Graeme Russ1bab1042010-04-24 00:05:49 +1000347 hdr->heap_end_ptr = HEAP_END_OFFSET;
348 hdr->loadflags |= HEAP_FLAG;
wdenk591dda52002-11-18 00:14:45 +0000349 }
wdenk57b2d802003-06-27 21:31:46 +0000350
Simon Glass4b4f2732014-10-19 21:11:21 -0600351 if (cmd_line) {
Simon Glass7b48ce82020-11-05 10:33:46 -0700352 int max_size = 0xff;
353 int ret;
354
Simon Glass842ff442020-11-04 09:59:13 -0700355 log_debug("Setup cmdline\n");
Simon Glass7b48ce82020-11-05 10:33:46 -0700356 if (bootproto >= 0x0206)
357 max_size = hdr->cmdline_size;
Simon Glass4b4f2732014-10-19 21:11:21 -0600358 if (bootproto >= 0x0202) {
359 hdr->cmd_line_ptr = (uintptr_t)cmd_line;
360 } else if (bootproto >= 0x0200) {
361 setup_base->screen_info.cl_magic = COMMAND_LINE_MAGIC;
362 setup_base->screen_info.cl_offset =
363 (uintptr_t)cmd_line - (uintptr_t)setup_base;
Graeme Russ1bab1042010-04-24 00:05:49 +1000364
Simon Glass4b4f2732014-10-19 21:11:21 -0600365 hdr->setup_move_size = 0x9100;
366 }
367
368 /* build command line at COMMAND_LINE_OFFSET */
Simon Glass12d93ab2020-09-05 14:50:51 -0600369 if (cmdline_force)
370 strcpy(cmd_line, (char *)cmdline_force);
371 else
372 build_command_line(cmd_line, auto_boot);
Simon Glasse7506982021-12-29 11:57:39 -0700373 if (IS_ENABLED(CONFIG_CMD_BOOTM)) {
374 ret = bootm_process_cmdline(cmd_line, max_size,
375 BOOTM_CL_ALL);
376 if (ret) {
377 printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n",
378 max_size, bootproto, ret);
379 return ret;
380 }
Simon Glass7b48ce82020-11-05 10:33:46 -0700381 }
382 printf("Kernel command line: \"");
383 puts(cmd_line);
384 printf("\"\n");
wdenk591dda52002-11-18 00:14:45 +0000385 }
wdenk591dda52002-11-18 00:14:45 +0000386
Simon Glass3a177172020-09-05 14:50:39 -0600387 if (IS_ENABLED(CONFIG_INTEL_MID) && bootproto >= 0x0207)
Andy Shevchenko8b7adf82018-01-10 19:40:14 +0200388 hdr->hardware_subarch = X86_SUBARCH_INTEL_MID;
Andy Shevchenko8b7adf82018-01-10 19:40:14 +0200389
Simon Glass3a177172020-09-05 14:50:39 -0600390 if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE))
391 setup_base->acpi_rsdp_addr = acpi_get_rsdp_addr();
Andy Shevchenkod87a21d2019-09-13 18:42:00 +0300392
Simon Glass842ff442020-11-04 09:59:13 -0700393 log_debug("Setup devicetree\n");
Ivan Gorinov901bb0b2018-03-26 18:06:54 -0700394 setup_device_tree(hdr, (const void *)env_get_hex("fdtaddr", 0));
Bin Mengf6d504f2015-07-06 16:31:36 +0800395 setup_video(&setup_base->screen_info);
396
Simon Glass3a177172020-09-05 14:50:39 -0600397 if (IS_ENABLED(CONFIG_EFI_STUB))
398 setup_efi_info(&setup_base->efi_info);
Bin Meng106dcfc2018-08-23 08:24:10 -0700399
Gabe Black540c2622011-12-05 12:09:26 +0000400 return 0;
wdenk591dda52002-11-18 00:14:45 +0000401}
402
Simon Glassd9b3c982020-09-05 14:50:43 -0600403static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc,
404 char *const argv[])
Graeme Russ1bab1042010-04-24 00:05:49 +1000405{
Simon Glassd9b3c982020-09-05 14:50:43 -0600406 const char *s;
Graeme Russ1bab1042010-04-24 00:05:49 +1000407
Simon Glass48800f42020-09-05 14:50:38 -0600408 memset(&state, '\0', sizeof(state));
Gabe Black1cf51212011-12-05 12:09:23 +0000409 if (argc >= 2) {
Graeme Russ3134be22010-10-07 20:03:19 +1100410 /* argv[1] holds the address of the bzImage */
411 s = argv[1];
Gabe Black1cf51212011-12-05 12:09:23 +0000412 } else {
Simon Glass64b723f2017-08-03 12:22:12 -0600413 s = env_get("fileaddr");
Gabe Black1cf51212011-12-05 12:09:23 +0000414 }
Graeme Russ1bab1042010-04-24 00:05:49 +1000415
Graeme Russ3134be22010-10-07 20:03:19 +1100416 if (s)
Simon Glass3ff49ec2021-07-24 09:03:29 -0600417 state.bzimage_addr = hextoul(s, NULL);
Graeme Russ3134be22010-10-07 20:03:19 +1100418
Gabe Black69b49ee2011-12-05 12:09:27 +0000419 if (argc >= 3) {
Graeme Russ3134be22010-10-07 20:03:19 +1100420 /* argv[2] holds the size of the bzImage */
Simon Glass3ff49ec2021-07-24 09:03:29 -0600421 state.bzimage_size = hextoul(argv[2], NULL);
Gabe Black69b49ee2011-12-05 12:09:27 +0000422 }
423
424 if (argc >= 4)
Simon Glass3ff49ec2021-07-24 09:03:29 -0600425 state.initrd_addr = hextoul(argv[3], NULL);
Gabe Black69b49ee2011-12-05 12:09:27 +0000426 if (argc >= 5)
Simon Glass3ff49ec2021-07-24 09:03:29 -0600427 state.initrd_size = hextoul(argv[4], NULL);
Simon Glassc55ce682020-09-05 14:50:49 -0600428 if (argc >= 6) {
429 /*
430 * When the base_ptr is passed in, we assume that the image is
431 * already loaded at the address given by argv[1] and therefore
432 * the original bzImage is somewhere else, or not accessible.
433 * In any case, we don't need access to the bzImage since all
434 * the processing is assumed to be done.
435 *
436 * So set the base_ptr to the given address, use this arg as the
437 * load address and set bzimage_addr to 0 so we know that it
438 * cannot be proceesed (or processed again).
439 */
Simon Glass3ff49ec2021-07-24 09:03:29 -0600440 state.base_ptr = (void *)hextoul(argv[5], NULL);
Simon Glassc55ce682020-09-05 14:50:49 -0600441 state.load_address = state.bzimage_addr;
442 state.bzimage_addr = 0;
443 }
Simon Glass12d93ab2020-09-05 14:50:51 -0600444 if (argc >= 7)
Simon Glass5e956d12020-11-09 07:12:24 -0700445 state.cmdline = env_get(argv[6]);
Graeme Russ1bab1042010-04-24 00:05:49 +1000446
Simon Glass24d26f72020-09-05 14:50:46 -0600447 return 0;
448}
449
Simon Glass84305a12023-07-12 09:04:43 -0600450static int zboot_load(void)
Simon Glass24d26f72020-09-05 14:50:46 -0600451{
452 struct boot_params *base_ptr;
453
Simon Glassc55ce682020-09-05 14:50:49 -0600454 if (state.base_ptr) {
455 struct boot_params *from = (struct boot_params *)state.base_ptr;
456
457 base_ptr = (struct boot_params *)DEFAULT_SETUP_BASE;
Simon Glass9d8ca9f2020-11-04 09:59:15 -0700458 log_debug("Building boot_params at 0x%8.8lx\n",
459 (ulong)base_ptr);
Simon Glassc55ce682020-09-05 14:50:49 -0600460 memset(base_ptr, '\0', sizeof(*base_ptr));
461 base_ptr->hdr = from->hdr;
462 } else {
463 base_ptr = load_zimage((void *)state.bzimage_addr, state.bzimage_size,
464 &state.load_address);
465 if (!base_ptr) {
466 puts("## Kernel loading failed ...\n");
Simon Glass84305a12023-07-12 09:04:43 -0600467 return -EINVAL;
Simon Glassc55ce682020-09-05 14:50:49 -0600468 }
Graeme Russ1bab1042010-04-24 00:05:49 +1000469 }
Simon Glass1931b192020-09-05 14:50:44 -0600470 state.base_ptr = base_ptr;
Simon Glass84305a12023-07-12 09:04:43 -0600471
472 return 0;
473}
474
475static int do_zboot_load(struct cmd_tbl *cmdtp, int flag, int argc,
476 char *const argv[])
477{
478 if (zboot_load())
479 return CMD_RET_FAILURE;
480
481 if (env_set_hex("zbootbase", map_to_sysmem(state.base_ptr)) ||
Simon Glass58a90462020-09-05 14:50:48 -0600482 env_set_hex("zbootaddr", state.load_address))
483 return CMD_RET_FAILURE;
Simon Glass48800f42020-09-05 14:50:38 -0600484
Simon Glass30634832020-09-05 14:50:47 -0600485 return 0;
486}
487
Simon Glass84305a12023-07-12 09:04:43 -0600488static int zboot_setup(void)
489{
490 struct boot_params *base_ptr = state.base_ptr;
491 int ret;
492
493 ret = setup_zimage(base_ptr, (char *)base_ptr + COMMAND_LINE_OFFSET,
494 0, state.initrd_addr, state.initrd_size,
495 (ulong)state.cmdline);
496 if (ret)
497 return -EINVAL;
498
499 return 0;
500}
501
Simon Glass30634832020-09-05 14:50:47 -0600502static int do_zboot_setup(struct cmd_tbl *cmdtp, int flag, int argc,
503 char *const argv[])
504{
505 struct boot_params *base_ptr = state.base_ptr;
Simon Glass30634832020-09-05 14:50:47 -0600506
507 if (!base_ptr) {
508 printf("base is not set: use 'zboot load' first\n");
509 return CMD_RET_FAILURE;
510 }
Simon Glass84305a12023-07-12 09:04:43 -0600511 if (zboot_setup()) {
Simon Glassddf446b2014-10-10 08:21:59 -0600512 puts("Setting up boot parameters failed ...\n");
Simon Glass30634832020-09-05 14:50:47 -0600513 return CMD_RET_FAILURE;
Gabe Black540c2622011-12-05 12:09:26 +0000514 }
515
Simon Glass1931b192020-09-05 14:50:44 -0600516 return 0;
517}
518
Simon Glass83dd29e2020-09-05 14:50:45 -0600519static int do_zboot_info(struct cmd_tbl *cmdtp, int flag, int argc,
520 char *const argv[])
521{
522 printf("Kernel loaded at %08lx, setup_base=%p\n",
523 state.load_address, state.base_ptr);
524
525 return 0;
526}
527
Simon Glass84305a12023-07-12 09:04:43 -0600528static int zboot_go(void)
Simon Glass1931b192020-09-05 14:50:44 -0600529{
Simon Glass6d496322023-03-20 08:30:08 +1300530 struct boot_params *params = state.base_ptr;
531 struct setup_header *hdr = &params->hdr;
532 bool image_64bit;
533 ulong entry;
Simon Glass1931b192020-09-05 14:50:44 -0600534 int ret;
535
Simon Glass0db800c2020-09-05 14:50:42 -0600536 disable_interrupts();
Simon Glass1931b192020-09-05 14:50:44 -0600537
Simon Glass6d496322023-03-20 08:30:08 +1300538 entry = state.load_address;
539 image_64bit = false;
540 if (IS_ENABLED(CONFIG_X86_RUN_64BIT) &&
541 (hdr->xloadflags & XLF_KERNEL_64)) {
542 entry += 0x200;
543 image_64bit = true;
544 }
545
Gabe Black540c2622011-12-05 12:09:26 +0000546 /* we assume that the kernel is in place */
Simon Glass6d496322023-03-20 08:30:08 +1300547 ret = boot_linux_kernel((ulong)state.base_ptr, entry, image_64bit);
Simon Glass84305a12023-07-12 09:04:43 -0600548
549 return ret;
550}
551
552static int do_zboot_go(struct cmd_tbl *cmdtp, int flag, int argc,
553 char *const argv[])
554{
555 int ret;
556
557 ret = zboot_go();
Simon Glass1931b192020-09-05 14:50:44 -0600558 printf("Kernel returned! (err=%d)\n", ret);
559
560 return CMD_RET_FAILURE;
Graeme Russ1bab1042010-04-24 00:05:49 +1000561}
562
Simon Glass84305a12023-07-12 09:04:43 -0600563int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size,
564 ulong base, char *cmdline)
565{
566 int ret;
567
568 memset(&state, '\0', sizeof(state));
569
570 if (base) {
571 state.base_ptr = map_sysmem(base, 0);
572 state.load_address = addr;
573 } else {
574 state.bzimage_addr = addr;
575 }
576 state.bzimage_size = size;
577 state.initrd_addr = initrd;
578 state.initrd_size = initrd_size;
579 state.cmdline = cmdline;
580
581 ret = zboot_load();
582 if (ret)
583 return log_msg_ret("ld", ret);
584 ret = zboot_setup();
585 if (ret)
586 return log_msg_ret("set", ret);
587 ret = zboot_go();
588 if (ret)
589 return log_msg_ret("set", ret);
590
591 return -EFAULT;
592}
593
Simon Glassaad0d762020-09-05 14:50:50 -0600594static void print_num(const char *name, ulong value)
595{
596 printf("%-20s: %lx\n", name, value);
597}
598
599static void print_num64(const char *name, u64 value)
600{
601 printf("%-20s: %llx\n", name, value);
602}
603
604static const char *const e820_type_name[E820_COUNT] = {
605 [E820_RAM] = "RAM",
606 [E820_RESERVED] = "Reserved",
607 [E820_ACPI] = "ACPI",
608 [E820_NVS] = "ACPI NVS",
609 [E820_UNUSABLE] = "Unusable",
610};
611
612static const char *const bootloader_id[] = {
613 "LILO",
614 "Loadlin",
615 "bootsect-loader",
616 "Syslinux",
617 "Etherboot/gPXE/iPXE",
618 "ELILO",
619 "undefined",
620 "GRUB",
621 "U-Boot",
622 "Xen",
623 "Gujin",
624 "Qemu",
625 "Arcturus Networks uCbootloader",
626 "kexec-tools",
627 "Extended",
628 "Special",
629 "Reserved",
630 "Minimal Linux Bootloader",
631 "OVMF UEFI virtualization stack",
632};
633
634struct flag_info {
635 uint bit;
636 const char *name;
637};
638
639static struct flag_info load_flags[] = {
640 { LOADED_HIGH, "loaded-high" },
641 { QUIET_FLAG, "quiet" },
642 { KEEP_SEGMENTS, "keep-segments" },
643 { CAN_USE_HEAP, "can-use-heap" },
644};
645
646static struct flag_info xload_flags[] = {
647 { XLF_KERNEL_64, "64-bit-entry" },
648 { XLF_CAN_BE_LOADED_ABOVE_4G, "can-load-above-4gb" },
649 { XLF_EFI_HANDOVER_32, "32-efi-handoff" },
650 { XLF_EFI_HANDOVER_64, "64-efi-handoff" },
651 { XLF_EFI_KEXEC, "kexec-efi-runtime" },
652};
653
654static void print_flags(struct flag_info *flags, int count, uint value)
655{
656 int i;
657
658 printf("%-20s:", "");
659 for (i = 0; i < count; i++) {
660 uint mask = flags[i].bit;
661
662 if (value & mask)
663 printf(" %s", flags[i].name);
664 }
665 printf("\n");
666}
667
668static void show_loader(struct setup_header *hdr)
669{
670 bool version_valid = false;
671 int type, version;
672 const char *name;
673
674 type = hdr->type_of_loader >> 4;
675 version = hdr->type_of_loader & 0xf;
676 if (type == 0xe)
677 type = 0x10 + hdr->ext_loader_type;
678 version |= hdr->ext_loader_ver << 4;
679 if (!hdr->type_of_loader) {
680 name = "pre-2.00 bootloader";
681 } else if (hdr->type_of_loader == 0xff) {
682 name = "unknown";
683 } else if (type < ARRAY_SIZE(bootloader_id)) {
684 name = bootloader_id[type];
685 version_valid = true;
686 } else {
687 name = "undefined";
688 }
689 printf("%20s %s", "", name);
690 if (version_valid)
691 printf(", version %x", version);
692 printf("\n");
693}
694
Simon Glass5495aaf2023-07-30 11:17:00 -0600695void zimage_dump(struct boot_params *base_ptr, bool show_cmdline)
Simon Glassaad0d762020-09-05 14:50:50 -0600696{
Simon Glassaad0d762020-09-05 14:50:50 -0600697 struct setup_header *hdr;
698 const char *version;
699 int i;
700
Simon Glassaad0d762020-09-05 14:50:50 -0600701 printf("Setup located at %p:\n\n", base_ptr);
702 print_num64("ACPI RSDP addr", base_ptr->acpi_rsdp_addr);
703
704 printf("E820: %d entries\n", base_ptr->e820_entries);
705 if (base_ptr->e820_entries) {
Simon Glass5495aaf2023-07-30 11:17:00 -0600706 printf("%12s %10s %s\n", "Addr", "Size", "Type");
Simon Glassaad0d762020-09-05 14:50:50 -0600707 for (i = 0; i < base_ptr->e820_entries; i++) {
708 struct e820_entry *entry = &base_ptr->e820_map[i];
709
710 printf("%12llx %10llx %s\n", entry->addr, entry->size,
711 entry->type < E820_COUNT ?
712 e820_type_name[entry->type] :
713 simple_itoa(entry->type));
714 }
715 }
716
717 hdr = &base_ptr->hdr;
718 print_num("Setup sectors", hdr->setup_sects);
719 print_num("Root flags", hdr->root_flags);
720 print_num("Sys size", hdr->syssize);
721 print_num("RAM size", hdr->ram_size);
722 print_num("Video mode", hdr->vid_mode);
723 print_num("Root dev", hdr->root_dev);
724 print_num("Boot flag", hdr->boot_flag);
725 print_num("Jump", hdr->jump);
726 print_num("Header", hdr->header);
727 if (hdr->header == KERNEL_V2_MAGIC)
728 printf("%-20s %s\n", "", "Kernel V2");
729 else
730 printf("%-20s %s\n", "", "Ancient kernel, using version 100");
731 print_num("Version", hdr->version);
732 print_num("Real mode switch", hdr->realmode_swtch);
Simon Glass83ec1ca2023-03-20 08:30:06 +1300733 print_num("Start sys seg", hdr->start_sys_seg);
Simon Glassaad0d762020-09-05 14:50:50 -0600734 print_num("Kernel version", hdr->kernel_version);
Simon Glass531efde2023-07-12 09:04:44 -0600735 version = zimage_get_kernel_version(base_ptr,
736 (void *)state.bzimage_addr);
Simon Glassaad0d762020-09-05 14:50:50 -0600737 if (version)
738 printf(" @%p: %s\n", version, version);
739 print_num("Type of loader", hdr->type_of_loader);
740 show_loader(hdr);
741 print_num("Load flags", hdr->loadflags);
742 print_flags(load_flags, ARRAY_SIZE(load_flags), hdr->loadflags);
743 print_num("Setup move size", hdr->setup_move_size);
744 print_num("Code32 start", hdr->code32_start);
745 print_num("Ramdisk image", hdr->ramdisk_image);
746 print_num("Ramdisk size", hdr->ramdisk_size);
747 print_num("Bootsect kludge", hdr->bootsect_kludge);
748 print_num("Heap end ptr", hdr->heap_end_ptr);
749 print_num("Ext loader ver", hdr->ext_loader_ver);
750 print_num("Ext loader type", hdr->ext_loader_type);
751 print_num("Command line ptr", hdr->cmd_line_ptr);
Simon Glass5495aaf2023-07-30 11:17:00 -0600752 if (show_cmdline && hdr->cmd_line_ptr) {
Simon Glassaad0d762020-09-05 14:50:50 -0600753 printf(" ");
754 /* Use puts() to avoid limits from CONFIG_SYS_PBSIZE */
Simon Glass12d93ab2020-09-05 14:50:51 -0600755 puts((char *)(ulong)hdr->cmd_line_ptr);
Simon Glassaad0d762020-09-05 14:50:50 -0600756 printf("\n");
757 }
758 print_num("Initrd addr max", hdr->initrd_addr_max);
759 print_num("Kernel alignment", hdr->kernel_alignment);
760 print_num("Relocatable kernel", hdr->relocatable_kernel);
761 print_num("Min alignment", hdr->min_alignment);
762 if (hdr->min_alignment)
763 printf("%-20s: %x\n", "", 1 << hdr->min_alignment);
764 print_num("Xload flags", hdr->xloadflags);
765 print_flags(xload_flags, ARRAY_SIZE(xload_flags), hdr->xloadflags);
766 print_num("Cmdline size", hdr->cmdline_size);
767 print_num("Hardware subarch", hdr->hardware_subarch);
768 print_num64("HW subarch data", hdr->hardware_subarch_data);
769 print_num("Payload offset", hdr->payload_offset);
770 print_num("Payload length", hdr->payload_length);
771 print_num64("Setup data", hdr->setup_data);
772 print_num64("Pref address", hdr->pref_address);
773 print_num("Init size", hdr->init_size);
774 print_num("Handover offset", hdr->handover_offset);
775 if (get_boot_protocol(hdr, false) >= 0x215)
776 print_num("Kernel info offset", hdr->kernel_info_offset);
Simon Glassba094bb2021-01-24 10:06:08 -0700777}
778
779static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc,
780 char *const argv[])
781{
782 struct boot_params *base_ptr = state.base_ptr;
783
784 if (argc > 1)
Simon Glass3ff49ec2021-07-24 09:03:29 -0600785 base_ptr = (void *)hextoul(argv[1], NULL);
Simon Glassba094bb2021-01-24 10:06:08 -0700786 if (!base_ptr) {
787 printf("No zboot setup_base\n");
788 return CMD_RET_FAILURE;
789 }
Simon Glass5495aaf2023-07-30 11:17:00 -0600790 zimage_dump(base_ptr, true);
Simon Glassaad0d762020-09-05 14:50:50 -0600791
792 return 0;
793}
794
Simon Glassd9b3c982020-09-05 14:50:43 -0600795/* Note: This defines the complete_zboot() function */
796U_BOOT_SUBCMDS(zboot,
Simon Glass12d93ab2020-09-05 14:50:51 -0600797 U_BOOT_CMD_MKENT(start, 8, 1, do_zboot_start, "", ""),
Simon Glass24d26f72020-09-05 14:50:46 -0600798 U_BOOT_CMD_MKENT(load, 1, 1, do_zboot_load, "", ""),
Simon Glass30634832020-09-05 14:50:47 -0600799 U_BOOT_CMD_MKENT(setup, 1, 1, do_zboot_setup, "", ""),
Simon Glass83dd29e2020-09-05 14:50:45 -0600800 U_BOOT_CMD_MKENT(info, 1, 1, do_zboot_info, "", ""),
Simon Glass1931b192020-09-05 14:50:44 -0600801 U_BOOT_CMD_MKENT(go, 1, 1, do_zboot_go, "", ""),
Simon Glassaad0d762020-09-05 14:50:50 -0600802 U_BOOT_CMD_MKENT(dump, 2, 1, do_zboot_dump, "", ""),
Simon Glassd9b3c982020-09-05 14:50:43 -0600803)
804
805int do_zboot_states(struct cmd_tbl *cmdtp, int flag, int argc,
806 char *const argv[], int state_mask)
807{
808 int i;
809
810 for (i = 0; i < ZBOOT_STATE_COUNT; i++) {
811 struct cmd_tbl *cmd = &zboot_subcmds[i];
812 int mask = 1 << i;
813 int ret;
814
815 if (mask & state_mask) {
816 ret = cmd->cmd(cmd, flag, argc, argv);
817 if (ret)
818 return ret;
819 }
820 }
821
822 return 0;
823}
824
825int do_zboot_parent(struct cmd_tbl *cmdtp, int flag, int argc,
826 char *const argv[], int *repeatable)
827{
828 /* determine if we have a sub command */
829 if (argc > 1) {
830 char *endp;
831
Simon Glass3ff49ec2021-07-24 09:03:29 -0600832 hextoul(argv[1], &endp);
Simon Glassd9b3c982020-09-05 14:50:43 -0600833 /*
834 * endp pointing to nul means that argv[1] was just a valid
835 * number, so pass it along to the normal processing
836 */
837 if (*endp)
838 return do_zboot(cmdtp, flag, argc, argv, repeatable);
839 }
840
Simon Glass1931b192020-09-05 14:50:44 -0600841 do_zboot_states(cmdtp, flag, argc, argv, ZBOOT_STATE_START |
Simon Glass30634832020-09-05 14:50:47 -0600842 ZBOOT_STATE_LOAD | ZBOOT_STATE_SETUP |
843 ZBOOT_STATE_INFO | ZBOOT_STATE_GO);
Simon Glassd9b3c982020-09-05 14:50:43 -0600844
845 return CMD_RET_FAILURE;
846}
847
848U_BOOT_CMDREP_COMPLETE(
Simon Glass12d93ab2020-09-05 14:50:51 -0600849 zboot, 8, do_zboot_parent, "Boot bzImage",
850 "[addr] [size] [initrd addr] [initrd size] [setup] [cmdline]\n"
Gabe Black69b49ee2011-12-05 12:09:27 +0000851 " addr - The optional starting address of the bzimage.\n"
852 " If not set it defaults to the environment\n"
853 " variable \"fileaddr\".\n"
854 " size - The optional size of the bzimage. Defaults to\n"
855 " zero.\n"
856 " initrd addr - The address of the initrd image to use, if any.\n"
857 " initrd size - The size of the initrd image to use, if any.\n"
Simon Glassc55ce682020-09-05 14:50:49 -0600858 " setup - The address of the kernel setup region, if this\n"
859 " is not at addr\n"
Simon Glass5e956d12020-11-09 07:12:24 -0700860 " cmdline - Environment variable containing the kernel\n"
861 " command line, to override U-Boot's normal\n"
862 " cmdline generation\n"
Simon Glassd9b3c982020-09-05 14:50:43 -0600863 "\n"
864 "Sub-commands to do part of the zboot sequence:\n"
Simon Glass1931b192020-09-05 14:50:44 -0600865 "\tstart [addr [arg ...]] - specify arguments\n"
Simon Glass24d26f72020-09-05 14:50:46 -0600866 "\tload - load OS image\n"
Simon Glass30634832020-09-05 14:50:47 -0600867 "\tsetup - set up table\n"
Simon Glass83dd29e2020-09-05 14:50:45 -0600868 "\tinfo - show summary info\n"
Simon Glassaad0d762020-09-05 14:50:50 -0600869 "\tgo - start OS\n"
870 "\tdump [addr] - dump info (optional address of boot params)",
Simon Glassd9b3c982020-09-05 14:50:43 -0600871 complete_zboot
Graeme Russ1bab1042010-04-24 00:05:49 +1000872);