[PATCH 3/5] bootstd: Avoid allocating memory for the EFI file

Tom Rini trini at konsulko.com
Thu Aug 3 23:46:54 CEST 2023


On Wed, Jul 26, 2023 at 09:01:23PM -0600, Simon Glass wrote:

> 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 at chromium.org>
> Reported-by: Da Xue <da at libre.computer>
> Reported-by: Vincent Stehlé <vincent.stehle at arm.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230803/dba2a22a/attachment.sig>


More information about the U-Boot mailing list