Finding x86_setup among FIT configurations
    Mike Crowe 
    mac at mcrowe.com
       
    Fri May 27 18:37:47 CEST 2022
    
    
  
I'm trying to boot a FIT image on x86 and fit_image_load is having trouble
finding the setup binary.
My FIT image looks similar to the one in doc/uImage.FIT/kernel.its:
/ {
	images {
		kernel-1 {
			description = "Linux kernel";
			data = <...>
			type = "kernel";
			arch = "x86";
			os = "linux";
			compression = "none";
			load = <0x1314c40>;
			entry = <0x1314c40>;
			hash-1 {
				value = <...>
				algo = "sha256";
			};
		};
		setup-1 {
			description = "Linux setup.bin";
			data = <...>
			type = "x86_setup";
			arch = "x86";
			os = "linux";
			compression = "none";
			load = <0x90000>;
			entry = <0x90000>;
			hash-1 {
				value = <...>
				algo = "sha256";
			};
		};
	};
	configurations {
		conf-0 {
			description = "Configuration for board 0";
			kernel = "kernel-1";
			setup = "setup-1";
		};
		conf-1 {
			description = "Configuration for board 1";
			kernel = "kernel-1";
			setup = "setup-1";
		};
	};
};
I'm trying to run it with:
 bootm ${loadaddr}#conf-0
I get:
## Loading kernel from FIT Image at 10000000 ...
   Using 'conf-0' configuration
   Trying 'kernel-1' kernel subimage
     Description:  Linux kernel
     Created:      2022-05-27  14:03:08 UTC
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x100000f4
     Data Size:    13990516 Bytes = 13.3 MiB
     Architecture: Intel x86
     OS:           Linux
     Load Address: 0x01314c40
     Entry Point:  0x01314c40
     Hash algo:    sha256
     Hash value:   1f4167a38aed74edb02bedf021fc8dbc4a9d0c0a84e886006de22c8b11714645
   Verifying Hash Integrity ... sha256+ OK
## Loading setup from FIT Image at 10000000 ...
Could not find configuration node
   Loading Kernel Image
## Kernel loading failed (missing x86 kernel setup) ...
subcommand not supported
"could not find configuration node" is emitted because fit_uname_config is
NULL inside image-fit.c:fit-image-load when loading the setup binary. I
don't have CONFIG_FIT_BEST_MATCH enabled, but enabling it didn't seem to
change the observed behaviour.
It appears that the parsing of the configuration name after the load
address is done separately inside bootm.c:boot_get_kernel (for the kernel)
and image-fit.c:boot_get_fdt_fit (for the device tree) and the command
arguments aren't even passed to image-fit.c:boot_get_setup_fit, so it just
passes NULL as fit_uname_config.
If I add:
	if (!fit_uname_config)
		fit_uname_config = "conf-0";
to image-fit.c:fit_image_load then the setup binary is found and my device
can boot the kernel successfully.
I can't see how this can ever work, so I think I must be missing something.
Can anyone enlighten me as to what that might be?
Thanks.
Mike.
    
    
More information about the U-Boot
mailing list