summaryrefslogtreecommitdiff
path: root/boot/fdt_support.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-01-14 15:43:07 -0600
committerTom Rini <trini@konsulko.com>2025-01-14 15:44:44 -0600
commite5ce3b44cc85cadb4b5a79b64838c85222cc16ef (patch)
treeb7285749252b59eec2113dc123346e2d805ff883 /boot/fdt_support.c
parent5c72a2afbfedeffefe48d1b67c7effb379f90669 (diff)
parent1cfdac985298c65480bd2517ac4d6efb9337e89a (diff)
Merge patch series "fdt_support: improve board_fdt_chosen_bootargs() for flexibility"
Dmitry Rokosov <ddrokosov@salutedevices.com> says: This series consists of three patches. The first patch modifies the function documentation style in the include/fdt_support.h file to comply with kernel-doc requirements. The second patch modifies the board_fdt_chosen_bootargs() function to return a const char* type. This change clarifies to the caller that the returned string should neither be freed nor modified. It aligns with the existing fdt_setprop() function, which already utilizes a const char* parameter. This promotes consistency within the codebase and enhances code safety by preventing unintended modifications to the returned string. The third patch addresses the need for flexibility in providing kernel command line arguments (bootargs) for different kernel images within the same U-Boot environment. It introduces a read-only (RO) fdt_property argument to the board_fdt_chosen_bootargs() function, allowing access to the original chosen/bootargs data. This is crucial for scenarios where different kernel versions require distinct console setups (e.g., ttyS0 for vendor kernels and ttyAML0 for upstream kernels). By enabling board developers to either merge or replace the original bootargs, this patch enhances the configurability of U-Boot for various kernel images without relying on outdated configurations like CMDLINE_EXTEND. CI/CD results: https://github.com/u-boot/u-boot/pull/716/checks Link: https://lore.kernel.org/r/20241220-board_fdt_chosen_bootargs_improvements-v1-0-f6a7181787c5@salutedevices.com
Diffstat (limited to 'boot/fdt_support.c')
-rw-r--r--boot/fdt_support.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/boot/fdt_support.c b/boot/fdt_support.c
index 2392027d40b..49efeec3681 100644
--- a/boot/fdt_support.c
+++ b/boot/fdt_support.c
@@ -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 char *board_fdt_chosen_bootargs(void)
+__weak const char *board_fdt_chosen_bootargs(const struct fdt_property *fdt_ba)
{
return env_get("bootargs");
}
@@ -331,7 +331,7 @@ int fdt_chosen(void *fdt)
struct abuf buf = {};
int nodeoffset;
int err;
- char *str; /* used to set string properties */
+ const char *str; /* used to set string properties */
err = fdt_check_header(fdt);
if (err < 0) {
@@ -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,