From: George Chan via B4 Relay <devnull+gchan9527.gmail.com@kernel.org>
To: Tom Rini <trini@konsulko.com>,
Mattijs Korpershoek <mkorpershoek@kernel.org>,
Simon Glass <sjg@chromium.org>,
Casey Connolly <casey.connolly@linaro.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Sumit Garg <sumit.garg@kernel.org>,
Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io,
George Chan <gchan9527@gmail.com>
Subject: [PATCH v2 3/5] fdt_support: Add support for extra var for bootargs
Date: Mon, 05 May 2025 17:17:11 +0800 [thread overview]
Message-ID: <20250505-android-boot-v2-3-92dcb5bf59c8@gmail.com> (raw)
In-Reply-To: <20250505-android-boot-v2-0-92dcb5bf59c8@gmail.com>
From: George Chan <gchan9527@gmail.com>
Introduce a new env var 'legacy_os_boot_param' to hold legacy OS
dependent boot param.
Signed-off-by: George Chan <gchan9527@gmail.com>
---
boot/Kconfig | 9 +++++++++
boot/fdt_support.c | 20 +++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/boot/Kconfig b/boot/Kconfig
index 4bdac384181..80bb2eb7e77 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -17,6 +17,15 @@ config ANDROID_BOOT_IMAGE_IGNORE_BLOB_ADDR
help
This ignore kernel/ramdisk load addr specified in androidboot header.
+config SUPPORT_LEGACY_OS_BOOTPARAM
+ bool "Extra var to append bootargs"
+ default n
+ help
+ This introduce env_var 'legacy_os_boot_param' to hold extra OS
+ dependent kernel boot param, and append to fdt bootargs when bootm
+ execute. The value is supposed to obtain from env file at compile time.
+ Board dependent callback will override it completely.
+
config TIMESTAMP
bool "Show image date and time when displaying image information"
default y if CMD_DATE
diff --git a/boot/fdt_support.c b/boot/fdt_support.c
index 92f2f534ee0..cc4d808eaf1 100644
--- a/boot/fdt_support.c
+++ b/boot/fdt_support.c
@@ -322,9 +322,27 @@ int fdt_kaslrseed(void *fdt, bool overwrite)
* board_fdt_chosen_bootargs - boards may override this function to use
* alternative kernel command line arguments
*/
+#define COMMAND_LINE_SIZE 1024
+static char bootargs[COMMAND_LINE_SIZE] = { 0 };
__weak const char *board_fdt_chosen_bootargs(const struct fdt_property *fdt_ba)
{
- return env_get("bootargs");
+ if (IS_ENABLED(CONFIG_SUPPORT_LEGACY_OS_BOOTPARAM)) {
+ int j;
+ snprintf(bootargs, COMMAND_LINE_SIZE - 2, "%s %s",
+ env_get("bootargs"),
+ env_get("legacy_os_boot_param"));
+
+ /* remove all carriage return */
+ for (j = 0; j < COMMAND_LINE_SIZE; j++) {
+ if (bootargs[j] == '\0')
+ break;
+
+ if ((bootargs[j] == '\n') || (bootargs[j] == '\r'))
+ bootargs[j] = ' ';
+ }
+ return bootargs;
+ } else
+ return env_get("bootargs");
}
int fdt_chosen(void *fdt)
--
2.43.0
next prev parent reply other threads:[~2025-05-05 12:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 9:17 [PATCH v2 0/5] u-boot chain-loading LineageOS bootimg George Chan via B4 Relay
2025-05-05 9:17 ` [PATCH v2 1/5] boot/image-android: Workaround kernel/ramdisk invalid addr George Chan via B4 Relay
2025-05-05 12:22 ` Neil Armstrong
2025-05-07 9:30 ` Mattijs Korpershoek
2025-05-07 7:47 ` Mattijs Korpershoek
2025-05-08 4:22 ` george chan
2025-05-09 14:22 ` Mattijs Korpershoek
2025-05-05 9:17 ` [PATCH v2 2/5] mach-snapdragon: Enhance android image handling memory footprint George Chan via B4 Relay
2025-05-05 12:23 ` Neil Armstrong
2025-05-05 9:17 ` George Chan via B4 Relay [this message]
2025-05-05 9:17 ` [PATCH v2 4/5] qcom-phone.env: Example of new env var legacy_os_boot_param George Chan via B4 Relay
2025-05-05 9:17 ` [PATCH v2 5/5] mach-snapdragon: Enable workaround of ignoring androidboot addr George Chan via B4 Relay
2025-05-05 12:23 ` Neil Armstrong
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=20250505-android-boot-v2-3-92dcb5bf59c8@gmail.com \
--to=devnull+gchan9527.gmail.com@kernel.org \
--cc=casey.connolly@linaro.org \
--cc=gchan9527@gmail.com \
--cc=mkorpershoek@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rayagonda.kokatanur@broadcom.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox