Newer EFI loader fix patch, Fix static MAC on omap3/omap4 devices

This commit is contained in:
Peter Robinson 2017-11-23 13:16:16 +00:00
parent f9dc956b0c
commit 0f976adcdd
3 changed files with 81 additions and 17 deletions

View File

@ -1,43 +1,68 @@
From patchwork Tue Nov 21 12:24:32 2017 From patchwork Wed Nov 22 03:18:59 2017
Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0 MIME-Version: 1.0
Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit
Subject: [U-Boot] efi_loader: initialise partition_signature memory Subject: [U-Boot,v2] efi_loader: initialise partition_signature memory
X-Patchwork-Submitter: Jonathan Gray <jsg@jsg.id.au> X-Patchwork-Submitter: Jonathan Gray <jsg@jsg.id.au>
X-Patchwork-Id: 839994 X-Patchwork-Id: 840248
Message-Id: <20171121122432.88805-1-jsg@jsg.id.au> Message-Id: <20171122031859.12600-1-jsg@jsg.id.au>
To: u-boot@lists.denx.de To: u-boot@lists.denx.de
Cc: agraf@suse.de, kettenis@openbsd.org Cc: kettenis@openbsd.org, agraf@suse.de
Date: Tue, 21 Nov 2017 23:24:32 +1100 Date: Wed, 22 Nov 2017 14:18:59 +1100
From: Jonathan Gray <jsg@jsg.id.au> From: Jonathan Gray <jsg@jsg.id.au>
List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Id: U-Boot discussion <u-boot.lists.denx.de>
Zero partition_signature in the efi_device_path_hard_drive_path Zero partition_signature in the efi_device_path_hard_drive_path
structure when signature_type is zero. structure when signature_type is 0 (no signature) as required by the
UEFI specification.
This is required so that efi_dp_match() will work as expected This is required so that efi_dp_match() will work as expected
when doing memcmp() comparisons. when doing memcmp() comparisons. Previously uninitialised memory
would cause it not match nodes when it should have when the signature
type was not GUID.
Corrects a problem where the loaded image protocol would not return a Corrects a problem where the loaded image protocol would not return a
device path with MEDIA_DEVICE causing the OpenBSD bootloader to fail device path with MEDIA_DEVICE causing the OpenBSD bootloader to fail
on rpi_3 and other targets. on rpi_3 and other targets.
v2: Also handle signature_type 1 (MBR) as described in the specification
Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
--- ---
lib/efi_loader/efi_device_path.c | 3 +++ lib/efi_loader/efi_device_path.c | 21 +++++++++++++++++++--
1 file changed, 3 insertions(+) 1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index f6e368e029..8045532a29 100644 index f6e368e029..12a81d311c 100644
--- a/lib/efi_loader/efi_device_path.c --- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c
@@ -431,6 +431,9 @@ static void *dp_part_fill(void *buf, struct blk_desc *desc, int part) @@ -427,10 +427,27 @@ static void *dp_part_fill(void *buf, struct blk_desc *desc, int part)
if (hddp->signature_type != 0) hddp->partmap_type = 2;
memcpy(hddp->partition_signature, &desc->guid_sig, else
sizeof(hddp->partition_signature)); hddp->partmap_type = 1;
+ else - hddp->signature_type = desc->sig_type;
- if (hddp->signature_type != 0)
+
+ switch (desc->sig_type) {
+ case SIG_TYPE_NONE:
+ default:
+ hddp->signature_type = 0;
+ memset(hddp->partition_signature, 0, + memset(hddp->partition_signature, 0,
+ sizeof(hddp->partition_signature)); + sizeof(hddp->partition_signature));
+ break;
+ case SIG_TYPE_MBR:
+ hddp->signature_type = 1;
+ memset(hddp->partition_signature, 0,
+ sizeof(hddp->partition_signature));
+ memcpy(hddp->partition_signature, &desc->mbr_sig,
+ sizeof(desc->mbr_sig));
+ break;
+ case SIG_TYPE_GUID:
+ hddp->signature_type = 2;
memcpy(hddp->partition_signature, &desc->guid_sig,
sizeof(hddp->partition_signature));
+ break;
+ }
buf = &hddp[1]; buf = &hddp[1];
} }

View File

@ -0,0 +1,34 @@
From 7c704eb7a615e35fe74bc8ff4ff2e5c71f1473b3 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Thu, 23 Nov 2017 12:44:51 +0000
Subject: [PATCH] omap2: set the ethaddr as well as the usbethaddr env var to
ensure static MAC
The kernel gets the ethernet MAC from the ethaddr variable, the omap boards for
devices with USB based eth adapters just set the usbethaddr which doesn't appear
to get passed to the kernel. The same Raspberry Pi code sets both ethaddr and
usbethaddr so lets do that so linux (tested 4.13 and 4.14) get a static rather
than a random MAC address, while not regressing users of usbethaddr.
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
arch/arm/mach-omap2/utils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index 2e8778043b..95f168fee3 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -215,6 +215,9 @@ void omap_die_id_usbethaddr(void)
mac[5] = (die_id[0] >> 8) & 0xff;
eth_env_set_enetaddr("usbethaddr", mac);
+
+ if (!env_get("ethaddr"))
+ eth_env_set_enetaddr("ethaddr", mac);
}
}
--
2.14.3

View File

@ -2,7 +2,7 @@
Name: uboot-tools Name: uboot-tools
Version: 2017.11 Version: 2017.11
Release: 2%{?candidate:.%{candidate}}%{?dist} Release: 3%{?candidate:.%{candidate}}%{?dist}
Summary: U-Boot utilities Summary: U-Boot utilities
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
URL: http://www.denx.de/wiki/U-Boot URL: http://www.denx.de/wiki/U-Boot
@ -24,6 +24,7 @@ Patch4: fdt-fixes.patch
Patch5: arm64-support-running-at-addr-other-than-linked-to.patch Patch5: arm64-support-running-at-addr-other-than-linked-to.patch
Patch6: envtools-make-sure-version-timestamp-header-file-are-available.patch Patch6: envtools-make-sure-version-timestamp-header-file-are-available.patch
Patch7: efi_loader-initialise-partition_signature-memory.patch Patch7: efi_loader-initialise-partition_signature-memory.patch
Patch8: omap2-set-the-ethaddr-as-well-as-the-usbethaddr-env-.patch
# Board fixes and enablement # Board fixes and enablement
Patch10: dragonboard-fixes.patch Patch10: dragonboard-fixes.patch
@ -286,6 +287,10 @@ cp -p board/warp7/README builds/docs/README.warp7
%endif %endif
%changelog %changelog
* Thu Nov 23 2017 Peter Robinson <pbrobinson@fedoraproject.org> 2017.11-3
- Newer EFI loader fix patch
- Fix static MAC on omap3/omap4 devices
* Tue Nov 21 2017 Peter Robinson <pbrobinson@fedoraproject.org> 2017.11-2 * Tue Nov 21 2017 Peter Robinson <pbrobinson@fedoraproject.org> 2017.11-2
- Add EFI loader fix - Add EFI loader fix