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>
Please register or sign in to comment