From 0f976adcdd6d30dc1786d29fd04c0c4f792b490f Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 23 Nov 2017 13:16:16 +0000 Subject: [PATCH] Newer EFI loader fix patch, Fix static MAC on omap3/omap4 devices --- ...nitialise-partition_signature-memory.patch | 57 +++++++++++++------ ...haddr-as-well-as-the-usbethaddr-env-.patch | 34 +++++++++++ uboot-tools.spec | 7 ++- 3 files changed, 81 insertions(+), 17 deletions(-) create mode 100644 omap2-set-the-ethaddr-as-well-as-the-usbethaddr-env-.patch diff --git a/efi_loader-initialise-partition_signature-memory.patch b/efi_loader-initialise-partition_signature-memory.patch index 36b6ca0..e4be16b 100644 --- a/efi_loader-initialise-partition_signature-memory.patch +++ b/efi_loader-initialise-partition_signature-memory.patch @@ -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" MIME-Version: 1.0 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 -X-Patchwork-Id: 839994 -Message-Id: <20171121122432.88805-1-jsg@jsg.id.au> +X-Patchwork-Id: 840248 +Message-Id: <20171122031859.12600-1-jsg@jsg.id.au> To: u-boot@lists.denx.de -Cc: agraf@suse.de, kettenis@openbsd.org -Date: Tue, 21 Nov 2017 23:24:32 +1100 +Cc: kettenis@openbsd.org, agraf@suse.de +Date: Wed, 22 Nov 2017 14:18:59 +1100 From: Jonathan Gray List-Id: U-Boot discussion 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 -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 device path with MEDIA_DEVICE causing the OpenBSD bootloader to fail on rpi_3 and other targets. +v2: Also handle signature_type 1 (MBR) as described in the specification + Signed-off-by: Jonathan Gray --- - lib/efi_loader/efi_device_path.c | 3 +++ - 1 file changed, 3 insertions(+) + lib/efi_loader/efi_device_path.c | 21 +++++++++++++++++++-- + 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 -index f6e368e029..8045532a29 100644 +index f6e368e029..12a81d311c 100644 --- a/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) - if (hddp->signature_type != 0) - memcpy(hddp->partition_signature, &desc->guid_sig, - sizeof(hddp->partition_signature)); -+ else +@@ -427,10 +427,27 @@ static void *dp_part_fill(void *buf, struct blk_desc *desc, int part) + hddp->partmap_type = 2; + else + hddp->partmap_type = 1; +- 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, + 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]; } diff --git a/omap2-set-the-ethaddr-as-well-as-the-usbethaddr-env-.patch b/omap2-set-the-ethaddr-as-well-as-the-usbethaddr-env-.patch new file mode 100644 index 0000000..cbfbfa6 --- /dev/null +++ b/omap2-set-the-ethaddr-as-well-as-the-usbethaddr-env-.patch @@ -0,0 +1,34 @@ +From 7c704eb7a615e35fe74bc8ff4ff2e5c71f1473b3 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +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 +--- + 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 + diff --git a/uboot-tools.spec b/uboot-tools.spec index a3ac7df..e659b2c 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -2,7 +2,7 @@ Name: uboot-tools Version: 2017.11 -Release: 2%{?candidate:.%{candidate}}%{?dist} +Release: 3%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ 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 Patch6: envtools-make-sure-version-timestamp-header-file-are-available.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 Patch10: dragonboard-fixes.patch @@ -286,6 +287,10 @@ cp -p board/warp7/README builds/docs/README.warp7 %endif %changelog +* Thu Nov 23 2017 Peter Robinson 2017.11-3 +- Newer EFI loader fix patch +- Fix static MAC on omap3/omap4 devices + * Tue Nov 21 2017 Peter Robinson 2017.11-2 - Add EFI loader fix