diff options
author | Simon Glass <sjg@chromium.org> | 2023-11-19 07:43:34 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-12-15 09:41:38 -0500 |
commit | 69544c4fd8b1e77e00403e9a6cba7e2d7bb3ff68 (patch) | |
tree | 23694b6a44f4b29386894860b7d082864685c272 /boot | |
parent | bb07cdb19194bd141f7c3c631eddd4bfaf651e4d (diff) | |
download | u-boot-69544c4fd8b1e77e00403e9a6cba7e2d7bb3ff68.zip u-boot-69544c4fd8b1e77e00403e9a6cba7e2d7bb3ff68.tar.gz u-boot-69544c4fd8b1e77e00403e9a6cba7e2d7bb3ff68.tar.bz2 |
bootm: Support kernel_noload with compression
It is not currently possible to execute the kernel in-place without
loading it. Use lmb to allocate memory for it.
Co-developed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'boot')
-rw-r--r-- | boot/bootm.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/boot/bootm.c b/boot/bootm.c index e051a0c..7c1b4a3 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -410,6 +410,24 @@ static int bootm_load_os(struct bootm_headers *images, int boot_progress) void *load_buf, *image_buf; int err; + /* + * For a "noload" compressed kernel we need to allocate a buffer large + * enough to decompress in to and use that as the load address now. + * Assume that the kernel compression is at most a factor of 4 since + * zstd almost achieves that. + * Use an alignment of 2MB since this might help arm64 + */ + if (os.type == IH_TYPE_KERNEL_NOLOAD && os.comp != IH_COMP_NONE) { + ulong req_size = ALIGN(image_len * 4, SZ_1M); + + load = lmb_alloc(&images->lmb, req_size, SZ_2M); + if (!load) + return 1; + os.load = load; + debug("Allocated %lx bytes at %lx for kernel (size %lx) decompression\n", + req_size, load, image_len); + } + load_buf = map_sysmem(load, 0); image_buf = map_sysmem(os.image_start, image_len); err = image_decomp(os.comp, load, os.image_start, os.type, |