Since FIT image specification v0.9, it is now possible to pass command line arguments for the next boot stage in FIT images.
Add parsing of the cmdline optional property when reading the fitimage. Create a `linux.bootargs.dyn.bootentries.fit` global variable that will be appended to the command line when CONFIG_FLEXIBLE_BOOTARGS is enabled. Signed-off-by: Thomas Bonnefille <[email protected]> --- common/bootm-fit.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/bootm-fit.c b/common/bootm-fit.c index f7742b8717..c7142f490f 100644 --- a/common/bootm-fit.c +++ b/common/bootm-fit.c @@ -3,6 +3,7 @@ #include <bootm.h> #include <image-fit.h> #include <bootm-fit.h> +#include <globalvar.h> #include <memory.h> #include <string.h> #include <zero_page.h> @@ -97,6 +98,21 @@ static bool bootm_fit_config_valid(struct fit_handle *fit, return !!fit_has_image(fit, config, "kernel"); } +static void bootm_fit_config_cmdline(struct device_node *config) +{ + const char *cmdline; + + if (!IS_ENABLED(CONFIG_FLEXIBLE_BOOTARGS)) + return; + + if (of_property_read_string(config, "cmdline", &cmdline)) + return; + + globalvar_add_simple("linux.bootargs.dyn.bootentries.fit", cmdline); + + pr_info("Using command line from FIT configuration: %s\n", cmdline); +} + static enum filetype bootm_fit_update_os_header(struct image_data *data) { size_t size; @@ -146,6 +162,8 @@ int bootm_open_fit(struct image_data *data, bool override) goto err; } + bootm_fit_config_cmdline(fit_config); + loadable_from_fit_os(data, fit, fit_config); if (override) data->is_override.os = true; -- 2.55.0
