* [PATCH] bootstd: android: add the bootargs env to the commandline
@ 2025-10-24 14:23 Guillaume La Roque (TI.com)
2025-10-31 15:18 ` Mattijs Korpershoek
2025-11-06 9:20 ` Mattijs Korpershoek
0 siblings, 2 replies; 3+ messages in thread
From: Guillaume La Roque (TI.com) @ 2025-10-24 14:23 UTC (permalink / raw)
To: u-boot
Cc: Simon Glass, Mattijs Korpershoek, Tom Rini, Julien Masson,
Nicolas Belin (TI.com), Jerome Forissier, george chan,
Guillaume La Roque (TI.com)
From: "Nicolas Belin (TI.com)" <nbelin@baylibre.com>
When previously using script based bootflows, the U-Boot
environment variable bootargs was used to customize the kernel
commandline at boot time.
In order to get the same behaviour, concatenate the bootflow
commandline with the contents the bootargs environment variable.
Signed-off-by: Nicolas Belin (TI.com) <nbelin@baylibre.com>
Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
---
boot/bootmeth_android.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
index 8c2bde10e17..1374551dbeb 100644
--- a/boot/bootmeth_android.c
+++ b/boot/bootmeth_android.c
@@ -512,6 +512,37 @@ static int run_avb_verification(struct bootflow *bflow)
}
#endif /* AVB_VERIFY */
+static int append_bootargs_to_cmdline(struct bootflow *bflow)
+{
+ char *bootargs;
+ int len = 0;
+
+ /*
+ * Check any additionnal bootargs coming from U-Boot env. If any,
+ * merge them with the current cmdline
+ */
+ bootargs = env_get("bootargs");
+ if (bootargs) {
+ len += strlen(bootargs) + 1; /* Extra space character needed */
+ len += strlen(bflow->cmdline);
+
+ char *newcmdline = malloc(len + 1); /* +1 for the '\0' */
+
+ if (!newcmdline)
+ return log_msg_ret("newcmdline malloc", -ENOMEM);
+
+ strcpy(newcmdline, bootargs);
+ strcat(newcmdline, " ");
+ strcat(newcmdline, bflow->cmdline);
+
+ /* Free the previous cmdline and replace it */
+ free(bflow->cmdline);
+ bflow->cmdline = newcmdline;
+ }
+
+ return 0;
+}
+
static int boot_android_normal(struct bootflow *bflow)
{
struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
@@ -546,6 +577,10 @@ static int boot_android_normal(struct bootflow *bflow)
if (priv->slot)
free(priv->slot);
+ ret = append_bootargs_to_cmdline(bflow);
+ if (ret < 0)
+ return log_msg_ret("bootargs append", ret);
+
ret = bootm_boot_start(loadaddr, bflow->cmdline);
return log_msg_ret("boot", ret);
---
base-commit: b10c055d4e1b5153a331a61ef82a5b01b5bb4c45
change-id: 20251024-botargsappend-38a4371cb6dc
Best regards,
--
Guillaume La Roque (TI.com) <glaroque@baylibre.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] bootstd: android: add the bootargs env to the commandline
2025-10-24 14:23 [PATCH] bootstd: android: add the bootargs env to the commandline Guillaume La Roque (TI.com)
@ 2025-10-31 15:18 ` Mattijs Korpershoek
2025-11-06 9:20 ` Mattijs Korpershoek
1 sibling, 0 replies; 3+ messages in thread
From: Mattijs Korpershoek @ 2025-10-31 15:18 UTC (permalink / raw)
To: Guillaume La Roque (TI.com), u-boot
Cc: Simon Glass, Mattijs Korpershoek, Tom Rini, Julien Masson,
Nicolas Belin (TI.com), Jerome Forissier, george chan,
Guillaume La Roque (TI.com)
Hi Guillaume,
Thank you for the patch.
On Fri, Oct 24, 2025 at 16:23, "Guillaume La Roque (TI.com)" <glaroque@baylibre.com> wrote:
> From: "Nicolas Belin (TI.com)" <nbelin@baylibre.com>
>
> When previously using script based bootflows, the U-Boot
> environment variable bootargs was used to customize the kernel
> commandline at boot time.
> In order to get the same behaviour, concatenate the bootflow
> commandline with the contents the bootargs environment variable.
>
> Signed-off-by: Nicolas Belin (TI.com) <nbelin@baylibre.com>
> Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> ---
> boot/bootmeth_android.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
> index 8c2bde10e17..1374551dbeb 100644
> --- a/boot/bootmeth_android.c
> +++ b/boot/bootmeth_android.c
> @@ -512,6 +512,37 @@ static int run_avb_verification(struct bootflow *bflow)
> }
> #endif /* AVB_VERIFY */
>
> +static int append_bootargs_to_cmdline(struct bootflow *bflow)
> +{
> + char *bootargs;
> + int len = 0;
> +
> + /*
> + * Check any additionnal bootargs coming from U-Boot env. If any,
> + * merge them with the current cmdline
> + */
> + bootargs = env_get("bootargs");
> + if (bootargs) {
> + len += strlen(bootargs) + 1; /* Extra space character needed */
> + len += strlen(bflow->cmdline);
> +
> + char *newcmdline = malloc(len + 1); /* +1 for the '\0' */
> +
> + if (!newcmdline)
> + return log_msg_ret("newcmdline malloc", -ENOMEM);
> +
> + strcpy(newcmdline, bootargs);
> + strcat(newcmdline, " ");
> + strcat(newcmdline, bflow->cmdline);
> +
> + /* Free the previous cmdline and replace it */
> + free(bflow->cmdline);
> + bflow->cmdline = newcmdline;
> + }
> +
> + return 0;
> +}
> +
> static int boot_android_normal(struct bootflow *bflow)
> {
> struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
> @@ -546,6 +577,10 @@ static int boot_android_normal(struct bootflow *bflow)
> if (priv->slot)
> free(priv->slot);
>
> + ret = append_bootargs_to_cmdline(bflow);
> + if (ret < 0)
> + return log_msg_ret("bootargs append", ret);
> +
> ret = bootm_boot_start(loadaddr, bflow->cmdline);
>
> return log_msg_ret("boot", ret);
>
> ---
> base-commit: b10c055d4e1b5153a331a61ef82a5b01b5bb4c45
> change-id: 20251024-botargsappend-38a4371cb6dc
>
> Best regards,
> --
> Guillaume La Roque (TI.com) <glaroque@baylibre.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] bootstd: android: add the bootargs env to the commandline
2025-10-24 14:23 [PATCH] bootstd: android: add the bootargs env to the commandline Guillaume La Roque (TI.com)
2025-10-31 15:18 ` Mattijs Korpershoek
@ 2025-11-06 9:20 ` Mattijs Korpershoek
1 sibling, 0 replies; 3+ messages in thread
From: Mattijs Korpershoek @ 2025-11-06 9:20 UTC (permalink / raw)
To: u-boot, Guillaume La Roque (TI.com)
Cc: Simon Glass, Tom Rini, Julien Masson, Nicolas Belin (TI.com),
Jerome Forissier, george chan
Hi,
On Fri, 24 Oct 2025 16:23:22 +0200, Guillaume La Roque (TI.com) wrote:
> When previously using script based bootflows, the U-Boot
> environment variable bootargs was used to customize the kernel
> commandline at boot time.
> In order to get the same behaviour, concatenate the bootflow
> commandline with the contents the bootargs environment variable.
>
>
> [...]
Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)
[1/1] bootstd: android: add the bootargs env to the commandline
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/10da28729949f3e2160f98d82df45833d4c175cf
--
Mattijs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-06 9:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24 14:23 [PATCH] bootstd: android: add the bootargs env to the commandline Guillaume La Roque (TI.com)
2025-10-31 15:18 ` Mattijs Korpershoek
2025-11-06 9:20 ` Mattijs Korpershoek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox