diff options
author | Simon Glass <sjg@chromium.org> | 2021-01-24 10:06:08 -0700 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2021-02-01 15:33:25 +0800 |
commit | 577c4ad0550825fa94c44ebca23523f05faecf17 (patch) | |
tree | f113b79fd4cc7c95366d8a3427f159319eb38f87 /arch/x86/lib/zimage.c | |
parent | f82438948f649c33d775badd099869b0652ecc41 (diff) | |
download | u-boot-577c4ad0550825fa94c44ebca23523f05faecf17.tar.gz u-boot-577c4ad0550825fa94c44ebca23523f05faecf17.tar.bz2 u-boot-577c4ad0550825fa94c44ebca23523f05faecf17.zip |
x86: zimage: Allow dumping the image from outside the module
At present it is possible to dump an image within the zimage command, but
it is also useful to be able to dump it from elsewhere, for example in a
loader that has special handling for the different zimage stages.
Export this feature as a new function.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch/x86/lib/zimage.c')
-rw-r--r-- | arch/x86/lib/zimage.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c index 708025b207..3e9ee12400 100644 --- a/arch/x86/lib/zimage.c +++ b/arch/x86/lib/zimage.c @@ -600,19 +600,12 @@ static void show_loader(struct setup_header *hdr) printf("\n"); } -int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +void zimage_dump(struct boot_params *base_ptr) { - struct boot_params *base_ptr = state.base_ptr; struct setup_header *hdr; const char *version; int i; - if (argc > 1) - base_ptr = (void *)simple_strtoul(argv[1], NULL, 16); - if (!base_ptr) { - printf("No zboot setup_base\n"); - return CMD_RET_FAILURE; - } printf("Setup located at %p:\n\n", base_ptr); print_num64("ACPI RSDP addr", base_ptr->acpi_rsdp_addr); @@ -688,6 +681,20 @@ int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) print_num("Handover offset", hdr->handover_offset); if (get_boot_protocol(hdr, false) >= 0x215) print_num("Kernel info offset", hdr->kernel_info_offset); +} + +static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct boot_params *base_ptr = state.base_ptr; + + if (argc > 1) + base_ptr = (void *)simple_strtoul(argv[1], NULL, 16); + if (!base_ptr) { + printf("No zboot setup_base\n"); + return CMD_RET_FAILURE; + } + zimage_dump(base_ptr); return 0; } |