boot: Read environment variables at start

Some environment variables affect the operation of bootm. Reading these
variables is buried within the boot code at present.

Ideally this information should be in struct bootm_info so that it can
be provided directly, without needing the environment variables. Also it
should support allocation if the variables are not provided.

As a first step towards this, add an explicit read of the variables,
storing the values. For now this only covers kernel_comp_addr_r and
kernel_comp_size

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-08-11 06:18:50 -06:00
parent 751381658b
commit 7618b665a7
4 changed files with 30 additions and 5 deletions

View File

@@ -58,6 +58,10 @@ enum bootm_final_t {
* @argv: NULL-terminated list of arguments, or NULL if there are no arguments
* @ignore_bootm_len: Ignore the value CONFIG_SYS_BOOTM_LEN and use 10x the
* compressed length as the maximum uncompressed size
* @kern_comp_addr: Address to decompress the kernel to, if needed. If 0, space
* is reserved using lmb and this value is updated
* @kern_comp_size: Maximum size of the decompressed kernel. If 0, the size is
* calculated based on 4x the size of the kernel, up to a limit of 1G
*
* For zboot:
* @bzimage_addr: Address of the bzImage to boot, or 0 if the image has already
@@ -84,6 +88,8 @@ struct bootm_info {
int argc;
char *const *argv;
bool ignore_bootm_len;
ulong kern_comp_addr;
ulong kern_comp_size;
/* zboot items */
#ifdef CONFIG_X86
@@ -174,6 +180,16 @@ static inline ulong bootm_len(void)
return 0;
}
/**
* bootm_read_env() - Read environment variables used during the boot
*
* If bootm needs to decompress a kernel, it can use the 'kernel_comp_addr_r'
* and 'kernel_comp_size' variables to specify a region to decompress into.
* Call this function after bootm_init() to set up these variables. Otherwise,
* space will be reserved using lmb
*/
void bootm_read_env(struct bootm_info *bmi);
/**
* bootm_init() - Set up a bootm_info struct with useful defaults
*