summaryrefslogtreecommitdiff
path: root/boot/bootm.c
AgeCommit message (Collapse)Author
2026-03-18Merge patch series "bootm: Clean up arch-specific, pre-OS clean-up"Tom Rini
Simon Glass <[email protected]> says: Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type. It is quite hard to know what actually happens in the final milliseconds before the OS boot. This series attempts to start cleaning up U-Boot in this area. The basic intent is to create a new bootm_final() function which can be called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic. All architectures are converted over to use this new function. board_quiesce_devices() is moved into bootm_final() so that all archs benefit from it. This series fixes a bug in device_remove() is fixed where removing a parent with specialised flags (e.g. DM_REMOVE_ACTIVE_ALL) could leave children activated, since they do not match the flags. This fixes is needed to avoid bootm_final() causing test failures on sandbox. Future work could take this a little further: - Convert EFI loader to use the same function - Improve comments for cleanup_before_linux() across architectures - Support fake-run tracing on all archs Link: https://lore.kernel.org/r/[email protected]
2026-03-18bootm: Stash bootstage data in bootm_final()Simon Glass
ARM stashes bootstage data to a known memory location before booting, so the kernel can pick it up. Add this to bootm_final() so all architectures benefit from it. The bootstage_stash_default() function is a no-op when bootstage or stashing is disabled. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-03-18riscv: Call bootm_final()Simon Glass
The RISC-V announce_and_cleanup() duplicates the common pre-boot steps. Replace it with a call to bootm_final(). Move board_quiesce_devices() into bootm_final() so it is available to all architectures. Drop the RISC-V weak definition and header declaration since the generic one in bootm.h is used instead. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-03-18bootm: Create bootm_final() for pre-boot cleanupSimon Glass
There are various functions which announce that booting is imminent and do related preparation. Most of these are arch-specific. In practice, most archs do a similar thing. It would be better to have a common function, with perhaps some events for things that are really arch- and board-specific. Create a new bootm_final() function with the common pre-boot steps: printing the "Starting kernel" message, recording bootstage data, optionally writing bootstage to the FDT and printing a report, and removing active devices. Be careful to avoid using BIT() macros which are not available with host tools. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2026-03-06bootm: fix booting kernel_noload imageLudwig Nussel
FIT images don't work without having to explicitly specify physical load addresses. Digging into that it looks like a flaw in bootm_load_os(). It duplicates images->os for convenience. However, the code handling "kernel_noload" images then updates the load address in the copy with the value lmb_alloc_mem() returned. Later there's another call to lmb_alloc_mem() that uses the old value. This leads to havoc due to subsequent calls of lmb_alloc_mem() picking too low addresses. The "fix" is to mark the local variable const to avoid accidental assignments. This works but IMO the logic is still flawed somehow as this leads to overlapping lmb reservations. I guess the fixed reservation should only be done when the noload path wasn't hit. Without the change: + bootm 0x40200000#qemu-arm 0x40200000#qemu-arm 0x40000000 Using 'qemu-arm' configuration Verifying Hash Integrity ... OK Trying 'kernel' kernel subimage Description: Linux kernel Created: 2026-02-24 14:10:09 UTC Type: Kernel Image (no loading done) Compression: gzip compressed Data Start: 0x402000b8 Data Size: 12227440 Bytes = 11.7 MiB Hash algo: sha256 Hash value: 7ea661fdecdd1127edd419cfbf8bff52e2d5ac55c... Verifying Hash Integrity ... sha256+ OK Using 'qemu-arm' configuration Verifying Hash Integrity ... OK Trying 'ramdisk' ramdisk subimage Description: Initial ramdisk Created: 2026-02-24 14:10:09 UTC Type: RAMDisk Image Compression: uncompressed Data Start: 0x40da9528 Data Size: 1067114 Bytes = 1 MiB Architecture: AArch64 OS: Linux Load Address: unavailable Entry Point: unavailable Hash algo: sha256 Hash value: 2a711dcb5f58615187645ccec615c67eddcfbb3138... Verifying Hash Integrity ... sha256+ OK Booting using the fdt blob at 0x40000000 Working FDT set to 40000000 Uncompressing Kernel Image (no loading done) to 13a400000 Loading Ramdisk to 400fb000, end 401ff86a ... OK device tree - allocation error FDT creation failed! resetting ... Bloblist at 0 not found (err=-2) alloc space exhausted ptr 400 limit 0 Bloblist at 0 not found (err=-2) [reset] After: + bootm 0x40200000#qemu-arm 0x40200000#qemu-arm 0x40000000 Using 'qemu-arm' configuration Verifying Hash Integrity ... OK Trying 'kernel' kernel subimage Description: Linux kernel Created: 2026-02-24 14:10:09 UTC Type: Kernel Image (no loading done) Compression: gzip compressed Data Start: 0x402000b8 Data Size: 12227440 Bytes = 11.7 MiB Hash algo: sha256 Hash value: 7ea661fdecdd1127edd419cfbf8bff52e2d5ac55ce... Verifying Hash Integrity ... sha256+ OK Using 'qemu-arm' configuration Verifying Hash Integrity ... OK Trying 'ramdisk' ramdisk subimage Description: Initial ramdisk Created: 2026-02-24 14:10:09 UTC Type: RAMDisk Image Compression: uncompressed Data Start: 0x40da9528 Data Size: 1067114 Bytes = 1 MiB Architecture: AArch64 OS: Linux Load Address: unavailable Entry Point: unavailable Hash algo: sha256 Hash value: 2a711dcb5f58615187645ccec615c67eddcfbb3138... Verifying Hash Integrity ... sha256+ OK Booting using the fdt blob at 0x40000000 Working FDT set to 40000000 Uncompressing Kernel Image (no loading done) to 13a400000 Loading Ramdisk to 13a2fb000, end 13a3ff86a ... OK Loading Device Tree to 000000013a1f8000, end 000000013a2fafff ... OK Working FDT set to 13a1f8000 Starting kernel ... Signed-off-by: Ludwig Nussel <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2025-06-25lmb: replace the lmb_alloc() and lmb_alloc_base() API'sSughosh Ganu
There currently are two API's for requesting memory from the LMB module, lmb_alloc() and lmb_alloc_base(). The function which does the actual allocation is the same. Use the earlier introduced API lmb_alloc_mem() for both types of allocation requests. Signed-off-by: Sughosh Ganu <[email protected]> Acked-by: Ilias Apalodimas <[email protected]>
2025-06-25lmb: replace lmb_reserve() and lmb_alloc_addr() API'sSughosh Ganu
There currently are multiple allocation API's in the LMB module. There are a couple of API's for allocating memory(lmb_alloc() and lmb_alloc_base()), and then there are two for requesting a reservation for a particular memory region (lmb_reserve() and lmb_alloc_addr()). Introduce a single API lmb_alloc_mem() which will cater to all types of allocation requests and replace lmb_reserve() and lmb_alloc_addr() with the new API. Moreover, the lmb_reserve() API is pretty similar to the lmb_alloc_addr() API, with the one difference being that the lmb_reserve() API allows for reserving any address passed to it -- the address need not be part of the LMB memory map. The lmb_alloc_addr() does check that the address being requested is actually part of the LMB memory map. There is no need to support reserving memory regions which are outside the LMB memory map. Remove the lmb_reserve() API functionality and use the functionality provided by lmb_alloc_addr() instead. The lmb_alloc_addr() will check if the requested address is part of the LMB memory map and return an error if not. Signed-off-by: Sughosh Ganu <[email protected]> Acked-by: Ilias Apalodimas <[email protected]>
2025-05-30bootm: Fix bmi->images pointer not initialized in some casesBenjamin ROBIN
When building with only bootz command, without bootm, images pointer inside bootm_info structure is not initialized. And since this structure is stored in stack, the generated error is kind of random, but most of the time this will generate: "ramdisk - allocation error". Also, after analysis, this problem could occur with the command booti, if the command bootm is disabled. Currently bootm_init() is called by: do_bootz(), do_bootm(), do_booti() and by do_stm32prog(). And all of these commands execute bootm_run_states() which access the images pointer stored into bootm_info structure. So, to fix this issue, just do the assignment unconditionally. Fixes: c2211ff65136 ("bootm: Add more fields to bootm_info") Signed-off-by: Benjamin ROBIN <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2025-05-05bootm: improve error message when gzip decompression buffer is too smallAristo Chen
Currently, when decompressing a gzip-compressed image during bootm, a generic error such as "inflate() returned -5" is shown when the buffer is too small. However, it is not immediately clear that this is caused by CONFIG_SYS_BOOTM_LEN being too small. This patch improves error handling by: - Detecting Z_BUF_ERROR (-5) returned from the inflate() call - Suggesting the user to increase CONFIG_SYS_BOOTM_LEN when applicable - Preserving the original return code from zunzip() instead of overwriting it with -1 By providing clearer hints when decompression fails due to insufficient buffer size, this change helps users diagnose and fix boot failures more easily. Signed-off-by: Aristo Chen <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2025-04-10bootm: Support load images when os is elf牛 志宏
This extends the bootm command to allow find images when os type is elf. Signed-off-by: Niu Zhihong <[email protected]>
2024-12-30lmb: Remove lmb_reserve_flags()Ilias Apalodimas
lmb_reserve() is just calling lmb_reserve_flags() with LMB_NONE. There's not much we gain from this abstraction. So let's remove the latter, add the flags argument to lmb_reserve() and make the code a bit easier to follow. Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Sam Protsenko <[email protected]> Tested-by: Sam Protsenko <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2024-10-02bootm: adjust the print formatDario Binacchi
All three addresses printed are in hexadecimal format, but only the first two have the "0x" prefix. The patch aligns the format of the "end" address with the other two by adding the "0x" prefix. Signed-off-by: Dario Binacchi <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2024-09-03lmb: bootm: remove superfluous lmb stub functionsSughosh Ganu
Remove a couple of superfluous LMB stub functions, and instead put a check for calling the lmb_reserve() function. Signed-off-by: Sughosh Ganu <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2024-09-03lmb: remove lmb_init_and_reserve_range() functionSughosh Ganu
With the move to make the LMB allocations persistent and the common memory regions being reserved during board init, there is no need for an explicit reservation of a memory range. Remove the lmb_init_and_reserve_range() function. Signed-off-by: Sughosh Ganu <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-09-03lmb: allow lmb module to be used in SPLSughosh Ganu
With the introduction of separate config symbols for the SPL phase of U-Boot, the condition checks need to be tweaked so that platforms that enable the LMB module in SPL are also able to call the LMB API's. Use the appropriate condition checks to achieve this. Signed-off-by: Sughosh Ganu <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2024-09-03lmb: make LMB memory map persistent and globalSughosh Ganu
The current LMB API's for allocating and reserving memory use a per-caller based memory view. Memory allocated by a caller can then be overwritten by another caller. Make these allocations and reservations persistent using the alloced list data structure. Two alloced lists are declared -- one for the available(free) memory, and one for the used memory. Once full, the list can then be extended at runtime. [sjg: Use a stack to store pointer of lmb struct when running lmb tests] Signed-off-by: Sughosh Ganu <[email protected]> Signed-off-by: Simon Glass <[email protected]> [sjg: Optimise the logic to add a region in lmb_add_region_flags()]
2024-07-31usb: bootm: Drop old USB-device-removal codeSimon Glass
USB is stopped using driver model now, in dm_remove_devices_flags() in announce_and_cleanup() at the top of this file. The usb_stop() call actually unbinds devices. When a USB device is unbound, it causes any bootflows attached to it to be removed, via a call to bootdev_clear_bootflows() from bootdev_pre_unbind(). This obviously makes it impossible to boot the bootflow. However, when booting a bootflow that relies on USB, usb_stop() is called, which unbinds the device. At that point any information attached to the bootflow is dropped. This is quite risky since the contents of freed memory are not guaranteed to remain unchanged. Depending on what other options are done before boot, a hard-to-find bug may crop up. Drop the call to this old function. Leave the netconsole call there, since this needs conversion to driver model. Signed-off-by: Simon Glass <[email protected]> Suggested-by: Shantur Rathore <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2024-06-30tpm: Move TCG headers into a separate fileIlias Apalodimas
commit 97707f12fdab ("tpm: Support boot measurements") moved out code from the EFI subsystem into the TPM one to support measurements when booting with !EFI. Those were moved directly into the TPM subsystem and in the tpm-v2.c library. In hindsight, it would have been better to move it in new files since the TCG2 is governed by its own spec, it's overeall cleaner and also easier to enable certain parts of the TPM functionality. So let's start moving the headers in a new file containing the TCG specific bits. Signed-off-by: Ilias Apalodimas <[email protected]>
2024-06-24Merge tag 'v2024.07-rc5' into nextTom Rini
Prepare v2024.07-rc5
2024-06-16tpm: measure DTB in PCR1 instead of PCR0Ilias Apalodimas
The PC client spec [0], doesn't describe measurements for DTBs. It does describe what do to for ACPI tables though. There is a description for ACPI in 3.3.4.1 PCR[0] – SRTM, POST BIOS, and Embedded Drivers and they explicitly mention ACPI in there. There's no mention of ACPI in 3.3.4.2 PCR[1] – Host Platform Configuration. However, in Figure 6 -- PCR Mapping of UEFI Components ACPI is shown in PCR1. The general description also mentions PCR0 is for code and PCR1 is for data such as ACPI and SMBIOS. So let's switch over the DTB measurements to PCR1 which seems a better fit. [0] https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification Reported-by: Heinrich Schuchardt <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]> Reviewed-by: Eddie James <[email protected]>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-06boot: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from all "boot/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <[email protected]>
2024-04-11boot: fdt: Change type of env_get_bootm_low() to phys_addr_tMarek Vasut
Change type of ulong env_get_bootm_low() to phys_addr_t env_get_bootm_low(). The PPC/LS systems already treat env_get_bootm_low() result as phys_addr_t, while the function itself still returns ulong. This is potentially dangerous on 64bit systems, where ulong might not be large enough to hold the content of "bootm_low" environment variable. Fix it by using phys_addr_t, similar to what env_get_bootm_size() does, which returns phys_size_t . Reviewed-by: Laurent Pinchart <[email protected]> Reported-by: Laurent Pinchart <[email protected]> Signed-off-by: Marek Vasut <[email protected]>
2024-01-11boot: Support decompressing non-kernel OS imagesSimon Glass
Sometimes the kernel is built as an EFI application rather than a binary. We still want to support compression for this case. For arm64 the entry point is set later in the bootm_load_os() function, since these images are typically relocated due to the 2MB-alignment requirement of arm64 images. But since the EFI image is not in the same format, we need to update the entry point earlier. Set the entry point always, for kernel_noload to resolve this problem. It should be harmless to do this always. Signed-off-by: Simon Glass <[email protected]>
2023-12-21Merge patch series "Complete decoupling of bootm logic from commands"Tom Rini
Simon Glass <[email protected]> says: This series continues refactoring the bootm code to allow it to be used with CONFIG_COMMAND disabled. The OS-handling code is refactored and a new bootm_run() function is created to run through the bootm stages. This completes the work. A booti_go() function is created also, in case it proves useful, but at last for now standard boot does not use this. This is cmdd (part d of CMDLINE refactoring) It depends on dm/bootstda-working which depends on dm/cmdc-working
2023-12-21bootm: Create a new boot_run() function to handle bootingSimon Glass
Create a common function used by the three existing bootz/i/m_run() functions, to reduce duplicated code. Signed-off-by: Simon Glass <[email protected]> Suggested-by: Tom Rini <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Create a function to run through the booti statesSimon Glass
In a few places, the booti command is used to handle a boot. We want these to be done without needing CONFIG_CMDLINE, so add a new booti_run() function to handle this. So far this is not used. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Create a function to run through the bootz statesSimon Glass
In a few places, the bootz command is used to handle a boot. We want these to be done without needing CONFIG_CMDLINE, so add a new bootz_run() function to handle this. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Create a function to run through the bootm statesSimon Glass
In quite a few places, the bootm command is used to handle a boot. We want these to be done without needing CONFIG_CMDLINE, so add a new bootm_run() function to handle this. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Tidy up boot_selected_os()Simon Glass
Use struct bootm_info with this function, to avoiding needing to create a new one. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Rename do_bootm_states() to bootm_run_states()Simon Glass
Rename the function to bootm_run_states() to better indicate ts purpose. The 'do_' prefix is used to indicate a command processor, which this is now not. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Drop arguments from do_bootm_states()Simon Glass
Use the bootm_info struct to hold the information required by bootm. Now that none of the functions called from do_bootm_states() needs an argv[] list, change the arguments of do_bootm_states() as well. Take care to use the same value for boot_progress even though it is a little inconsistent. For booti make sure it only uses argv[] and argc at the top of the function, so we can eventually refactor to remove these parameters. With bootm, some OSes need access to the arguments provided to the command, so set these up in the bootm_info struct, for bootm only. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Move do_bootm_states() comment to header fileSimon Glass
This is an exported function, so move the function comment to the bootm.h header file. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Add more fields to bootm_infoSimon Glass
Add fields for the three bootm parameters and other things needed for booting. Also add a helper to set up the struct correctly. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Adjust arguments of boot_os_fnSimon Glass
Adjust boot_os_fn to use struct bootm_info instead of the separate argc, argv and image parameters. Update the handlers accordingly. Few of the functions make use of the arguments, so this improves code size slightly. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-21bootm: Adjust how the board is resetSimon Glass
Use reset_cpu() to reset the board, copying the logic from the 'reset' command. This makes more sense than directly calling the do_reset() function with the arguments passsed to the bootm command. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]> Reviewed-by: Mattijs Korpershoek <[email protected]>
2023-12-20bootm: Fix flags used for bootargs string substitutionPiotr Kubik
Commit 51bb33846ad2 ("bootm: Support string substitution in bootargs") introduced a feature of bootargs string substitution and changed a flag used in bootm_process_cmdline_env() call to be either true or false. With this flag value, condition in bootm_process_cmdline() `if (flags & BOOTM_CL_SUBST)` is never true and process_subst() is never called. Add a simple test to verify if substitution works OK. Signed-off-by: Piotr Kubik <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-12-15Merge patch series "bootm: Handle compressed arm64 images with bootm"Tom Rini
To quote the author: This little series corrects a problem I noticed with arm64 images, where the kernel is not recognised if compression is used: U-Boot> tftp image.fit Using ethernet@7d580000 device TFTP from server 192.168.4.7; our IP address is 192.168.4.147 Filename 'image.fit'. Load address: 0x1000000 Loading: ################################################## 23 MiB 20.5 MiB/s done Bytes transferred = 24118272 (1700400 hex) U-Boot> bootm ## Loading kernel from FIT Image at 01000000 ... Using 'conf-768' configuration Trying 'kernel' kernel subimage Description: Linux Type: Kernel Image (no loading done) Compression: gzip compressed Data Start: 0x01000120 Data Size: 13662338 Bytes = 13 MiB Verifying Hash Integrity ... OK Bad Linux ARM64 Image magic! With this series: U-Boot> tftp 20000000 image.fit Using ethernet@7d580000 device TFTP from server 192.168.4.7; our IP address is 192.168.4.147 Filename 'image.fit'. Load address: 0x20000000 Loading: ################################################## 23.5 MiB 20.8 MiB/s done Bytes transferred = 24642560 (1780400 hex) U-Boot> bootm 0x20000000 ## Loading kernel from FIT Image at 20000000 ... Using 'conf-768' configuration Trying 'kernel' kernel subimage Description: Linux Type: Kernel Image (no loading done) Compression: zstd compressed Data Start: 0x20000120 Data Size: 14333475 Bytes = 13.7 MiB Verifying Hash Integrity ... OK Using kernel load address 80000 ## Loading fdt from FIT Image at 20000000 ... Using 'conf-768' configuration Trying 'fdt-768' fdt subimage Description: Raspberry Pi 4 Model B Type: Flat Device Tree Compression: zstd compressed Data Start: 0x215f820c Data Size: 9137 Bytes = 8.9 KiB Architecture: AArch64 Verifying Hash Integrity ... OK Uncompressing Flat Device Tree to 3aff3010 Booting using the fdt blob at 0x3aff3010 Working FDT set to 3aff3010 Uncompressing Kernel Image (no loading done) to 80000 Moving Image from 0x80000 to 0x200000, end=2b00000 Using Device Tree in place at 000000003aff3010, end 000000003afff4c4 Working FDT set to 3aff3010 Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083] The problem is that the arm64 magic is checked before the image is decompressed. However this is only part of it. The kernel_noload image type doesn't work with compression, since the kernel is not loaded. So this series deals with that by using an lmb-allocated buffer for the uncompressed kernel. Another issue is that the arm64 handling is done too early, before the image is loaded. This series moves it to after loading, so that compression can be handled. A patch is included to show the kernel load-address, so it is easy to see what is going on. One annoying feature of arm64 is that the image is often copied to another address. It might be possible for U-Boot to figure that out earlier and decompress it to the right place, but perhaps not. With all of this it should be possible to boot a compressed kernel on any of the 990 arm64 boards supported by Linux, although I have only tested two.
2023-12-15bootm: Support kernel_noload with compressionSimon Glass
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 <[email protected]> Signed-off-by: Simon Glass <[email protected]> Suggested-by: Tom Rini <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2023-12-15bootm: Move arm64-image processing laterSimon Glass
If the image is compressed, then the existing check fails, since the header is wrong. Move the check later in the boot process, after the kernel is decompressed. This allows use of bootm with compressed kernels, while still permitting an uncompressed kernel to be used. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-13command: Introduce functions to obtain command argumentsSimon Glass
Add some functions which provide an argument to a command, or NULL if the argument does not exist. Use the same numbering as argv[] since it seems less confusing than the previous idea. Signed-off-by: Simon Glass <[email protected]> Suggested-by: Tom Rini <[email protected]>
2023-12-13bootm: Reduce arguments to bootm_find_other()Simon Glass
Rather than passing the full list of command arguments, pass only those which are needed. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-13bootm: Add a function to check overlapSimon Glass
Move this code into a function to reduce code size and make it easier to understand. Drop the unnecessary 0x to help a little with code size. Use this in bootm_find_images() Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-13bootm: Adjust the parameters of bootm_find_images()Simon Glass
Rather than passing it all the command-line args, pass in the pieces that it needs. These are the image address, the ramdisk address/name and the FDT address/name. Ultimately this will allow usage of this function without being called from the command line. Move the function comment to the header file and tidy it a little. Signed-off-by: Simon Glass <[email protected]>
2023-12-13bootm: optee: Drop special call to bootm_find_other()Simon Glass
The normal bootm flow calls bootm_find_other() can call the BOOTM_STATE_FINDOTHER state as part of its processing. Fix the condition there so that this hack can be removed. Also drop the confusing check for the OS type, since do_bootm_tee() is only called if the condition is met - see bootm_os_get_boot_func() Signed-off-by: Simon Glass <[email protected]>
2023-12-13bootm: efi: Drop special call to bootm_find_other()Simon Glass
The normal bootm flow calls bootm_find_other() can call the BOOTM_STATE_FINDOTHER state as part of its processing. Fix the condition there so that this hack can be removed. Signed-off-by: Simon Glass <[email protected]>
2023-12-13bootm: Simplify Android ramdisk addr in bootm_find_images()Simon Glass
The Android mechanism uses the loadaddr envrionment-variable to get the load address, if none is provided. This is equivalent to image_load_addr so use that instead, converting it to a string as needed. This change will permit passing img_addr to this function, in a future change. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-13bootm: Reduce arguments to boot_get_loadables()Simon Glass
This function only uses two arguments. The 'arch' always has a constant value, so drop it. This simplifies the function call. Tidy up the function comment while we are here. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>
2023-12-13bootm: Reduce arguments to boot_get_fpga()Simon Glass
This function only uses two arguments. The 'arch' always has a constant value, so drop it. This simplifies the function call. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Tom Rini <[email protected]>