SHA256
1
0
forked from pool/u-boot
u-boot/efi_loader-Call-fdt-preparation-functions.patch
Dominique Leuenberger cad836ad68 Accepting request 366093 from Base:System
Sorry for the supersede, this fixes a small issue with beaglebone where grub2
would overwrite the initrd while patching the device tree because it's missing
boundary checks.

- EFI: Map fdt as reserved
  * efi-map-fdt-as-reserved.patch

- Fix OMAP3 boards to load u-boot from raw sector offset
  * omap3-Use-raw-SPL-by-default-for-mmc1.patch

- Allow grub2 to find its config
  * efi_loader-Pass-proper-device-path-in-on-boot.patch
- Fix Raspberry Pi 1 build
  * efi_loader-Provide-icache-flush-stub.patch

- Move omap3 to distro bootcmd (to enable efi boot on beagle-xm)
  * omap3-Move-to-distro-bootcmd.patch
- Add EFI patch to support FDT fixups (patches in RAM size)
  * efi_loader-Call-fdt-preparation-functions.patch

- Patch the default u-boot env to search for dtb in /boot at part 2
  * efi-default-env.patch

- Use $fdtfile rather than $fdt_name everywhere:
  * efi2.patch

- Add EFI support about to move upstream:
  * efi.patch

- EFI: Map fdt as reserved
  * efi-map-fdt-as-reserved.patch

- Fix OMAP3 boards to load u-boot from raw sector offset
  * omap3-Use-raw-SPL-by-default-for-mmc1.patch (forwarded request 365802 from algraf)

OBS-URL: https://build.opensuse.org/request/show/366093
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/u-boot?expand=0&rev=68
2016-03-07 12:27:45 +00:00

74 lines
2.4 KiB
Diff

From 289d5c6d680d1c7a9e7c0ca4e3152dbfca67004c Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Mar 2016 00:35:06 +0100
Subject: [PATCH 1/1] efi_loader: Call fdt preparation functions
We have a nice framework around image fils to prepare a device tree
for OS execution. That one patches in missing device tree nodes and
fixes up the memory range bits.
We need to call that one from the EFI boot path too to get all those
nice fixups. This patch adds the call.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
cmd/bootefi.c | 8 ++++++++
common/image-fdt.c | 8 +++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index e3e51d4..45d193a 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -90,6 +90,7 @@ static struct efi_object bootefi_device_obj = {
static unsigned long do_bootefi_exec(void *efi)
{
ulong (*entry)(void *image_handle, struct efi_system_table *st);
+ bootm_headers_t img = { 0 };
/*
* gd lives in a fixed register which may get clobbered while we execute
@@ -100,6 +101,13 @@ static unsigned long do_bootefi_exec(void *efi)
/* Update system table to point to our currently loaded FDT */
if (working_fdt) {
+ /* Prepare fdt for payload */
+ if (image_setup_libfdt(&img, working_fdt, 0, NULL)) {
+ printf("ERROR: Failed to process device tree\n");
+ return -EINVAL;
+ }
+
+ /* Link to it in the efi tables */
systab.tables[0].guid = EFI_FDT_GUID;
systab.tables[0].table = working_fdt;
systab.nr_tables = 1;
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 79fa655..5a1b432 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -502,8 +502,9 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
fdt_fixup_ethernet(blob);
/* Delete the old LMB reservation */
- lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
- (phys_size_t)fdt_totalsize(blob));
+ if (lmb)
+ lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
+ (phys_size_t)fdt_totalsize(blob));
ret = fdt_shrink_to_minimum(blob);
if (ret < 0)
@@ -515,7 +516,8 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
fdt_set_totalsize(blob, of_size);
}
/* Create a new LMB reservation */
- lmb_reserve(lmb, (ulong)blob, of_size);
+ if (lmb)
+ lmb_reserve(lmb, (ulong)blob, of_size);
fdt_initrd(blob, *initrd_start, *initrd_end);
if (!ft_verify_fdt(blob))
--
2.7.1