From: "Guillaume La Roque (TI.com)" <glaroque@baylibre.com>
To: Tom Rini <trini@konsulko.com>,
Mattijs Korpershoek <mkorpershoek@kernel.org>
Cc: Julien Masson <jmasson@baylibre.com>,
Guillaume La Roque <glaroque@baylibre.com>,
u-boot@lists.denx.de, Simon Glass <sjg@chromium.org>,
Nicolas Belin <nbelin@baylibre.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Andrew Goodbody <andrew.goodbody@linaro.org>,
Aaron Kling <webgeek1234@gmail.com>,
George Chan <gchan9527@gmail.com>, Sam Day <me@samcday.com>,
Jerome Forissier <jerome.forissier@linaro.org>,
Maxime Fournier <mfournier@baylibre.com>
Subject: [PATCH v2 4/5] cmd: abootimg: Add 'get ramdisk' command
Date: Fri, 17 Oct 2025 15:19:20 +0200 [thread overview]
Message-ID: <20251017-bootconfig-v2-4-8c7c2f2e5474@baylibre.com> (raw)
In-Reply-To: <20251017-bootconfig-v2-0-8c7c2f2e5474@baylibre.com>
Add support for retrieving ramdisk address and size from Android boot
images. This command allows users to extract the ramdisk information
for boot image v3+ which combines vendor ramdisk, boot ramdisk and
bootconfig sections.
Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
---
cmd/abootimg.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/cmd/abootimg.c b/cmd/abootimg.c
index 6fb52153786..2a8e2c20941 100644
--- a/cmd/abootimg.c
+++ b/cmd/abootimg.c
@@ -230,6 +230,33 @@ static int do_abootimg_addr(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_SUCCESS;
}
+static int abootimg_get_ramdisk(int argc, char *const argv[])
+{
+ ulong rd_data, rd_len;
+
+ if (argc > 2)
+ return CMD_RET_USAGE;
+
+ /*
+ * Call android_image_get_ramdisk with UNMAPPED addresses
+ * The function will do its own mapping internally as needed
+ */
+ if (android_image_get_ramdisk((void *)abootimg_addr(),
+ (void *)get_avendor_bootimg_addr(),
+ &rd_data, &rd_len))
+ return CMD_RET_FAILURE;
+
+ if (argc == 0) {
+ printf("%lx\n", rd_data);
+ } else {
+ env_set_hex(argv[0], rd_data);
+ if (argc == 2)
+ env_set_hex(argv[1], rd_len);
+ }
+
+ return CMD_RET_SUCCESS;
+}
+
static int do_abootimg_get(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
@@ -249,6 +276,8 @@ static int do_abootimg_get(struct cmd_tbl *cmdtp, int flag, int argc,
return abootimg_get_dtb_load_addr(argc, argv);
else if (!strcmp(param, "dtb"))
return abootimg_get_dtb(argc, argv);
+ else if (!strcmp(param, "ramdisk"))
+ return abootimg_get_ramdisk(argc, argv);
return CMD_RET_USAGE;
}
@@ -315,5 +344,9 @@ U_BOOT_CMD(
" - get address and size (hex) of DT blob in the image by index\n"
" <num>: index number of desired DT blob in DTB area\n"
" [addr_var]: variable name to contain DT blob address\n"
- " [size_var]: variable name to contain DT blob size"
+ " [size_var]: variable name to contain DT blob size\n"
+ "abootimg get ramdisk [addr_var [size_var]]\n"
+ " - get address and size (hex) of ramdisk in the image\n"
+ " [addr_var]: variable name to contain ramdisk address\n"
+ " [size_var]: variable name to contain ramdisk size"
);
--
2.34.1
next prev parent reply other threads:[~2025-10-17 13:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 13:19 [PATCH v2 0/5] android: add bootconfig support Guillaume La Roque (TI.com)
2025-10-17 13:19 ` [PATCH v2 1/5] boot: android: import addBootConfigParameters() from AOSP Guillaume La Roque (TI.com)
2025-10-31 15:39 ` Mattijs Korpershoek
2025-10-17 13:19 ` [PATCH v2 2/5] boot: android: Add sandbox memory mapping support Guillaume La Roque (TI.com)
2025-10-31 15:49 ` Mattijs Korpershoek
2025-10-17 13:19 ` [PATCH v2 3/5] boot: android: Add bootconfig support Guillaume La Roque (TI.com)
2025-10-31 15:58 ` Mattijs Korpershoek
2025-11-03 18:52 ` Guillaume La Roque
2025-11-07 14:52 ` Mattijs Korpershoek
2025-10-17 13:19 ` Guillaume La Roque (TI.com) [this message]
2025-10-31 16:13 ` [PATCH v2 4/5] cmd: abootimg: Add 'get ramdisk' command Mattijs Korpershoek
2025-10-17 13:19 ` [PATCH v2 5/5] test: abootimg: Add test for bootconfig handling Guillaume La Roque (TI.com)
2025-10-19 13:06 ` Simon Glass
2025-10-19 16:01 ` Tom Rini
2025-10-20 5:18 ` Simon Glass
2025-10-24 15:09 ` Guillaume La Roque
2025-10-24 15:20 ` Tom Rini
2025-10-31 16:27 ` Mattijs Korpershoek
2025-11-05 18:14 ` Guillaume La Roque
2025-11-07 14:52 ` Mattijs Korpershoek
2025-10-18 6:07 ` [PATCH v2 0/5] android: add bootconfig support george chan
2025-10-20 13:58 ` Guillaume La Roque
2025-10-20 15:45 ` george chan
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=20251017-bootconfig-v2-4-8c7c2f2e5474@baylibre.com \
--to=glaroque@baylibre.com \
--cc=andrew.goodbody@linaro.org \
--cc=gchan9527@gmail.com \
--cc=jerome.forissier@linaro.org \
--cc=jmasson@baylibre.com \
--cc=me@samcday.com \
--cc=mfournier@baylibre.com \
--cc=mkorpershoek@kernel.org \
--cc=nbelin@baylibre.com \
--cc=neil.armstrong@linaro.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=webgeek1234@gmail.com \
/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