mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-11 07:24:46 +00:00
common: fdt: hand over original fdt bootargs into board chosen handler
Sometimes, it is necessary to provide an additional bootargs string to the kernel command line. We have a real scenario where one U-Boot blob needs to boot several kernel images: the vendor-patched kernel image and the latest upstream kernel image. The Amlogic (Meson architecture) tty driver has different tty suffixes in these kernels: the vendor uses 'ttySx', while the upstream implementation uses 'ttyAMLx'. The initial console setup is provided to the kernel using the kernel command line (bootargs). For the vendor kernel, we should use 'console=ttyS0,115200', while for the upstream kernel, it must be 'console=ttyAML0,115200'. This means we have to use different command line strings depending on the kernel version. To resolve this issue, we cannot use the CMDLINE_EXTEND kernel configuration because it is considered legacy and is not supported for the arm64 architecture. CMDLINE_EXTEND is outdated primarily because we can provide additional command line strings through the 'chosen/bootargs' FDT node. However, U-Boot uses this node to inject the U-Boot bootargs environment variable content, which results in U-Boot silently overriding all data in the 'chosen/bootargs' node. While we do have the board_fdt_chosen_bootargs() board hook to address such issues, this function lacks any FDT context, such as the original value of the 'chosen/bootargs' node. This patch introduces a read-only (RO) fdt_property argument to board_fdt_chosen_bootargs() to share the original 'chosen/bootargs' data with the board code. Consequently, the board developer can decide how to handle this information for their board setup: whether to drop it or merge it with the bootargs environment. Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
This commit is contained in:
parent
c39257c131
commit
1cfdac9852
2 changed files with 6 additions and 3 deletions
|
@ -321,7 +321,7 @@ int fdt_kaslrseed(void *fdt, bool overwrite)
|
|||
* board_fdt_chosen_bootargs - boards may override this function to use
|
||||
* alternative kernel command line arguments
|
||||
*/
|
||||
__weak const char *board_fdt_chosen_bootargs(void)
|
||||
__weak const char *board_fdt_chosen_bootargs(const struct fdt_property *fdt_ba)
|
||||
{
|
||||
return env_get("bootargs");
|
||||
}
|
||||
|
@ -364,7 +364,8 @@ int fdt_chosen(void *fdt)
|
|||
}
|
||||
}
|
||||
|
||||
str = board_fdt_chosen_bootargs();
|
||||
str = board_fdt_chosen_bootargs(fdt_get_property(fdt, nodeoffset,
|
||||
"bootargs", NULL));
|
||||
|
||||
if (str) {
|
||||
err = fdt_setprop(fdt, nodeoffset, "bootargs", str,
|
||||
|
|
|
@ -231,12 +231,14 @@ int board_rng_seed(struct abuf *buf);
|
|||
/**
|
||||
* board_fdt_chosen_bootargs() - arbitrarily amend fdt kernel command line
|
||||
*
|
||||
* @fdt_ba: FDT chosen/bootargs from the kernel image if available
|
||||
*
|
||||
* This is used for late modification of kernel command line arguments just
|
||||
* before they are added into the /chosen node in flat device tree.
|
||||
*
|
||||
* Return: pointer to kernel command line arguments in memory
|
||||
*/
|
||||
const char *board_fdt_chosen_bootargs(void);
|
||||
const char *board_fdt_chosen_bootargs(const struct fdt_property *fdt_ba);
|
||||
|
||||
/*
|
||||
* The keystone2 SOC requires all 32 bit aliased addresses to be converted
|
||||
|
|
Loading…
Add table
Reference in a new issue