summaryrefslogtreecommitdiff
path: root/boot/bootmeth_android.c
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-11-07 08:56:22 -0600
committerTom Rini <[email protected]>2025-11-07 08:56:22 -0600
commit64b3478eb51d246a2790dce99fe0be330b9c2cc6 (patch)
treecc91a54d37906fc73c8f5b7ed3dfbdaf1a6389e5 /boot/bootmeth_android.c
parentdf786b4c57f582b4f875effe68d3ae22bbb478a9 (diff)
parent10da28729949f3e2160f98d82df45833d4c175cf (diff)
Merge tag 'u-boot-dfu-20251107' of https://source.denx.de/u-boot/custodians/u-boot-dfu
u-boot-dfu-20251107: CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/28223 Android: * Add bootargs environment to kernel commandline DFU: * Support DFU over PCIe in SPL
Diffstat (limited to 'boot/bootmeth_android.c')
-rw-r--r--boot/bootmeth_android.c35
1 files changed, 35 insertions, 0 deletions
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);