From: Simon Glass <simon.glass@canonical.com>
Remove the upfront check for fdtoverlay_addr_r environment variable.
If it doesn't exist, get_relfile_envaddr() will reserve an address
using LMB.
Also use the address returned by get_relfile_envaddr() for mapping the
overlay blob, rather than re-reading from the environment variable.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
boot/pxe_utils.c | 13 +------------
test/boot/pxe.c | 13 ++++++++-----
2 files changed, 9 insertions(+), 17 deletions(-)
@@ -307,23 +307,12 @@ static void label_boot_fdtoverlay(struct pxe_context *ctx,
struct pxe_label *label)
{
char *fdtoverlay = label->fdtoverlays;
- char *fdtoverlay_addr_env;
- ulong fdtoverlay_addr;
int err;
err = fdt_check_header(ctx->fdt);
if (err)
return;
- /* Get the specific overlay loading address */
- fdtoverlay_addr_env = env_get("fdtoverlay_addr_r");
- if (!fdtoverlay_addr_env) {
- printf("Invalid fdtoverlay_addr_r for loading overlays\n");
- return;
- }
-
- fdtoverlay_addr = hextoul(fdtoverlay_addr_env, NULL);
-
/* Cycle over the overlay files and apply them in order */
do {
struct fdt_header *blob;
@@ -362,7 +351,7 @@ static void label_boot_fdtoverlay(struct pxe_context *ctx,
/* Resize main fdt */
fdt_shrink_to_minimum(ctx->fdt, 8192);
- blob = map_sysmem(fdtoverlay_addr, 0);
+ blob = map_sysmem(addr, 0);
err = fdt_check_header(blob);
if (err) {
printf("Invalid overlay %s, skipping\n",
@@ -611,8 +611,8 @@ PXE_TEST_ARGS(pxe_test_errors_norun, UTF_CONSOLE | UTF_MANUAL,
* Test overlay loading when fdtoverlay_addr_r is not set
*
* This tests that when a label has fdtoverlays but fdtoverlay_addr_r is not
- * set, the overlay loading is skipped with an appropriate warning message,
- * but the FDT is still loaded successfully.
+ * set, overlay loading is attempted via LMB allocation. The FDT is still
+ * loaded successfully even if overlays fail to load.
*/
static int pxe_test_overlay_no_addr_norun(struct unit_test_state *uts)
{
@@ -676,13 +676,16 @@ static int pxe_test_overlay_no_addr_norun(struct unit_test_state *uts)
ut_assertok(fdt_check_header(fdt));
/*
- * Check console output - FDT loaded, but overlays skipped with
- * warning about missing fdtoverlay_addr_r
+ * Check console output - FDT loaded, overlays attempted via LMB
+ * allocation but fail since test environment cannot load them
*/
ut_assert_nextline("Retrieving file: /vmlinuz");
ut_assert_nextline("Retrieving file: /initrd.img");
ut_assert_nextline("Retrieving file: /dtb/board.dtb");
- ut_assert_nextline("Invalid fdtoverlay_addr_r for loading overlays");
+ ut_assert_nextline("Retrieving file: /dtb/overlay1.dtbo");
+ ut_assert_nextline("Failed loading overlay /dtb/overlay1.dtbo");
+ ut_assert_nextline("Retrieving file: /dtb/overlay2.dtbo");
+ ut_assert_nextline("Failed loading overlay /dtb/overlay2.dtbo");
ut_assert_console_end();
/* Clean up */