From: George Chan <gchan9527@gmail.com>
To: Tom Rini <trini@konsulko.com>,
Casey Connolly <casey.connolly@linaro.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Sumit Garg <sumit.garg@kernel.org>,
Simon Glass <sjg@chromium.org>,
Mattijs Korpershoek <mkorpershoek@kernel.org>,
Lukasz Majewski <lukma@denx.de>, Marek Vasut <marex@denx.de>
Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, gchan9527@gmail.com
Subject: [PATCH v2 2/5] bootm: Append bootargs value when bootmeth_android provide cmdline
Date: Sat, 07 Jun 2025 13:24:57 +0800 [thread overview]
Message-ID: <20250607-sc7180-android-boot-v2-2-2df5d7f61124@gmail.com> (raw)
In-Reply-To: <20250607-sc7180-android-boot-v2-0-2df5d7f61124@gmail.com>
Old logic wipe bootargs env with cmdline, new logic maintain the
value by prepending cmdline value to bootargs.
Signed-off-by: George Chan <gchan9527@gmail.com>
---
boot/bootm.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/boot/bootm.c b/boot/bootm.c
index f6aa32746b7..888684a91f5 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -1152,11 +1152,38 @@ int bootm_boot_start(ulong addr, const char *cmdline)
snprintf(addr_str, sizeof(addr_str), "%lx", addr);
- ret = env_set("bootargs", cmdline);
+ if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS)) {
+ char *bootargs;
+ char *newbootargs;
+ bootargs = env_get("bootargs");
+ ret = strlen(bootargs) + strlen(cmdline) + 2;
+
+ newbootargs = malloc(ret);
+
+ *newbootargs = '\0';
+
+ if (*newbootargs) /* If there is something in newbootargs, a space is needed */
+ strcat(newbootargs, " ");
+ strcat(newbootargs, cmdline);
+
+ if (*newbootargs) /* If there is something in newbootargs, a space is needed */
+ strcat(newbootargs, " ");
+ strcat(newbootargs, bootargs);
+
+ /* force to terminate the string */
+ memset(newbootargs + MAX_CMDLINE_SIZE - 2, '\0', 1);
+
+ ret = env_set("bootargs", newbootargs);
+
+ free(newbootargs);
+ } else
+ ret = env_set("bootargs", cmdline);
+
if (ret) {
printf("Failed to set cmdline\n");
return ret;
}
+
bootm_init(&bmi);
bmi.addr_img = addr_str;
bmi.cmd_name = "bootm";
--
2.43.0
WARNING: multiple messages have this Message-ID (diff)
From: George Chan via B4 Relay <devnull+gchan9527.gmail.com@kernel.org>
To: Tom Rini <trini@konsulko.com>,
Casey Connolly <casey.connolly@linaro.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Sumit Garg <sumit.garg@kernel.org>,
Simon Glass <sjg@chromium.org>,
Mattijs Korpershoek <mkorpershoek@kernel.org>,
Lukasz Majewski <lukma@denx.de>, Marek Vasut <marex@denx.de>
Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, gchan9527@gmail.com
Subject: [PATCH v2 2/5] bootm: Append bootargs value when bootmeth_android provide cmdline
Date: Sat, 07 Jun 2025 13:24:57 +0800 [thread overview]
Message-ID: <20250607-sc7180-android-boot-v2-2-2df5d7f61124@gmail.com> (raw)
In-Reply-To: <20250607-sc7180-android-boot-v2-0-2df5d7f61124@gmail.com>
From: George Chan <gchan9527@gmail.com>
Old logic wipe bootargs env with cmdline, new logic maintain the
value by prepending cmdline value to bootargs.
Signed-off-by: George Chan <gchan9527@gmail.com>
---
boot/bootm.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/boot/bootm.c b/boot/bootm.c
index f6aa32746b7..888684a91f5 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -1152,11 +1152,38 @@ int bootm_boot_start(ulong addr, const char *cmdline)
snprintf(addr_str, sizeof(addr_str), "%lx", addr);
- ret = env_set("bootargs", cmdline);
+ if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS)) {
+ char *bootargs;
+ char *newbootargs;
+ bootargs = env_get("bootargs");
+ ret = strlen(bootargs) + strlen(cmdline) + 2;
+
+ newbootargs = malloc(ret);
+
+ *newbootargs = '\0';
+
+ if (*newbootargs) /* If there is something in newbootargs, a space is needed */
+ strcat(newbootargs, " ");
+ strcat(newbootargs, cmdline);
+
+ if (*newbootargs) /* If there is something in newbootargs, a space is needed */
+ strcat(newbootargs, " ");
+ strcat(newbootargs, bootargs);
+
+ /* force to terminate the string */
+ memset(newbootargs + MAX_CMDLINE_SIZE - 2, '\0', 1);
+
+ ret = env_set("bootargs", newbootargs);
+
+ free(newbootargs);
+ } else
+ ret = env_set("bootargs", cmdline);
+
if (ret) {
printf("Failed to set cmdline\n");
return ret;
}
+
bootm_init(&bmi);
bmi.addr_img = addr_str;
bmi.cmd_name = "bootm";
--
2.43.0
next prev parent reply other threads:[~2025-06-07 5:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-07 5:24 [PATCH v2 0/5] A series of patch for enable sc7180 android boot George Chan
2025-06-07 5:24 ` George Chan via B4 Relay
2025-06-07 5:24 ` [PATCH v2 1/5] image-android: Prepend/postpend default bootargs value with given bootcmd George Chan
2025-06-07 5:24 ` George Chan via B4 Relay
2025-06-12 7:19 ` Mattijs Korpershoek
2025-06-07 5:24 ` George Chan [this message]
2025-06-07 5:24 ` [PATCH v2 2/5] bootm: Append bootargs value when bootmeth_android provide cmdline George Chan via B4 Relay
2025-06-07 5:24 ` [PATCH v2 3/5] boot: bootmeth_android: Conditionally dependent on abootimg George Chan
2025-06-07 5:24 ` George Chan via B4 Relay
2025-06-12 7:35 ` Mattijs Korpershoek
2025-06-07 5:24 ` [PATCH v2 4/5] iommu: qcom-smmu: Introduce sc7180 compatible string George Chan
2025-06-07 5:24 ` George Chan via B4 Relay
2025-06-07 5:25 ` [PATCH v2 5/5] usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOM George Chan
2025-06-07 5:25 ` George Chan via B4 Relay
2025-06-12 7:24 ` Mattijs Korpershoek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250607-sc7180-android-boot-v2-2-2df5d7f61124@gmail.com \
--to=gchan9527@gmail.com \
--cc=casey.connolly@linaro.org \
--cc=lukma@denx.de \
--cc=marex@denx.de \
--cc=mkorpershoek@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=sjg@chromium.org \
--cc=sumit.garg@kernel.org \
--cc=trini@konsulko.com \
--cc=u-boot-qcom@groups.io \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.