Github messages for voidlinux
 help / color / mirror / Atom feed
From: dataCobra <dataCobra@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] fwupd-efi: update to 1.4.
Date: Fri, 09 Feb 2024 08:13:43 +0100	[thread overview]
Message-ID: <20240209071343.4E4BF2BC43@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-47264@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

There is an updated pull request by dataCobra against master on the void-packages repository

https://github.com/dataCobra/void-packages fwupd-efi
https://github.com/void-linux/void-packages/pull/47264

fwupd-efi: update to 1.4.
#### Testing the changes
- I tested the changes in this PR: **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686



A patch file from https://github.com/void-linux/void-packages/pull/47264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-fwupd-efi-47264.patch --]
[-- Type: text/x-diff, Size: 12637 bytes --]

From 6eee7033ef409f25e2badd0f56ae981f8374494c Mon Sep 17 00:00:00 2001
From: dataCobra <datacobra@thinkbot.de>
Date: Fri, 26 Jan 2024 10:55:58 +0100
Subject: [PATCH 1/2] gnu-efi-libs: update to 3.0.15.

---
 srcpkgs/gnu-efi-libs/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/gnu-efi-libs/template b/srcpkgs/gnu-efi-libs/template
index 8e5b09f2cd20c..f1528a81c6c84 100644
--- a/srcpkgs/gnu-efi-libs/template
+++ b/srcpkgs/gnu-efi-libs/template
@@ -1,7 +1,7 @@
 # Template file for 'gnu-efi-libs'
 pkgname=gnu-efi-libs
 reverts="3.0w_1" # Not an actual revert, xbps considers 3.0w higher than 3.0.8
-version=3.0.14
+version=3.0.15
 revision=1
 makedepends="pciutils-devel"
 short_desc="Library for building UEFI Applications using GNU toolchain"
@@ -9,7 +9,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="GPL-2.0-or-later"
 homepage="https://sourceforge.net/projects/gnu-efi/"
 distfiles="${SOURCEFORGE_SITE}/gnu-efi/gnu-efi-${version}.tar.bz2"
-checksum=b73b643a0d5697d1f396d7431448e886dd805668789578e3e1a28277c9528435
+checksum=931a257b9c5c1ba65ff519f18373c438a26825f2db7866b163e96d1b168f20ea
 nostrip=yes
 
 # If we are cross-building we need to pass the cross-compilation triplet

From 954ebad81ac39d2902643d1933394741deb1fcbe Mon Sep 17 00:00:00 2001
From: dataCobra <datacobra@thinkbot.de>
Date: Fri, 9 Feb 2024 08:13:27 +0100
Subject: [PATCH 2/2] fwupd-efi: update to 1.4.

---
 .../fwupd-efi-1.4-efi_cc_ld_override.patch    | 111 ++++++++++++++++++
 .../fwupd-efi-1.4-uefi_210_fixes.patch        | 107 +++++++++++++++++
 srcpkgs/fwupd-efi/template                    |   6 +-
 3 files changed, 221 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/fwupd-efi/patches/fwupd-efi-1.4-efi_cc_ld_override.patch
 create mode 100644 srcpkgs/fwupd-efi/patches/fwupd-efi-1.4-uefi_210_fixes.patch

