
The kernel_noload image type indicates that no loading is to be done by U-Boot. This works well when the image is uncompressed.
When the image is compressed, loading is of course required. The load address in the FIT is used for loading.
However a FIT built from Linux v6.6 supports about 990 boards. Each has a different memory arrangement, so no one load address is suitable. Therefore the 'load' address in the kernel node is not useful.
It would be better in this case to be able to omit the load address and have U-Boot choose something suitable. The kernel_addr_r environment variable seems to be a more reliable final address for the kernel. Use that as a backup when the load address is missing.
Similarly, use the load address as the entry address when the latter is omitted.
Update the FIT documentation accordingly.
Note that mkimage still requires each image in a FIT to have a load address, at least for now.
Another option would be to create a new Kconfig for this, or to use a region of memory known to be free, e.g. calculated from the DRAM banks. But in any case we should try to avoid conflicting with the kernel_addr_r variable. So the approach in this patch seems reasonable to me.
It might perhaps be useful to introduce an 'entry-offset' property which allows the entry to be set as an offset from the load address, whether that is explicit or calculated.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Allow omitting the load address rather than messing with kernel_noload
boot/bootm.c | 20 ++++++++++++++------ doc/usage/fit/source_file_format.rst | 7 ++++++- 2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/boot/bootm.c b/boot/bootm.c index cb61485c226c..aef9fad8ca13 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -177,10 +177,17 @@ static int bootm_find_os(struct cmd_tbl *cmdtp, int flag, int argc, images.os.end = fit_get_end(images.fit_hdr_os);
if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os, - &images.os.load)) { - puts("Can't get image load address!\n"); - bootstage_error(BOOTSTAGE_ID_FIT_LOADADDR); - return 1; + &images.os.load)) { + ulong load; + + load = env_get_hex("kernel_addr_r", -1UL); + if (load == -1UL) { + puts("Can't get image load address!\n"); + bootstage_error(BOOTSTAGE_ID_FIT_LOADADDR); + return 1; + } + printf("Using kernel load address %lx\n", load); + images.os.load = load; } break; #endif @@ -230,8 +237,9 @@ static int bootm_find_os(struct cmd_tbl *cmdtp, int flag, int argc, ret = fit_image_get_entry(images.fit_hdr_os, images.fit_noffset_os, &images.ep); if (ret) { - puts("Can't get entry point property!\n"); - return 1; + printf("Can't get entry point property, using load address %lx\n", + images.os.load); + images.ep = images.os.load; } #endif } else if (!ep_found) { diff --git a/doc/usage/fit/source_file_format.rst b/doc/usage/fit/source_file_format.rst index b2b1e42bd730..f92738a9480a 100644 --- a/doc/usage/fit/source_file_format.rst +++ b/doc/usage/fit/source_file_format.rst @@ -234,6 +234,10 @@ type zynqmpimage Xilinx ZynqMP Boot Image } ==================== ==================
+ The kernel_noload type indicates that the image is a kernel but that it + does not need to be loaded and can be executed in-place from the FIT. This + type cannot be used if compression is not "none". + compression Compression used by included data. If no compression is used, the compression property should be set to "none". If the data is compressed but @@ -353,7 +357,8 @@ entry load load address, address size is determined by '#address-cells' property of the root node. - Mandatory for types: "firmware", and "kernel". + This is normally mandatory for types: "firmware", and "kernel". However if + it omitted the bootloader may chose a suitable address.
compatible compatible method for loading image.