bootstd: Correct display of kernel version
authorSimon Glass <sjg@chromium.org>
Thu, 6 Mar 2025 00:25:01 +0000 (17:25 -0700)
committerTom Rini <trini@konsulko.com>
Tue, 18 Mar 2025 19:12:15 +0000 (13:12 -0600)
The address of the bzImage is not recorded in the bootflow, so we cannot
actually locate the version at present. Handle this case, to avoid
showing invalid data.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/lib/zimage.c
cmd/bootflow.c

index 7f4b117..d71285e 100644 (file)
@@ -558,7 +558,6 @@ void zimage_dump(struct bootm_info *bmi, struct boot_params *base_ptr,
                 bool show_cmdline)
 {
        struct setup_header *hdr;
-       const char *version;
        int i;
 
        printf("Setup located at %p:\n\n", base_ptr);
@@ -595,10 +594,14 @@ void zimage_dump(struct bootm_info *bmi, struct boot_params *base_ptr,
        print_num("Real mode switch", hdr->realmode_swtch);
        print_num("Start sys seg", hdr->start_sys_seg);
        print_num("Kernel version", hdr->kernel_version);
-       version = zimage_get_kernel_version(base_ptr,
-                                           (void *)bmi->bzimage_addr);
-       if (version)
-               printf("   @%p: %s\n", version, version);
+       if (bmi->bzimage_addr) {
+               const char *version;
+
+               version = zimage_get_kernel_version(base_ptr,
+                                                   (void *)bmi->bzimage_addr);
+               if (version)
+                       printf("   @%p: %s\n", version, version);
+       }
        print_num("Type of loader", hdr->type_of_loader);
        show_loader(hdr);
        print_num("Load flags", hdr->loadflags);
index 72b06a4..da17fd9 100644 (file)
@@ -383,6 +383,8 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
                struct bootm_info bmi;
 
                bootm_init(&bmi);
+               /* we don't know this at present */
+               bootm_x86_set(&bmi, bzimage_addr, 0);
                zimage_dump(&bmi, bflow->x86_setup, false);
 
                return 0;