diff --git a/srcpkgs/fwupd-efi/patches/fwupd-efi-1.4-efi_cc_ld_override.patch b/srcpkgs/fwupd-efi/patches/fwupd-efi-1.4-efi_cc_ld_override.patch
new file mode 100644
index 0000000000000..786812aad900f
--- /dev/null
+++ b/srcpkgs/fwupd-efi/patches/fwupd-efi-1.4-efi_cc_ld_override.patch
@@ -0,0 +1,111 @@
+--- a/efi/meson.build
++++ b/efi/meson.build
+@@ -1,6 +1,8 @@
+ generate_sbat = find_program('generate_sbat.py', native: true)
+ generate_binary = find_program('generate_binary.py', native: true)
+ 
++efi_cc = get_option('efi-cc')
++efi_ld = get_option('efi-ld')
+ efi_ldsdir = get_option('efi-ldsdir')
+ efi_incdir = get_option('efi-includedir')
+ 
+@@ -18,8 +20,11 @@ endif
+ 
+ efi_libdir = get_option('efi-libdir')
+ if efi_libdir == ''
+-  multi = run_command(cc.cmd_array(), '-print-multi-os-directory').stdout().strip()
+-  efi_libdir = join_paths('/usr/lib/', multi)
++  cmd = 'cd /usr/lib/$(@0@ -print-multi-os-directory) && pwd'.format(efi_cc)
++  ret = run_command('sh', '-c', cmd)
++  if ret.returncode() == 0
++    efi_libdir = ret.stdout().strip()
++  endif
+ endif
+ 
+ have_gnu_efi = gnu_efi_path_arch != '' and efi_libdir != ''
+@@ -182,28 +187,28 @@ else
+   efi_format = ['--target=efi-app-@0@'.format(gnu_efi_arch)]
+ endif
+ 
+-libgcc_file_name = run_command(cc.cmd_array(), '-print-libgcc-file-name').stdout().strip()
++libgcc_file_name = run_command(efi_cc, '-print-libgcc-file-name').stdout().strip()
+ efi_name = 'fwupd@0@.efi'.format(EFI_MACHINE_TYPE_NAME)
+ 
+ o_file1 = custom_target('fwupdate.o',
+                         input : 'fwupdate.c',
+                         output : 'fwupdate.o',
+-                        command : [cc.cmd_array(), '-c', '@INPUT@', '-o', '@OUTPUT@']
++                        command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@']
+                                   + compile_args)
+ o_file2 = custom_target('fwup-debug.o',
+                         input : 'fwup-debug.c',
+                         output : 'fwup-debug.o',
+-                        command : [cc.cmd_array(), '-c', '@INPUT@', '-o', '@OUTPUT@']
++                        command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@']
+                                   + compile_args)
+ o_file3 = custom_target('fwup-efi.o',
+                         input : 'fwup-efi.c',
+                         output : 'fwup-efi.o',
+-                        command : [cc.cmd_array(), '-c', '@INPUT@', '-o', '@OUTPUT@']
++                        command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@']
+                                   + compile_args)
+ o_file4 = custom_target('fwup-common.o',
+                         input : 'fwup-common.c',
+                         output : 'fwup-common.o',
+-                        command : [cc.cmd_array(), '-c', '@INPUT@', '-o', '@OUTPUT@']
++                        command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@']
+                                   + compile_args)
+ 
+ o_file5 = custom_target('fwup-sbat.o',
+@@ -211,8 +216,7 @@ o_file5 = custom_target('fwup-sbat.o',
+                         command : [
+                           generate_sbat,
+                           '@OUTPUT@',
+-                          '--cc', ' '.join(cc.cmd_array()),
+-                          '--cflags', ' '.join(compile_args),
++                          '--cc', efi_cc,
+                           '--objcopy', objcopy,
+                           '--project-name', meson.project_name(),
+                           '--project-version', meson.project_version(),
+@@ -236,7 +240,7 @@ endif
+ so = custom_target('fwup.so',
+                    input : [o_file1, o_file2, o_file3, o_file4, o_file5],
+                    output : 'fwup.so',
+-                   command : [ld, '-o', '@OUTPUT@'] +
++                   command : [efi_ld, '-o', '@OUTPUT@'] +
+                              efi_ldflags + ['@INPUT@'] +
+                              ['-lefi', '-lgnuefi', libgcc_file_name],
+                    depends: fwupd_so_deps)
+--- a/efi/generate_sbat.py
++++ b/efi/generate_sbat.py
+@@ -18,12 +18,9 @@ def _generate_sbat(args):
+     FWUPD_SUMMARY = "Firmware update daemon"
+     FWUPD_URL = "https://github.com/fwupd/fwupd-efi"
+ 
+-    cmd = (
+-        args.cc.split()
+-        + ["-x", "c", "-c", "-o", args.outfile, "/dev/null"]
+-        + args.cflags.split(" ")
++    subprocess.run(
++        [args.cc, "-x", "c", "-c", "-o", args.outfile, "/dev/null"], check=True
+     )
+-    subprocess.run(cmd, check=True)
+ 
+     # not specified
+     if not args.sbat_distro_id:
+@@ -86,7 +83,6 @@ if __name__ == "__main__":
+     parser.add_argument(
+         "--cc", default="gcc", help="Compiler to use for generating sbat object"
+     )
+-    parser.add_argument("--cflags", help="C compiler flags to be used by CC")
+     parser.add_argument(
+         "--objcopy", default="objcopy", help="Binary file to use for objcopy"
+     )
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -1,3 +1,5 @@
++option('efi-cc', type : 'string', value : 'gcc', description : 'the compiler to use for EFI modules')
++option('efi-ld', type : 'string', value : 'ld', description : 'the linker to use for EFI modules')
+ option('efi-libdir', type : 'string', description : 'path to the EFI lib directory')
+ option('efi-ldsdir', type : 'string', description : 'path to the EFI lds directory')
+ option('efi-includedir', type : 'string', value : '/usr/include/efi', description : 'path to the EFI header directory')
diff --git a/srcpkgs/fwupd-efi/patches/fwupd-efi-1.4-uefi_210_fixes.patch b/srcpkgs/fwupd-efi/patches/fwupd-efi-1.4-uefi_210_fixes.patch
new file mode 100644
index 0000000000000..d4de5f174857e
--- /dev/null
+++ b/srcpkgs/fwupd-efi/patches/fwupd-efi-1.4-uefi_210_fixes.patch
@@ -0,0 +1,107 @@
+From bd958f2e8f03a85a7e1fe40a3ca7b78e0b24b79f Mon Sep 17 00:00:00 2001
+From: Callum Farmer <gmbr3@opensuse.org>
+Date: Sat, 11 Feb 2023 15:39:06 +0000
+Subject: [PATCH] UEFI 2.10 fixes
+
+Revert "Align sections to 512 bytes"
+
+This is not permitted according to the Microsoft
+guidelines which require section alignment to be
+the same as the page size of the architecture which
+for all supported archs is the default in Binutils
+
+https://techcommunity.microsoft.com/t5/hardware-dev-center/new-uefi-ca-memory-mitigation-requirements-for-signing/ba-p/3608714
+
+This reverts commit c60c0b8dfda71275ab40bdb316a6ca650c7a8948.
+
+Keep .areloc ARM32 section
+
+This is the psuedo .reloc section but renamed only on ARM32 to avoid
+a bad RELSZ value (gnu-efi 3.0.18+)
+
+Only use 4KiB pages on aarch64
+
+Binutils is currently configured by default
+to use 64KiB pages on aarch64, however this
+is not allowed by the UEFI specification
+
+Check if crt0 contains .note.GNU-stack section
+
+We need the .note.GNU-stack section for NX
+compat. If we don't have a new enough
+gnu-efi, error as the gnu-efi libraries
+themselves must have been built as NX
+for this to work
+
+Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
+---
+ efi/crt0/meson.build   |  1 +
+ efi/generate_binary.py |  4 ++--
+ efi/meson.build        | 12 +++++++++++-
+ 3 files changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/efi/crt0/meson.build b/efi/crt0/meson.build
+index f5f45c5..fbd943e 100644
+--- a/efi/crt0/meson.build
++++ b/efi/crt0/meson.build
+@@ -1,3 +1,4 @@
++arch_crt_source = 'crt0-efi-@0@.S'.format(gnu_efi_path_arch)
+ o_crt0 = custom_target('efi_crt0',
+                        input : arch_crt_source,
+                        output : arch_crt,
+diff --git a/efi/generate_binary.py b/efi/generate_binary.py
+index bd2d959..e27f926 100755
+--- a/efi/generate_binary.py
++++ b/efi/generate_binary.py
+@@ -31,9 +31,9 @@ def _run_objcopy(args):
+         "-j",
+         ".rodata",
+         "-j",
++        ".areloc",
++        "-j",
+         ".rel*",
+-        "--section-alignment",
+-        "512",
+         args.infile,
+         args.outfile,
+     ]
+diff --git a/efi/meson.build b/efi/meson.build
+index 1931855..a476884 100644
+--- a/efi/meson.build
++++ b/efi/meson.build
+@@ -95,6 +95,11 @@ else
+         coff_header_in_crt0 = false
+ endif
+ 
++# For NX compat, we must ensure we have .note.GNU-stack
++if run_command('grep', '-q', '.note.GNU-stack', join_paths(efi_crtdir, arch_crt), check: false).returncode() != 0
++    error('Cannot find NX section in @0@, update to gnu-efi 3.0.15+'.format(join_paths(efi_crtdir, arch_crt)))
++endif
++
+ # older objcopy for Aarch64 and ARM32 are not EFI capable.
+ # Use 'binary' instead, and add required symbols manually.
+ if host_cpu == 'arm' or (host_cpu == 'aarch64' and (objcopy_version.version_compare ('< 2.38') or coff_header_in_crt0))
+@@ -119,7 +124,6 @@ endif
+ # is the system crt0 for arm and aarch64 new enough to know about SBAT?
+ if objcopy_manualsymbols
+   if get_option('efi_sbat_distro_id') != ''
+-    arch_crt_source = 'crt0-efi-@0@.S'.format(gnu_efi_path_arch)
+     cmd = run_command('grep', '-q', 'sbat', join_paths(efi_crtdir, arch_crt))
+     if cmd.returncode() != 0
+       warning('Cannot find SBAT section in @0@, using local copy'.format(join_paths(efi_crtdir, arch_crt)))
+@@ -187,6 +191,12 @@ efi_ldflags = ['-T',
+                '-L', efi_libdir,
+                join_paths(efi_crtdir, arch_crt)]
+ 
++if host_cpu == 'aarch64'
++# Don't use 64KiB pages
++  efi_ldflags += ['-z', 'common-page-size=4096']
++  efi_ldflags += ['-z', 'max-page-size=4096']
++endif
++
+ if objcopy_manualsymbols
+   # older objcopy for Aarch64 and ARM32 are not EFI capable.
+   # Use 'binary' instead, and add required symbols manually.
+-- 
+2.34.1
+
diff --git a/srcpkgs/fwupd-efi/template b/srcpkgs/fwupd-efi/template
index 78a543fec1dd7..206948e8d0a86 100644
--- a/srcpkgs/fwupd-efi/template
+++ b/srcpkgs/fwupd-efi/template
@@ -1,6 +1,6 @@
 # Template file for 'fwupd-efi'
 pkgname=fwupd-efi
-version=1.3
+version=1.4
 revision=1
 archs="x86_64* i686* arm* aarch64*"
 build_style=meson
@@ -9,13 +9,13 @@ configure_args="-Defi-includedir=${XBPS_CROSS_BASE}/usr/include/efi
  -Defi-ldsdir=${XBPS_CROSS_BASE}/usr/lib -Defi-ld=${XBPS_CROSS_BASE}/bin/ld
  -Defi-libdir=${XBPS_CROSS_BASE}/usr/lib"
 hostmakedepends="efivar"
-makedepends="libefivar-devel gnu-efi-libs"
+makedepends="libefivar-devel gnu-efi-libs python3-pefile"
 short_desc="EFI Application used by uefi-capsule plugin in fwupd"
 maintainer="dkwo <nicolopiazzalunga@gmail.com>"
 license="LGPL-2.1-or-later"
 homepage="https://github.com/fwupd/fwupd-efi"
 distfiles="https://github.com/fwupd/fwupd-efi/archive/refs/tags/${version}.tar.gz"
-checksum=0e76057c178e221f63eaf9142fa1d06780a8eb3df7cf0c11f92660138dec5c83
+checksum=b1f5fe72e16d4e2f4c616da416dc93bd79331057336208465da37bafe8f8f83d
 
 if [ "$CROSS_BUILD" ]; then
 	configure_args+=" -Defi-cc=/usr/bin/${XBPS_CROSS_TRIPLET}-gcc"

  parent reply	other threads:[~2024-02-09  7:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16  9:55 [PR PATCH] " dataCobra
2023-11-16  9:59 ` [PR PATCH] [Updated] " dataCobra
2023-11-16 10:40 ` dataCobra
2024-01-26  9:57 ` dataCobra
2024-01-26 10:00 ` dataCobra
2024-02-01 13:52 ` [PR PATCH] [Updated] " dataCobra
2024-02-09  7:13 ` dataCobra [this message]
2024-02-15 13:11 ` leahneukirchen
2024-02-15 14:21 ` [PR PATCH] [Updated] " dataCobra
2024-02-15 14:23 ` dataCobra
2024-02-16  7:45 ` dataCobra
2024-02-16 13:15 ` [PR PATCH] [Merged]: " leahneukirchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240209071343.4E4BF2BC43@inbox.vuxu.org \
    --to=datacobra@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).