Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2000-2009 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef _BOOTM_H |
| 8 | #define _BOOTM_H |
| 9 | |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 10 | #include <image.h> |
| 11 | |
Simon Glass | 4493d61 | 2023-07-30 11:16:53 -0600 | [diff] [blame] | 12 | struct boot_params; |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 13 | struct cmd_tbl; |
| 14 | |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 15 | #define BOOTM_ERR_RESET (-1) |
| 16 | #define BOOTM_ERR_OVERLAP (-2) |
| 17 | #define BOOTM_ERR_UNIMPLEMENTED (-3) |
| 18 | |
Simon Glass | 526ea78 | 2023-12-15 20:14:12 -0700 | [diff] [blame] | 19 | /** |
| 20 | * struct bootm_info() - information used when processing images to boot |
| 21 | * |
Simon Glass | 112b020 | 2023-12-15 20:14:14 -0700 | [diff] [blame] | 22 | * These mirror the first three arguments of the bootm command. They are |
| 23 | * designed to handle any type of image, but typically it is a FIT. |
| 24 | * |
| 25 | * @addr_img: Address of image to bootm, as passed to |
| 26 | * genimg_get_kernel_addr_fit() for processing: |
| 27 | * |
| 28 | * NULL: Usees default load address, i.e. image_load_addr |
| 29 | * <addr>: Uses hex address |
| 30 | * |
| 31 | * For FIT: |
| 32 | * "[<addr>]#<conf>": Uses address (or image_load_addr) and also specifies |
| 33 | * the FIT configuration to use |
| 34 | * "[<addr>]:<subimage>": Uses address (or image_load_addr) and also |
| 35 | * specifies the subimage name containing the OS |
| 36 | * |
| 37 | * @conf_ramdisk: Address (or with FIT, the name) of the ramdisk image, as |
| 38 | * passed to boot_get_ramdisk() for processing, or NULL for none |
| 39 | * @conf_fdt: Address (or with FIT, the name) of the FDT image, as passed to |
| 40 | * boot_get_fdt() for processing, or NULL for none |
| 41 | * @boot_progress: true to show boot progress |
Simon Glass | 526ea78 | 2023-12-15 20:14:12 -0700 | [diff] [blame] | 42 | * @images: images information |
Simon Glass | 112b020 | 2023-12-15 20:14:14 -0700 | [diff] [blame] | 43 | * @cmd_name: command which invoked this operation, e.g. "bootm" |
Simon Glass | 526ea78 | 2023-12-15 20:14:12 -0700 | [diff] [blame] | 44 | * @argc: Number of arguments to the command (excluding the actual command). |
| 45 | * This is 0 if there are no arguments |
| 46 | * @argv: NULL-terminated list of arguments, or NULL if there are no arguments |
Simon Glass | 0fdb4b3 | 2025-03-05 17:24:58 -0700 | [diff] [blame] | 47 | * |
| 48 | * For zboot: |
| 49 | * @bzimage_addr: Address of the bzImage to boot, or 0 if the image has already |
| 50 | * been loaded and does not exist (as a cohesive whole) in memory |
| 51 | * @bzimage_size: Size of the bzImage, or 0 to detect this |
| 52 | * @initrd_addr: Address of the initial ramdisk, or 0 if none |
| 53 | * @initrd_size: Size of the initial ramdisk, or 0 if none |
| 54 | * @load_address: Address where the bzImage is moved before booting, either |
| 55 | * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR |
| 56 | * This is set up when loading the zimage |
| 57 | * @base_ptr: Pointer to the boot parameters, typically at address |
| 58 | * DEFAULT_SETUP_BASE |
| 59 | * This is set up when loading the zimage |
| 60 | * @cmdline: Environment variable containing the 'override' command line, or |
| 61 | * NULL to use the one in the setup block |
Simon Glass | 526ea78 | 2023-12-15 20:14:12 -0700 | [diff] [blame] | 62 | */ |
| 63 | struct bootm_info { |
Simon Glass | 112b020 | 2023-12-15 20:14:14 -0700 | [diff] [blame] | 64 | const char *addr_img; |
| 65 | const char *conf_ramdisk; |
| 66 | const char *conf_fdt; |
| 67 | bool boot_progress; |
Simon Glass | 526ea78 | 2023-12-15 20:14:12 -0700 | [diff] [blame] | 68 | struct bootm_headers *images; |
Simon Glass | 112b020 | 2023-12-15 20:14:14 -0700 | [diff] [blame] | 69 | const char *cmd_name; |
Simon Glass | 526ea78 | 2023-12-15 20:14:12 -0700 | [diff] [blame] | 70 | int argc; |
| 71 | char *const *argv; |
Simon Glass | 0fdb4b3 | 2025-03-05 17:24:58 -0700 | [diff] [blame] | 72 | |
| 73 | /* zboot items */ |
| 74 | #ifdef CONFIG_X86 |
| 75 | ulong bzimage_addr; |
| 76 | ulong bzimage_size; |
| 77 | ulong initrd_addr; |
| 78 | ulong initrd_size; |
| 79 | ulong load_address; |
| 80 | struct boot_params *base_ptr; |
| 81 | const char *cmdline; |
| 82 | #endif |
Simon Glass | 526ea78 | 2023-12-15 20:14:12 -0700 | [diff] [blame] | 83 | }; |
| 84 | |
Simon Glass | 0fdb4b3 | 2025-03-05 17:24:58 -0700 | [diff] [blame] | 85 | /* macro to allow setting fields in generic code */ |
| 86 | #ifdef CONFIG_X86 |
| 87 | #define bootm_x86_set(_bmi, _field, _val) (_bmi)->_field = (_val) |
| 88 | #else |
| 89 | #define bootm_x86_set(_bmi, _field, _val) |
| 90 | #endif |
| 91 | |
Simon Glass | 1cdfab5 | 2025-03-05 17:25:07 -0700 | [diff] [blame] | 92 | static inline ulong bootm_len(void) |
| 93 | { |
| 94 | #ifdef CONFIG_SYS_BOOTM_LEN |
| 95 | return CONFIG_SYS_BOOTM_LEN; |
| 96 | #endif |
| 97 | return 0; |
| 98 | } |
| 99 | |
Simon Glass | 112b020 | 2023-12-15 20:14:14 -0700 | [diff] [blame] | 100 | /** |
| 101 | * bootm_init() - Set up a bootm_info struct with useful defaults |
| 102 | * |
Simon Glass | 7b15c57 | 2025-03-05 17:25:00 -0700 | [diff] [blame] | 103 | * @bmi: Bootm information |
| 104 | * |
Simon Glass | 112b020 | 2023-12-15 20:14:14 -0700 | [diff] [blame] | 105 | * Set up the struct with default values for all members: |
| 106 | * @boot_progress is set to true and @images is set to the global images |
| 107 | * variable. Everything else is set to NULL except @argc which is 0 |
| 108 | */ |
| 109 | void bootm_init(struct bootm_info *bmi); |
| 110 | |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 111 | /* |
| 112 | * Continue booting an OS image; caller already has: |
| 113 | * - copied image header to global variable `header' |
| 114 | * - checked header magic number, checksums (both header & image), |
| 115 | * - verified image architecture (PPC) and type (KERNEL or MULTI), |
| 116 | * - loaded (first part of) image to header load address, |
| 117 | * - disabled interrupts. |
| 118 | * |
| 119 | * @flag: Flags indicating what to do (BOOTM_STATE_...) |
Simon Glass | 7b15c57 | 2025-03-05 17:25:00 -0700 | [diff] [blame] | 120 | * @bmi: Bootm information |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 121 | * Return: 1 on error. On success the OS boots so this function does |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 122 | * not return. |
| 123 | */ |
Simon Glass | 0726d9d | 2023-12-15 20:14:13 -0700 | [diff] [blame] | 124 | typedef int boot_os_fn(int flag, struct bootm_info *bmi); |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 125 | |
| 126 | extern boot_os_fn do_bootm_linux; |
Bin Meng | 54a735a | 2018-12-21 07:13:40 -0800 | [diff] [blame] | 127 | extern boot_os_fn do_bootm_vxworks; |
| 128 | |
Simon Glass | 526ea78 | 2023-12-15 20:14:12 -0700 | [diff] [blame] | 129 | int do_bootelf(struct cmd_tbl *cmdtp, int fglag, int argc, char *const argv[]); |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 130 | |
| 131 | boot_os_fn *bootm_os_get_boot_func(int os); |
| 132 | |
Fabrice Fontaine | d00d6b5 | 2019-05-03 22:37:05 +0200 | [diff] [blame] | 133 | #if defined(CONFIG_FIT_SIGNATURE) |
Simon Glass | a51991d | 2014-06-12 07:24:53 -0600 | [diff] [blame] | 134 | int bootm_host_load_images(const void *fit, int cfg_noffset); |
Fabrice Fontaine | d00d6b5 | 2019-05-03 22:37:05 +0200 | [diff] [blame] | 135 | #endif |
Simon Glass | a51991d | 2014-06-12 07:24:53 -0600 | [diff] [blame] | 136 | |
Simon Glass | 454746d | 2023-12-15 20:14:20 -0700 | [diff] [blame] | 137 | int boot_selected_os(int state, struct bootm_info *bmi, boot_os_fn *boot_fn); |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 138 | |
| 139 | ulong bootm_disable_interrupts(void); |
| 140 | |
Simon Glass | d46c81e | 2023-11-18 14:05:16 -0700 | [diff] [blame] | 141 | /** |
| 142 | * bootm_find_images() - find and locate various images |
| 143 | * |
| 144 | * @img_addr: Address of image being loaded |
| 145 | * @conf_ramdisk: Indicates the ramdisk to use (typically second arg of bootm) |
| 146 | * @conf_fdt: Indicates the FDT to use (typically third arg of bootm) |
| 147 | * @start: OS image start address |
| 148 | * @size: OS image size |
| 149 | * |
| 150 | * boot_find_images() will attempt to load an available ramdisk, |
| 151 | * flattened device tree, as well as specifically marked |
| 152 | * "loadable" images (loadables are FIT only) |
| 153 | * |
| 154 | * Note: bootm_find_images will skip an image if it is not found |
| 155 | * |
| 156 | * This is a special function used by booti/bootz |
| 157 | * |
| 158 | * Return: |
| 159 | * 0, if all existing images were loaded correctly |
| 160 | * 1, if an image is found but corrupted, or invalid |
| 161 | */ |
| 162 | int bootm_find_images(ulong img_addr, const char *conf_ramdisk, |
| 163 | const char *conf_fdt, ulong start, ulong size); |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 164 | |
Eddie James | 32401ba | 2023-10-24 10:43:50 -0500 | [diff] [blame] | 165 | /* |
| 166 | * Measure the boot images. Measurement is the process of hashing some binary |
| 167 | * data and storing it into secure memory, i.e. TPM PCRs. In addition, each |
| 168 | * measurement is logged into the platform event log such that the operating |
| 169 | * system can access it and perform attestation of the boot. |
| 170 | * |
| 171 | * @images: The structure containing the various images to boot (linux, |
| 172 | * initrd, dts, etc.) |
| 173 | */ |
| 174 | int bootm_measure(struct bootm_headers *images); |
| 175 | |
Simon Glass | 839e9e4 | 2023-12-15 20:14:15 -0700 | [diff] [blame] | 176 | /** |
Simon Glass | d90f94f | 2023-12-15 20:14:19 -0700 | [diff] [blame] | 177 | * bootm_run_states() - Execute selected states of the bootm command. |
Simon Glass | 839e9e4 | 2023-12-15 20:14:15 -0700 | [diff] [blame] | 178 | * |
| 179 | * Note that if states contains more than one flag it MUST contain |
Simon Glass | 50fa2fe | 2023-12-15 20:14:18 -0700 | [diff] [blame] | 180 | * BOOTM_STATE_START, since this handles the addr_fit, conf_ramdisk and conf_fit |
| 181 | * members of @bmi |
Simon Glass | 839e9e4 | 2023-12-15 20:14:15 -0700 | [diff] [blame] | 182 | * |
Simon Glass | 50fa2fe | 2023-12-15 20:14:18 -0700 | [diff] [blame] | 183 | * Also note that aside from boot_os_fn functions and bootm_load_os, no other |
| 184 | * functions store the return value of in 'ret' may use a negative return |
Simon Glass | 839e9e4 | 2023-12-15 20:14:15 -0700 | [diff] [blame] | 185 | * value, without special handling. |
| 186 | * |
Simon Glass | 50fa2fe | 2023-12-15 20:14:18 -0700 | [diff] [blame] | 187 | * @bmi: bootm information |
| 188 | * @states Mask containing states to run (BOOTM_STATE_...) |
Simon Glass | 839e9e4 | 2023-12-15 20:14:15 -0700 | [diff] [blame] | 189 | * Return: 0 if ok, something else on error. Some errors will cause this |
| 190 | * function to perform a reboot! If states contains BOOTM_STATE_OS_GO |
| 191 | * then the intent is to boot an OS, so this function will not return |
| 192 | * unless the image type is standalone. |
| 193 | */ |
Simon Glass | d90f94f | 2023-12-15 20:14:19 -0700 | [diff] [blame] | 194 | int bootm_run_states(struct bootm_info *bmi, int states); |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 195 | |
Simon Glass | bd73cac | 2023-12-15 20:14:21 -0700 | [diff] [blame] | 196 | /** |
Simon Glass | 6568e4b | 2023-12-15 20:14:26 -0700 | [diff] [blame] | 197 | * boot_run() - Run the entire bootm/booti/bootz process |
| 198 | * |
| 199 | * This runs through the boot process from start to finish, with a base set of |
| 200 | * states, along with the extra ones supplied. |
| 201 | * |
| 202 | * This uses bootm_run_states(). |
| 203 | * |
| 204 | * Note that it is normally easier to use bootm_run(), etc. since they handle |
| 205 | * the extra states correctly. |
| 206 | * |
| 207 | * @bmi: bootm information |
| 208 | * @cmd: command being run, NULL if none |
| 209 | * @extra_states: Mask of extra states to use for the boot |
| 210 | * Return: 0 if ok, something else on error |
| 211 | */ |
| 212 | int boot_run(struct bootm_info *bmi, const char *cmd, int extra_states); |
| 213 | |
| 214 | /** |
Simon Glass | bd73cac | 2023-12-15 20:14:21 -0700 | [diff] [blame] | 215 | * bootm_run() - Run the entire bootm process |
| 216 | * |
| 217 | * This runs through the bootm process from start to finish, using the default |
| 218 | * set of states. |
| 219 | * |
| 220 | * This uses bootm_run_states(). |
| 221 | * |
| 222 | * @bmi: bootm information |
| 223 | * Return: 0 if ok, something else on error |
| 224 | */ |
| 225 | int bootm_run(struct bootm_info *bmi); |
| 226 | |
Simon Glass | e176bb1 | 2023-12-15 20:14:23 -0700 | [diff] [blame] | 227 | /** |
| 228 | * bootz_run() - Run the entire bootz process |
| 229 | * |
| 230 | * This runs through the bootz process from start to finish, using the default |
| 231 | * set of states. |
| 232 | * |
| 233 | * This uses bootm_run_states(). |
| 234 | * |
| 235 | * @bmi: bootm information |
| 236 | * Return: 0 if ok, something else on error |
| 237 | */ |
| 238 | int bootz_run(struct bootm_info *bmi); |
| 239 | |
Simon Glass | 2d043a6 | 2023-12-15 20:14:25 -0700 | [diff] [blame] | 240 | /** |
| 241 | * booti_run() - Run the entire booti process |
| 242 | * |
| 243 | * This runs through the booti process from start to finish, using the default |
| 244 | * set of states. |
| 245 | * |
| 246 | * This uses bootm_run_states(). |
| 247 | * |
| 248 | * @bmi: bootm information |
| 249 | * Return: 0 if ok, something else on error |
| 250 | */ |
| 251 | int booti_run(struct bootm_info *bmi); |
| 252 | |
Jeroen Hofstee | 7ade3de | 2014-10-08 22:58:00 +0200 | [diff] [blame] | 253 | void arch_preboot_os(void); |
| 254 | |
Simon Glass | c9b2e23 | 2018-05-16 09:42:26 -0600 | [diff] [blame] | 255 | /* |
| 256 | * boards should define this to disable devices when EFI exits from boot |
| 257 | * services. |
| 258 | * |
| 259 | * TODO(sjg@chromium.org>): Update this to use driver model's device_remove(). |
| 260 | */ |
Simon Glass | f55305a | 2018-05-16 09:42:25 -0600 | [diff] [blame] | 261 | void board_quiesce_devices(void); |
| 262 | |
Heinrich Schuchardt | aa0b11b | 2019-01-08 18:13:06 +0100 | [diff] [blame] | 263 | /** |
| 264 | * switch_to_non_secure_mode() - switch to non-secure mode |
| 265 | */ |
| 266 | void switch_to_non_secure_mode(void); |
| 267 | |
Simon Glass | 63660dc | 2020-11-05 10:33:44 -0700 | [diff] [blame] | 268 | /* Flags to control bootm_process_cmdline() */ |
| 269 | enum bootm_cmdline_t { |
| 270 | BOOTM_CL_SILENT = 1 << 0, /* Do silent console processing */ |
Simon Glass | 529e208 | 2020-11-05 10:33:48 -0700 | [diff] [blame] | 271 | BOOTM_CL_SUBST = 1 << 1, /* Do substitution */ |
Simon Glass | 63660dc | 2020-11-05 10:33:44 -0700 | [diff] [blame] | 272 | |
Simon Glass | 529e208 | 2020-11-05 10:33:48 -0700 | [diff] [blame] | 273 | BOOTM_CL_ALL = 3, /* All substitutions */ |
Simon Glass | 63660dc | 2020-11-05 10:33:44 -0700 | [diff] [blame] | 274 | }; |
| 275 | |
Heinrich Schuchardt | 25828e9 | 2020-09-15 01:58:11 +0200 | [diff] [blame] | 276 | /** |
| 277 | * arch_preboot_os() - arch specific configuration before booting |
| 278 | */ |
| 279 | void arch_preboot_os(void); |
| 280 | |
| 281 | /** |
| 282 | * board_preboot_os() - board specific configuration before booting |
| 283 | */ |
| 284 | void board_preboot_os(void); |
| 285 | |
Simon Glass | 2eab017 | 2020-11-05 10:33:39 -0700 | [diff] [blame] | 286 | /* |
Simon Glass | b4e1b6d | 2020-11-05 10:33:45 -0700 | [diff] [blame] | 287 | * bootm_process_cmdline() - Process fix-ups for the command line |
| 288 | * |
Simon Glass | 529e208 | 2020-11-05 10:33:48 -0700 | [diff] [blame] | 289 | * This handles: |
| 290 | * |
| 291 | * - making Linux boot silently if requested ('silent_linux' envvar) |
| 292 | * - performing substitutions in the command line ('bootargs_subst' envvar) |
Simon Glass | b4e1b6d | 2020-11-05 10:33:45 -0700 | [diff] [blame] | 293 | * |
| 294 | * @maxlen must provide enough space for the string being processed plus the |
| 295 | * resulting string |
| 296 | * |
| 297 | * @buf: buffer holding commandline string to adjust |
| 298 | * @maxlen: Maximum length of buffer at @buf (including \0) |
| 299 | * @flags: Flags to control what happens (see bootm_cmdline_t) |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 300 | * Return: 0 if OK, -ENOMEM if out of memory, -ENOSPC if the commandline is too |
Simon Glass | b4e1b6d | 2020-11-05 10:33:45 -0700 | [diff] [blame] | 301 | * long |
| 302 | */ |
| 303 | int bootm_process_cmdline(char *buf, int maxlen, int flags); |
| 304 | |
| 305 | /** |
Simon Glass | a50b6dd | 2020-11-05 10:33:40 -0700 | [diff] [blame] | 306 | * bootm_process_cmdline_env() - Process fix-ups for the command line |
Simon Glass | 2eab017 | 2020-11-05 10:33:39 -0700 | [diff] [blame] | 307 | * |
Simon Glass | 529e208 | 2020-11-05 10:33:48 -0700 | [diff] [blame] | 308 | * Updates the 'bootargs' envvar as required. This handles: |
| 309 | * |
| 310 | * - making Linux boot silently if requested ('silent_linux' envvar) |
| 311 | * - performing substitutions in the command line ('bootargs_subst' envvar) |
Simon Glass | 2eab017 | 2020-11-05 10:33:39 -0700 | [diff] [blame] | 312 | * |
Simon Glass | 63660dc | 2020-11-05 10:33:44 -0700 | [diff] [blame] | 313 | * @flags: Flags to control what happens (see bootm_cmdline_t) |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 314 | * Return: 0 if OK, -ENOMEM if out of memory |
Simon Glass | 2eab017 | 2020-11-05 10:33:39 -0700 | [diff] [blame] | 315 | */ |
Simon Glass | 63660dc | 2020-11-05 10:33:44 -0700 | [diff] [blame] | 316 | int bootm_process_cmdline_env(int flags); |
Simon Glass | 07a8886 | 2020-11-05 10:33:38 -0700 | [diff] [blame] | 317 | |
Simon Glass | 4493d61 | 2023-07-30 11:16:53 -0600 | [diff] [blame] | 318 | /** |
Simon Glass | 92beb243 | 2025-03-05 17:25:14 -0700 | [diff] [blame] | 319 | * zboot_run() - Run through the various steps to boot a zimage |
| 320 | * |
| 321 | * @bmi: Bootm information, with bzimage_size, initrd_addr, initrd_size and |
| 322 | * cmdline set up. If base_ptr is 0, then bzimage_addr must be set to the start |
| 323 | * of the bzImage. Otherwise base_ptr and load_address must be provided. |
| 324 | */ |
| 325 | int zboot_run(struct bootm_info *bmi); |
| 326 | |
| 327 | /** |
Simon Glass | 0951937 | 2025-03-05 17:24:56 -0700 | [diff] [blame] | 328 | * zboot_run_args() - Run through the various steps to boot a zimage |
Simon Glass | 4493d61 | 2023-07-30 11:16:53 -0600 | [diff] [blame] | 329 | * |
| 330 | * Boot a zimage, given the component parts |
| 331 | * |
| 332 | * @addr: Address where the bzImage is moved before booting, either |
| 333 | * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR |
Simon Glass | 166e79a | 2023-12-03 17:29:38 -0700 | [diff] [blame] | 334 | * @size: Size of bzImage, or 0 to detect this |
Simon Glass | 4493d61 | 2023-07-30 11:16:53 -0600 | [diff] [blame] | 335 | * @initrd: Address of the initial ramdisk, or 0 if none |
| 336 | * @initrd_size: Size of the initial ramdisk, or 0 if none |
Simon Glass | 166e79a | 2023-12-03 17:29:38 -0700 | [diff] [blame] | 337 | * @base_addr: If non-zero, this indicates that the boot parameters have already |
| 338 | * been loaded by the caller to this address, so the load_zimage() call |
| 339 | * in zboot_load() will be skipped when booting |
| 340 | * @cmdline: If non-NULL, the environment variable containing the command line |
| 341 | * to use for booting |
Simon Glass | 4493d61 | 2023-07-30 11:16:53 -0600 | [diff] [blame] | 342 | * Return: -EFAULT on error (normally it does not return) |
| 343 | */ |
Simon Glass | 0951937 | 2025-03-05 17:24:56 -0700 | [diff] [blame] | 344 | int zboot_run_args(ulong addr, ulong size, ulong initrd, ulong initrd_size, |
| 345 | ulong base, char *cmdline); |
Simon Glass | 4493d61 | 2023-07-30 11:16:53 -0600 | [diff] [blame] | 346 | |
| 347 | /* |
| 348 | * zimage_get_kernel_version() - Get the version string from a kernel |
| 349 | * |
| 350 | * @params: boot_params pointer |
| 351 | * @kernel_base: base address of kernel |
| 352 | * Return: Kernel version as a NUL-terminated string |
| 353 | */ |
| 354 | const char *zimage_get_kernel_version(struct boot_params *params, |
| 355 | void *kernel_base); |
| 356 | |
Simon Glass | 5495aaf | 2023-07-30 11:17:00 -0600 | [diff] [blame] | 357 | /** |
| 358 | * zimage_dump() - Dump the metadata of a zimage |
| 359 | * |
| 360 | * This shows all available information in a zimage that has been loaded. |
| 361 | * |
Simon Glass | e3b0def | 2025-03-05 17:25:02 -0700 | [diff] [blame] | 362 | * @bmi: Bootm information, with valid base_ptr |
Simon Glass | 5495aaf | 2023-07-30 11:17:00 -0600 | [diff] [blame] | 363 | * @show_cmdline: true to show the full command line |
| 364 | */ |
Simon Glass | e3b0def | 2025-03-05 17:25:02 -0700 | [diff] [blame] | 365 | void zimage_dump(struct bootm_info *bmi, bool show_cmdline); |
Simon Glass | 5495aaf | 2023-07-30 11:17:00 -0600 | [diff] [blame] | 366 | |
Simon Glass | 1870026 | 2023-07-30 11:17:02 -0600 | [diff] [blame] | 367 | /* |
| 368 | * bootm_boot_start() - Boot an image at the given address |
| 369 | * |
| 370 | * @addr: Image address |
Tom Rini | 793921e | 2024-04-18 08:29:35 -0600 | [diff] [blame] | 371 | * @cmdline: Command line to set |
Simon Glass | 1870026 | 2023-07-30 11:17:02 -0600 | [diff] [blame] | 372 | */ |
| 373 | int bootm_boot_start(ulong addr, const char *cmdline); |
| 374 | |
Simon Glass | 3b5866d | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 375 | #endif |