u-boot/boot
Simon Glass 6a8c2f9781 bootstd: Avoid allocating memory for the EFI file
The current bootflow-iteration algorithm reads the bootflow file into
an allocated memory buffer so it can be examined. This works well in
most cases.

However, while the common case is that the first bootflow is immediately
booted, it is also possible just to scan for available bootflows, perhaps
selecting one to boot later.

Even with the common case, EFI bootflows can be quite large. It doesn't
make sense to read it into an allocated buffer when we have kernel_addr_t
providing a suitable address for it. Even if we do have plenty of malloc()
space available, it is a violation of U-Boot's lazy-init principle to
read the bootflow before it is needed.

So overall it seems better to make a change.

Adjust the logic to read just the size of the EFI file at first. Later,
when the bootflow is booted, read the rest of the file into the designated
kernel buffer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Da Xue <da@libre.computer>
Reported-by: Vincent Stehlé <vincent.stehle@arm.com>
2023-08-03 15:30:54 -04:00
..
android_ab.c android_ab: Try backup booloader_message 2023-07-17 16:20:08 -04:00
boot_fit.c global: Use proper project name U-Boot 2023-06-12 13:24:31 +02:00
bootdev-uclass.c boot: fix bootdev_list() 2023-08-02 12:05:57 -06:00
bootflow.c bootstd: Support automatically setting Linux parameters 2023-07-17 13:38:35 +08:00
bootflow_internal.h bootstd: Support creating a boot menu 2023-01-16 18:26:50 -05:00
bootflow_menu.c expo: Rename exp_set_text_mode() 2023-07-14 12:54:51 -04:00
bootm.c bootm: don't call booti_setup for EFI images 2023-06-16 06:45:20 +02:00
bootm_os.c treewide: Drop image_header_t typedef 2022-09-29 16:07:57 -04:00
bootmeth-uclass.c bootflow: Export setup_fs() 2023-08-03 15:30:53 -04:00
bootmeth_cros.c bootstd: Add a simple bootmeth for ChromiumOS 2023-07-17 13:38:35 +08:00
bootmeth_efi.c bootstd: Avoid allocating memory for the EFI file 2023-08-03 15:30:54 -04:00
bootmeth_efi_mgr.c bootstd: Rename bootdev checkers 2023-01-23 18:11:40 -05:00
bootmeth_extlinux.c bootstd: Fix relative path use in extlinux bootmeth 2023-06-14 12:56:10 -04:00
bootmeth_pxe.c bootstd: Rename distro and syslinux to extlinux 2023-05-13 09:52:32 -04:00
bootmeth_qfw.c bootstd: Correct the name of the QEMU bootmeth 2023-07-16 23:13:17 +08:00
bootmeth_sandbox.c bootstd: Rename distro and syslinux to extlinux 2023-05-13 09:52:32 -04:00
bootmeth_script.c bootstd: USB devtype detection for script boot 2023-07-20 14:10:57 -06:00
bootretry.c cyclic: Use schedule() instead of WATCHDOG_RESET() 2022-09-18 10:26:33 +02:00
bootstd-uclass.c bootstd: Remove special-case code for boot_targets 2023-01-23 18:11:39 -05:00
cedit.c expo: Add a configuration editor 2023-07-14 12:54:51 -04:00
common_fit.c Create a new boot/ directory 2021-11-11 19:01:56 -05:00
expo.c expo: Support building an expo from a description file 2023-07-14 12:54:51 -04:00
expo_build.c expo: Add a configuration editor 2023-07-14 12:54:51 -04:00
fdt_region.c doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
image-android-dt.c doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
image-android.c android: boot: support bootconfig 2023-04-04 14:50:47 -04:00
image-board.c boot/image-board.c: Silence warning in select_ramdisk 2023-04-25 15:31:27 -04:00
image-cipher.c Create a new boot/ directory 2021-11-11 19:01:56 -05:00
image-fdt.c android: boot: support boot image header version 3 and 4 2023-04-04 14:50:47 -04:00
image-fit-sig.c mkimage: fit: Fix signing of configs with external data 2022-10-26 11:36:06 -04:00
image-fit.c image: Allow loading a FIT image for a particular phase 2022-10-31 11:02:45 -04:00
image-host.c Create a new boot/ directory 2021-11-11 19:01:56 -05:00
image-pre-load.c boot: image-pre-load: Check environment for location of signature info 2022-10-11 15:40:48 -04:00
image-sig.c Create a new boot/ directory 2021-11-11 19:01:56 -05:00
image.c tools: spkgimage: add Renesas SPKG format 2023-05-13 04:01:30 +02:00
Kconfig Kconfig: Enable FIT_SIGNATURE if ARM64 2023-07-21 22:07:46 -04:00
Makefile bootstd: Add a simple bootmeth for ChromiumOS 2023-07-17 13:38:35 +08:00
pxe_utils.c net: dhcp6: pxe: Add DHCP/PXE commands for IPv6 2023-05-05 17:48:44 -04:00
scene.c expo: Add a configuration editor 2023-07-14 12:54:51 -04:00
scene_internal.h expo: Add a configuration editor 2023-07-14 12:54:51 -04:00
scene_menu.c expo: Add spacing around menus and items 2023-07-14 12:54:51 -04:00
vbe.c boot: fix vbe_find_first_device() 2022-08-26 16:32:59 -06:00
vbe_request.c Correct SPL use of DM_RNG 2023-03-02 17:45:58 -05:00
vbe_simple.c boot: vbe_simple: Fix vbe_simple_read_bootflow() dependency 2023-04-28 11:30:17 -06:00
vbe_simple.h vbe: Move OS implementation into a separate file 2022-10-31 11:03:36 -04:00
vbe_simple_fw.c bootstd: Treat DHCP and PXE as bootdev labels 2023-01-23 18:11:41 -05:00
vbe_simple_os.c vbe: Allow probing the VBE bootmeth to fail in OS fixup 2023-01-18 19:41:16 -05:00