
From: Simon Glass <sjg@chromium.org> Before bootstd, boot scripts were used to boot distros. These worked by using a 'load' command to load a file and a 'bootm' command to boot. Obviously these commands need addresses, so the approach taken was to define a number of environment variables to provide them, for the various situations. These are documented at [1]. With bootstd, booting is built into U-Boot so there is no real need for these variables. Also, bootstd records all loaded images in a list, so knows where and what they are. However, since bootstd uses much of the same code as the bootm command, for example, to date it has used these same variables. This is OK to some extent, since boards maintainers have got used to the need to statically configure the addresses used for a kernel, ramdisk, devicetree, etc. But is does cause problems: - since the kernel and initrd can grow quite a bit from year to year, sometimes the values need to be updated to save space [2] - some boards don't have fixed addresses (such as the EFI app) - fixed values means that much more space must be provided than is normally needed; for this reason the ramdisk is generally at the highest address The variables do have some benefit, e.g. for people who want things loaded at a known location, so it makes sense to keep them around. But they should be optional. This series starts the process of removing the requirement for these variables, focussing on the extlinux code. It mostly consists of refactoring. Several functions are updated to support lmb reservation. At least for filesystems, bootstd can query the file size and use lmb to reserve the required amount of (aligned) memory. The bootmeth read_file() method is updated to handle this. When decompressing, bootm is updated to support reservation (instead of an address) for the decompressed file. With these in place, various patches are provided to work this new feature into the pxe_utils code used by extlinux. The next step after this is to attack the bootm code itself, so that the struct bootm_info controls the addresses, without any environment variables. That will be the subject of the next series. [1] https://docs.u-boot.org/en/latest/develop/distro.html#required-environment-v... [2] https://patchwork.ozlabs.org/project/uboot/patch/20241220003447.2913443-5-sj... Simon Glass (19): boot: Given up pxe boot if kernel_addr_r is missing boot: pxe: Init initrd_str in label_boot() boot: Update bootmeth read_file() to support reservation boot: Update pxe_getfile_func() to support reservation boot: Adjust PXE get_relfile() to support reservation boot: Provide functions to set the bootm string-fields boot: Return the chosen address from get_relfile_envaddr() boot: Convert struct pxe_context initrd address to ulong boot: Convert struct pxe_context initrd_filesize to ulong boot: pxe: Rename conf_fdt to conf_fdt_str boot: Add a conf_fdt ulong to struct pxe_context boot: Drop the allocation in label_boot() boot: Support reserving memory in get_relfile_envaddr() boot: Rename kern_addr in label_boot() boot: Simplify kernel-address handling in label_boot() boot: pxe: Allow loading a kernel without kernel_addr_r boot: pxe: Rename kern_addr in struct pxe_context boot: pxe: Retain the kernel address in the context boot: Pass the full bootm_info to bootm_find_os() boot/bootm.c | 37 +++++-- boot/bootmeth-uclass.c | 24 +++-- boot/bootmeth_android.c | 2 +- boot/bootmeth_cros.c | 2 +- boot/bootmeth_efi.c | 6 +- boot/bootmeth_efi_mgr.c | 2 +- boot/bootmeth_extlinux.c | 9 +- boot/bootmeth_fel.c | 2 +- boot/bootmeth_pxe.c | 23 +++-- boot/bootmeth_qfw.c | 10 +- boot/bootmeth_sandbox.c | 2 +- boot/pxe_utils.c | 214 ++++++++++++++++++++------------------- boot/vbe_abrec.c | 6 +- boot/vbe_abrec_os.c | 16 ++- boot/vbe_simple.c | 9 +- cmd/pxe.c | 7 +- cmd/sysboot.c | 11 +- include/bootm.h | 62 ++++++++++++ include/bootmeth.h | 22 ++-- include/pxe_utils.h | 31 +++--- 20 files changed, 305 insertions(+), 192 deletions(-) -- 2.43.0 base-commit: 6cff8aa606a628ad117ccd9100c36f61d0365dd3 branch: loadk