diff options
| author | Tom Rini <[email protected]> | 2026-01-16 09:18:34 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-01-16 09:53:57 -0600 |
| commit | 1da640cc46ad84efb57bb45e02dd6c40265b5488 (patch) | |
| tree | 29a54e26b2a6e032b9ba5b99a7207a52acd69025 /cmd | |
| parent | 03893b263a64b06ef06769b5526918fabd7a774f (diff) | |
| parent | 0efe1d9502a022d5d5c39c73340dd0b7b3f9cbe5 (diff) | |
Merge tag 'u-boot-dfu-20260116' of https://source.denx.de/u-boot/custodians/u-boot-dfu
u-boot-dfu-20260116
CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/29018
Android:
* Fix missing dependency for BOOTMETH_ANDROID
* Add bootconfig support
* Add 'get ramdisk' command to abootimg
DFU:
* Improve error handling in dfu_fill_entity()
USB Gadget:
* ci_udc: Ensure ci_ep->desc is valid before using it
* ci_udc: Add additional debug prints
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/abootimg.c | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/cmd/abootimg.c b/cmd/abootimg.c index 6fb52153786..eae3e643b60 100644 --- a/cmd/abootimg.c +++ b/cmd/abootimg.c @@ -92,26 +92,18 @@ static int abootimg_get_recovery_dtbo(int argc, char *const argv[]) static int abootimg_get_dtb_load_addr(int argc, char *const argv[]) { + struct andr_image_data img_data = {0}; + const void *vendor_boot_hdr = NULL; + if (argc > 1) return CMD_RET_USAGE; - struct andr_image_data img_data = {0}; - const struct andr_boot_img_hdr_v0 *hdr; - const struct andr_vnd_boot_img_hdr *vhdr = NULL; - hdr = map_sysmem(abootimg_addr(), sizeof(*hdr)); if (get_avendor_bootimg_addr() != -1) - vhdr = map_sysmem(get_avendor_bootimg_addr(), sizeof(*vhdr)); + vendor_boot_hdr = (const void *)get_avendor_bootimg_addr(); - if (!android_image_get_data(hdr, vhdr, &img_data)) { - if (get_avendor_bootimg_addr() != -1) - unmap_sysmem(vhdr); - unmap_sysmem(hdr); + if (!android_image_get_data((const void *)abootimg_addr(), + vendor_boot_hdr, &img_data)) return CMD_RET_FAILURE; - } - - if (get_avendor_bootimg_addr() != -1) - unmap_sysmem(vhdr); - unmap_sysmem(hdr); if (img_data.header_version < 2) { printf("Error: header_version must be >= 2 for this\n"); @@ -230,6 +222,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 +268,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 +336,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" ); |
