diff options
author | Niko Mauno <niko.mauno@vaisala.com> | 2021-02-22 19:18:51 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-05-04 11:53:17 -0400 |
commit | 9a2d490dbdf09a0be99acfc50124e8e98d242653 (patch) | |
tree | 8fef9c6893e93c6ed7cee0cc0adcda2edfa4e56f | |
parent | e78c19512707f046d674d430cd40b405c4a165b9 (diff) | |
download | u-boot-WIP/2021-04-04-misc-updates.zip u-boot-WIP/2021-04-04-misc-updates.tar.gz u-boot-WIP/2021-04-04-misc-updates.tar.bz2 |
fdt_support.c: Allow late kernel cmdline modificationWIP/2021-04-04-misc-updates
By declaring board-specific board_fdt_chosen_bootargs() the kernel
command line arguments can be adjusted before injecting to flat dt
chosen node.
Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
-rw-r--r-- | common/fdt_support.c | 12 | ||||
-rw-r--r-- | include/fdt_support.h | 10 |
2 files changed, 21 insertions, 1 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c index e624bbd..7eb5ba3 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -269,6 +269,15 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end) return 0; } +/** + * board_fdt_chosen_bootargs - boards may override this function to use + * alternative kernel command line arguments + */ +__weak char *board_fdt_chosen_bootargs(void) +{ + return env_get("bootargs"); +} + int fdt_chosen(void *fdt) { int nodeoffset; @@ -286,7 +295,8 @@ int fdt_chosen(void *fdt) if (nodeoffset < 0) return nodeoffset; - str = env_get("bootargs"); + str = board_fdt_chosen_bootargs(); + if (str) { err = fdt_setprop(fdt, nodeoffset, "bootargs", str, strlen(str) + 1); diff --git a/include/fdt_support.h b/include/fdt_support.h index 46eb1db..e2a4689 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -185,6 +185,16 @@ int fdt_find_or_add_subnode(void *fdt, int parentoffset, const char *name); */ int ft_board_setup(void *blob, struct bd_info *bd); +/** + * board_fdt_chosen_bootargs() - Arbitrarily amend fdt kernel command line + * + * 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 + */ +char *board_fdt_chosen_bootargs(void); + /* * The keystone2 SOC requires all 32 bit aliased addresses to be converted * to their 36 physical format. This has to happen after all fdt nodes |