mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-21 04:14:34 +00:00
fdt: Set kernaddr if fdt indicates a kernel is present
If kernel-offset is specified in the fdt, set an environment variable so that scripts can access the attached kernel. This can be used by a packaging program to tell U-Boot about a kernel that has been downloaded alongside U-Boot. The value in the fdt is the offset of the kernel from the start of the U-Boot image, so we can find it just by adding CONFIG_SYS_TEXT_BASE. It is then fairly easy to put something like this in the environment variables in the board header file: "if test ${kernaddr} != \"\"; then "\ "echo \"Using bundled kernel\"; "\ "bootm ${kernaddr};" \ "fi; "\ /* rest of boot sequence follows here */ Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
d95f6ec733
commit
fcabc24f4f
1 changed files with 16 additions and 0 deletions
|
@ -333,6 +333,20 @@ err:
|
||||||
hang();
|
hang();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void process_fdt_options(const void *blob)
|
||||||
|
{
|
||||||
|
ulong addr;
|
||||||
|
|
||||||
|
/* Add an env variable to point to a kernel payload, if available */
|
||||||
|
addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
|
||||||
|
if (addr)
|
||||||
|
setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
|
||||||
|
|
||||||
|
/* Add an env variable to point to a root disk, if available */
|
||||||
|
addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
|
||||||
|
if (addr)
|
||||||
|
setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
|
||||||
|
}
|
||||||
#endif /* CONFIG_OF_CONTROL */
|
#endif /* CONFIG_OF_CONTROL */
|
||||||
|
|
||||||
|
|
||||||
|
@ -451,6 +465,8 @@ void main_loop (void)
|
||||||
if (env)
|
if (env)
|
||||||
s = env;
|
s = env;
|
||||||
|
|
||||||
|
process_fdt_options(gd->fdt_blob);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the bootsecure option was chosen, use secure_boot_cmd().
|
* If the bootsecure option was chosen, use secure_boot_cmd().
|
||||||
* Always use 'env' in this case, since bootsecure requres that the
|
* Always use 'env' in this case, since bootsecure requres that the
|
||||||
|
|
Loading…
Add table
Reference in a new issue