2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2014-06-12 13:24:46 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2000-2009
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BOOTM_H
|
|
|
|
#define _BOOTM_H
|
|
|
|
|
|
|
|
#include <image.h>
|
|
|
|
|
2023-07-30 17:16:53 +00:00
|
|
|
struct boot_params;
|
2020-05-10 17:40:03 +00:00
|
|
|
struct cmd_tbl;
|
|
|
|
|
2014-06-12 13:24:46 +00:00
|
|
|
#define BOOTM_ERR_RESET (-1)
|
|
|
|
#define BOOTM_ERR_OVERLAP (-2)
|
|
|
|
#define BOOTM_ERR_UNIMPLEMENTED (-3)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Continue booting an OS image; caller already has:
|
|
|
|
* - copied image header to global variable `header'
|
|
|
|
* - checked header magic number, checksums (both header & image),
|
|
|
|
* - verified image architecture (PPC) and type (KERNEL or MULTI),
|
|
|
|
* - loaded (first part of) image to header load address,
|
|
|
|
* - disabled interrupts.
|
|
|
|
*
|
|
|
|
* @flag: Flags indicating what to do (BOOTM_STATE_...)
|
|
|
|
* @argc: Number of arguments. Note that the arguments are shifted down
|
|
|
|
* so that 0 is the first argument not processed by U-Boot, and
|
|
|
|
* argc is adjusted accordingly. This avoids confusion as to how
|
|
|
|
* many arguments are available for the OS.
|
|
|
|
* @images: Pointers to os/initrd/fdt
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 1 on error. On success the OS boots so this function does
|
2014-06-12 13:24:46 +00:00
|
|
|
* not return.
|
|
|
|
*/
|
2020-05-10 17:40:03 +00:00
|
|
|
typedef int boot_os_fn(int flag, int argc, char *const argv[],
|
2022-09-07 02:26:50 +00:00
|
|
|
struct bootm_headers *images);
|
2014-06-12 13:24:46 +00:00
|
|
|
|
|
|
|
extern boot_os_fn do_bootm_linux;
|
2018-12-21 15:13:40 +00:00
|
|
|
extern boot_os_fn do_bootm_vxworks;
|
|
|
|
|
2020-05-10 17:40:03 +00:00
|
|
|
int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
|
2014-06-12 13:24:46 +00:00
|
|
|
|
|
|
|
boot_os_fn *bootm_os_get_boot_func(int os);
|
|
|
|
|
2019-05-03 20:37:05 +00:00
|
|
|
#if defined(CONFIG_FIT_SIGNATURE)
|
2014-06-12 13:24:53 +00:00
|
|
|
int bootm_host_load_images(const void *fit, int cfg_noffset);
|
2019-05-03 20:37:05 +00:00
|
|
|
#endif
|
2014-06-12 13:24:53 +00:00
|
|
|
|
2020-05-10 17:40:03 +00:00
|
|
|
int boot_selected_os(int argc, char *const argv[], int state,
|
2022-09-07 02:26:50 +00:00
|
|
|
struct bootm_headers *images, boot_os_fn *boot_fn);
|
2014-06-12 13:24:46 +00:00
|
|
|
|
|
|
|
ulong bootm_disable_interrupts(void);
|
|
|
|
|
2014-08-14 10:42:36 +00:00
|
|
|
/* This is a special function used by booti/bootz */
|
2020-06-12 12:41:20 +00:00
|
|
|
int bootm_find_images(int flag, int argc, char *const argv[], ulong start,
|
|
|
|
ulong size);
|
2014-06-12 13:24:46 +00:00
|
|
|
|
2020-05-10 17:40:03 +00:00
|
|
|
int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
|
2022-09-07 02:26:50 +00:00
|
|
|
char *const argv[], int states, struct bootm_headers *images,
|
2020-05-10 17:40:03 +00:00
|
|
|
int boot_progress);
|
2014-06-12 13:24:46 +00:00
|
|
|
|
2014-10-08 20:58:00 +00:00
|
|
|
void arch_preboot_os(void);
|
|
|
|
|
2018-05-16 15:42:26 +00:00
|
|
|
/*
|
|
|
|
* boards should define this to disable devices when EFI exits from boot
|
|
|
|
* services.
|
|
|
|
*
|
|
|
|
* TODO(sjg@chromium.org>): Update this to use driver model's device_remove().
|
|
|
|
*/
|
2018-05-16 15:42:25 +00:00
|
|
|
void board_quiesce_devices(void);
|
|
|
|
|
2019-01-08 17:13:06 +00:00
|
|
|
/**
|
|
|
|
* switch_to_non_secure_mode() - switch to non-secure mode
|
|
|
|
*/
|
|
|
|
void switch_to_non_secure_mode(void);
|
|
|
|
|
2020-11-05 17:33:44 +00:00
|
|
|
/* Flags to control bootm_process_cmdline() */
|
|
|
|
enum bootm_cmdline_t {
|
|
|
|
BOOTM_CL_SILENT = 1 << 0, /* Do silent console processing */
|
2020-11-05 17:33:48 +00:00
|
|
|
BOOTM_CL_SUBST = 1 << 1, /* Do substitution */
|
2020-11-05 17:33:44 +00:00
|
|
|
|
2020-11-05 17:33:48 +00:00
|
|
|
BOOTM_CL_ALL = 3, /* All substitutions */
|
2020-11-05 17:33:44 +00:00
|
|
|
};
|
|
|
|
|
2020-09-14 23:58:11 +00:00
|
|
|
/**
|
|
|
|
* arch_preboot_os() - arch specific configuration before booting
|
|
|
|
*/
|
|
|
|
void arch_preboot_os(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* board_preboot_os() - board specific configuration before booting
|
|
|
|
*/
|
|
|
|
void board_preboot_os(void);
|
|
|
|
|
2020-11-05 17:33:39 +00:00
|
|
|
/*
|
2020-11-05 17:33:45 +00:00
|
|
|
* bootm_process_cmdline() - Process fix-ups for the command line
|
|
|
|
*
|
2020-11-05 17:33:48 +00:00
|
|
|
* This handles:
|
|
|
|
*
|
|
|
|
* - making Linux boot silently if requested ('silent_linux' envvar)
|
|
|
|
* - performing substitutions in the command line ('bootargs_subst' envvar)
|
2020-11-05 17:33:45 +00:00
|
|
|
*
|
|
|
|
* @maxlen must provide enough space for the string being processed plus the
|
|
|
|
* resulting string
|
|
|
|
*
|
|
|
|
* @buf: buffer holding commandline string to adjust
|
|
|
|
* @maxlen: Maximum length of buffer at @buf (including \0)
|
|
|
|
* @flags: Flags to control what happens (see bootm_cmdline_t)
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 0 if OK, -ENOMEM if out of memory, -ENOSPC if the commandline is too
|
2020-11-05 17:33:45 +00:00
|
|
|
* long
|
|
|
|
*/
|
|
|
|
int bootm_process_cmdline(char *buf, int maxlen, int flags);
|
|
|
|
|
|
|
|
/**
|
2020-11-05 17:33:40 +00:00
|
|
|
* bootm_process_cmdline_env() - Process fix-ups for the command line
|
2020-11-05 17:33:39 +00:00
|
|
|
*
|
2020-11-05 17:33:48 +00:00
|
|
|
* Updates the 'bootargs' envvar as required. This handles:
|
|
|
|
*
|
|
|
|
* - making Linux boot silently if requested ('silent_linux' envvar)
|
|
|
|
* - performing substitutions in the command line ('bootargs_subst' envvar)
|
2020-11-05 17:33:39 +00:00
|
|
|
*
|
2020-11-05 17:33:44 +00:00
|
|
|
* @flags: Flags to control what happens (see bootm_cmdline_t)
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: 0 if OK, -ENOMEM if out of memory
|
2020-11-05 17:33:39 +00:00
|
|
|
*/
|
2020-11-05 17:33:44 +00:00
|
|
|
int bootm_process_cmdline_env(int flags);
|
2020-11-05 17:33:38 +00:00
|
|
|
|
2023-07-30 17:16:53 +00:00
|
|
|
/**
|
|
|
|
* zboot_start() - Boot a zimage
|
|
|
|
*
|
|
|
|
* Boot a zimage, given the component parts
|
|
|
|
*
|
|
|
|
* @addr: Address where the bzImage is moved before booting, either
|
|
|
|
* BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR
|
|
|
|
* @base: Pointer to the boot parameters, typically at address
|
|
|
|
* DEFAULT_SETUP_BASE
|
|
|
|
* @initrd: Address of the initial ramdisk, or 0 if none
|
|
|
|
* @initrd_size: Size of the initial ramdisk, or 0 if none
|
|
|
|
* @cmdline: Command line to use for booting
|
|
|
|
* Return: -EFAULT on error (normally it does not return)
|
|
|
|
*/
|
|
|
|
int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size,
|
|
|
|
ulong base, char *cmdline);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* zimage_get_kernel_version() - Get the version string from a kernel
|
|
|
|
*
|
|
|
|
* @params: boot_params pointer
|
|
|
|
* @kernel_base: base address of kernel
|
|
|
|
* Return: Kernel version as a NUL-terminated string
|
|
|
|
*/
|
|
|
|
const char *zimage_get_kernel_version(struct boot_params *params,
|
|
|
|
void *kernel_base);
|
|
|
|
|
2023-07-30 17:17:00 +00:00
|
|
|
/**
|
|
|
|
* zimage_dump() - Dump the metadata of a zimage
|
|
|
|
*
|
|
|
|
* This shows all available information in a zimage that has been loaded.
|
|
|
|
*
|
|
|
|
* @base_ptr: Pointer to the boot parameters, typically at address
|
|
|
|
* DEFAULT_SETUP_BASE
|
|
|
|
* @show_cmdline: true to show the full command line
|
|
|
|
*/
|
|
|
|
void zimage_dump(struct boot_params *base_ptr, bool show_cmdline);
|
|
|
|
|
2023-07-30 17:17:02 +00:00
|
|
|
/*
|
|
|
|
* bootm_boot_start() - Boot an image at the given address
|
|
|
|
*
|
|
|
|
* @addr: Image address
|
|
|
|
* @cmdline: Command line to set
|
|
|
|
*/
|
|
|
|
int bootm_boot_start(ulong addr, const char *cmdline);
|
|
|
|
|
2014-06-12 13:24:46 +00:00
|
|
|
#endif
|