All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hilliard <james.hilliard1@gmail.com>
To: buildroot@buildroot.org
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>,
	James Hilliard <james.hilliard1@gmail.com>,
	Asaf Kahlon <asafka7@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [Buildroot] [PATCH v3 4/5] package/fwupd-efi: new package
Date: Tue, 16 Jul 2024 11:50:36 -0600	[thread overview]
Message-ID: <20240716175037.1844929-4-james.hilliard1@gmail.com> (raw)
In-Reply-To: <20240716175037.1844929-1-james.hilliard1@gmail.com>

Backport some patches fixing the python shebang and allowing one
to disable the use of genpeimg since we use host-python-pefile.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Changes v2 -> v3:
  - add python shebang fix
  - disable genpeimg binary usage
  - set objcopy path
  - add host-python-pefile host-python-uswid deps
Changes v1 -> v2:
  - use gitlab for efi_sbat_distro_url
---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 ...disabling-the-use-of-genpeimg-binary.patch | 41 ++++++++
 ...-shebang-paths-and-add-python-option.patch | 95 +++++++++++++++++++
 package/fwupd-efi/Config.in                   |  8 ++
 package/fwupd-efi/fwupd-efi.hash              |  3 +
 package/fwupd-efi/fwupd-efi.mk                | 28 ++++++
 7 files changed, 177 insertions(+)
 create mode 100644 package/fwupd-efi/0001-Allow-enabling-disabling-the-use-of-genpeimg-binary.patch
 create mode 100644 package/fwupd-efi/0002-Fix-python3-shebang-paths-and-add-python-option.patch
 create mode 100644 package/fwupd-efi/Config.in
 create mode 100644 package/fwupd-efi/fwupd-efi.hash
 create mode 100644 package/fwupd-efi/fwupd-efi.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index e181382fe9..f54a01e477 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1480,6 +1480,7 @@ F:	package/apcupsd/
 F:	package/bpftool/
 F:	package/cloudflared/
 F:	package/exfatprogs/
+F:	package/fwupd-efi/
 F:	package/fxdiv/
 F:	package/gensio/
 F:	package/lua-std-debug/
diff --git a/package/Config.in b/package/Config.in
index 4a38c282a3..4cd7cfbc62 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -519,6 +519,7 @@ endmenu
 	source "package/fmtools/Config.in"
 	source "package/freeipmi/Config.in"
 	source "package/freescale-imx/Config.in"
+	source "package/fwupd-efi/Config.in"
 	source "package/fxload/Config.in"
 	source "package/gcnano-binaries/Config.in"
 	source "package/gpm/Config.in"
diff --git a/package/fwupd-efi/0001-Allow-enabling-disabling-the-use-of-genpeimg-binary.patch b/package/fwupd-efi/0001-Allow-enabling-disabling-the-use-of-genpeimg-binary.patch
new file mode 100644
index 0000000000..e6e460a3b7
--- /dev/null
+++ b/package/fwupd-efi/0001-Allow-enabling-disabling-the-use-of-genpeimg-binary.patch
@@ -0,0 +1,41 @@
+From fb1cf079346a2838cc44f7116cb4a790e40cc5bf Mon Sep 17 00:00:00 2001
+From: James Hilliard <james.hilliard1@gmail.com>
+Date: Tue, 2 Jul 2024 15:08:18 -0600
+Subject: [PATCH] Allow enabling/disabling the use of genpeimg binary
+
+In some cases we may want to force the use of python3-pefile instead
+of genpeimg such as when cross compiling, add a feature option to
+allow disabling genpeimg.
+
+Upstream: https://github.com/fwupd/fwupd-efi/commit/fb1cf079346a2838cc44f7116cb4a790e40cc5bf
+Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
+---
+ meson.build       | 2 +-
+ meson_options.txt | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index a3ce068..a5612a6 100644
+--- a/meson.build
++++ b/meson.build
+@@ -17,7 +17,7 @@ prefix = get_option('prefix')
+ libdir = join_paths(prefix, get_option('libdir'))
+ libexecdir = join_paths(prefix, get_option('libexecdir'))
+ 
+-genpeimg = find_program ('genpeimg', required: false)
++genpeimg = find_program ('genpeimg', required: get_option('genpeimg'))
+ 
+ efi_app_location = join_paths(libexecdir, 'fwupd', 'efi')
+ host_cpu = host_machine.cpu_family()
+diff --git a/meson_options.txt b/meson_options.txt
+index 26161e1..588ae29 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -7,3 +7,4 @@ option('efi_sbat_distro_summary', type : 'string', value : '', description : 'SB
+ option('efi_sbat_distro_pkgname', type : 'string', value : '', description : 'SBAT distribution package name, e.g. fwupd')
+ option('efi_sbat_distro_version', type : 'string', value : '', description : 'SBAT distribution version, e.g. fwupd-1.5.6.fc33')
+ option('efi_sbat_distro_url', type : 'string', value : '', description : 'SBAT distribution URL, e.g. https://src.fedoraproject.org/rpms/fwupd')
++option('genpeimg', type : 'feature', description : 'Use genpeimg to add NX support to binaries')
+-- 
+2.34.1
+
diff --git a/package/fwupd-efi/0002-Fix-python3-shebang-paths-and-add-python-option.patch b/package/fwupd-efi/0002-Fix-python3-shebang-paths-and-add-python-option.patch
new file mode 100644
index 0000000000..9747565182
--- /dev/null
+++ b/package/fwupd-efi/0002-Fix-python3-shebang-paths-and-add-python-option.patch
@@ -0,0 +1,95 @@
+From 1cd1ff0216d5beb2a2523031398d4dba7d12729d Mon Sep 17 00:00:00 2001
+From: James Hilliard <james.hilliard1@gmail.com>
+Date: Tue, 2 Jul 2024 14:51:26 -0600
+Subject: [PATCH] Fix python3 shebang paths and add python option.
+
+Using absolute paths can result in the wrong python3 binary being
+used, such as when cross compiling using a non-system python3.
+
+Use the normal python3 env shebang instead.
+
+Also add a meson option to allow overriding the python path.
+
+Upstream: https://github.com/fwupd/fwupd-efi/commit/1cd1ff0216d5beb2a2523031398d4dba7d12729d
+Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
+---
+ contrib/reformat-code.py | 2 +-
+ efi/generate_binary.py   | 2 +-
+ efi/generate_sbat.py     | 2 +-
+ efi/meson.build          | 4 ++--
+ meson.build              | 7 +++++++
+ meson_options.txt        | 1 +
+ 6 files changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/contrib/reformat-code.py b/contrib/reformat-code.py
+index 65a4ac4..ff6014d 100755
+--- a/contrib/reformat-code.py
++++ b/contrib/reformat-code.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python3
++#!/usr/bin/env python3
+ #
+ # Copyright (C) 2017 Dell Inc.
+ #
+diff --git a/efi/generate_binary.py b/efi/generate_binary.py
+index 443472a..a4611bb 100755
+--- a/efi/generate_binary.py
++++ b/efi/generate_binary.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python3
++#!/usr/bin/env python3
+ #
+ # Copyright (C) 2021 Javier Martinez Canillas <javierm@redhat.com>
+ # Copyright (C) 2021 Richard Hughes <richard@hughsie.com>
+diff --git a/efi/generate_sbat.py b/efi/generate_sbat.py
+index 6c904e5..b9b80ac 100755
+--- a/efi/generate_sbat.py
++++ b/efi/generate_sbat.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python3
++#!/usr/bin/env python3
+ #
+ # Copyright (C) 2021 Javier Martinez Canillas <javierm@redhat.com>
+ # Copyright (C) 2021 Richard Hughes <richard@hughsie.com>
+diff --git a/efi/meson.build b/efi/meson.build
+index 75ade7a..008ba3d 100644
+--- a/efi/meson.build
++++ b/efi/meson.build
+@@ -1,5 +1,5 @@
+-generate_sbat = find_program('generate_sbat.py', native: true)
+-generate_binary = find_program('generate_binary.py', native: true)
++generate_sbat = [python3, files('generate_sbat.py')]
++generate_binary = [python3, files('generate_binary.py')]
+ 
+ # get source version, falling back
+ git = find_program('git', required : false)
+diff --git a/meson.build b/meson.build
+index a5612a6..5836213 100644
+--- a/meson.build
++++ b/meson.build
+@@ -19,6 +19,13 @@ libexecdir = join_paths(prefix, get_option('libexecdir'))
+ 
+ genpeimg = find_program ('genpeimg', required: get_option('genpeimg'))
+ 
++python3path = get_option('python')
++if python3path == ''
++  python3 = import('python').find_installation('python3')
++else
++  python3 = find_program(python3path)
++endif
++
+ efi_app_location = join_paths(libexecdir, 'fwupd', 'efi')
+ host_cpu = host_machine.cpu_family()
+ if host_cpu == 'x86'
+diff --git a/meson_options.txt b/meson_options.txt
+index 588ae29..5f6f521 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -8,3 +8,4 @@ option('efi_sbat_distro_pkgname', type : 'string', value : '', description : 'SB
+ option('efi_sbat_distro_version', type : 'string', value : '', description : 'SBAT distribution version, e.g. fwupd-1.5.6.fc33')
+ option('efi_sbat_distro_url', type : 'string', value : '', description : 'SBAT distribution URL, e.g. https://src.fedoraproject.org/rpms/fwupd')
+ option('genpeimg', type : 'feature', description : 'Use genpeimg to add NX support to binaries')
++option('python', type : 'string', description : 'the absolute path of the python3 binary')
+-- 
+2.34.1
+
diff --git a/package/fwupd-efi/Config.in b/package/fwupd-efi/Config.in
new file mode 100644
index 0000000000..3d82f480be
--- /dev/null
+++ b/package/fwupd-efi/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_FWUPD_EFI
+	bool "fwupd-efi"
+	depends on BR2_PACKAGE_GNU_EFI_ARCH_SUPPORTS
+	select BR2_PACKAGE_GNU_EFI
+	help
+	  EFI Application used by uefi-capsule plugin in fwupd.
+
+	  https://github.com/fwupd/fwupd-efi
diff --git a/package/fwupd-efi/fwupd-efi.hash b/package/fwupd-efi/fwupd-efi.hash
new file mode 100644
index 0000000000..35dc9625ca
--- /dev/null
+++ b/package/fwupd-efi/fwupd-efi.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  afd0805a2ad081a7caff2ef5bc004ce3a0147b538015e8eca966341716b1260e  fwupd-efi-1.6.tar.xz
+sha256  dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551  COPYING
diff --git a/package/fwupd-efi/fwupd-efi.mk b/package/fwupd-efi/fwupd-efi.mk
new file mode 100644
index 0000000000..45eeb8d824
--- /dev/null
+++ b/package/fwupd-efi/fwupd-efi.mk
@@ -0,0 +1,28 @@
+################################################################################
+#
+# fwupd-efi
+#
+################################################################################
+
+FWUPD_EFI_VERSION = 1.6
+FWUPD_EFI_SITE = https://github.com/fwupd/fwupd-efi/releases/download/$(FWUPD_EFI_VERSION)
+FWUPD_EFI_SOURCE = fwupd-efi-$(FWUPD_EFI_VERSION).tar.xz
+FWUPD_EFI_LICENSE = LGPL-2.1+
+FWUPD_EFI_LICENSE_FILES = COPYING
+FWUPD_EFI_INSTALL_STAGING = YES
+FWUPD_EFI_DEPENDENCIES = host-python-pefile host-python-uswid gnu-efi
+FWUPD_EFI_CONF_OPTS = \
+	-Defi-libdir=$(STAGING_DIR)/usr/lib \
+	-Defi-ldsdir=$(STAGING_DIR)/usr/lib \
+	-Defi-includedir=$(STAGING_DIR)/usr/include/efi \
+	-Defi_sbat_fwupd_generation=1 \
+	-Defi_sbat_distro_id=buildroot \
+	-Defi_sbat_distro_summary=Buildroot \
+	-Defi_sbat_distro_pkgname=fwupd-efi \
+	-Defi_sbat_distro_version=fwupd-efi-$(FWUPD_EFI_VERSION) \
+	-Defi_sbat_distro_url=https://gitlab.com/buildroot.org/buildroot/-/tree/master/package/fwupd-efi \
+	-Dgenpeimg=disabled \
+	-Dpython="$(HOST_DIR)/bin/python3"
+FWUPD_EFI_MESON_EXTRA_BINARIES = objcopy='$(TARGET_OBJCOPY)'
+
+$(eval $(meson-package))
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2024-07-16 17:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-16 17:50 [Buildroot] [PATCH v3 1/5] package/python-pefile: new host package James Hilliard
2024-07-16 17:50 ` [Buildroot] [PATCH v3 2/5] package/python-cbor2: enable host build James Hilliard
2024-07-16 17:50 ` [Buildroot] [PATCH v3 3/5] package/python-uswid: new host package James Hilliard
2024-07-18 21:38   ` Thomas Petazzoni via buildroot
2024-07-16 17:50 ` James Hilliard [this message]
2024-07-16 17:50 ` [Buildroot] [PATCH v3 5/5] package/fwupd: new package James Hilliard

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=20240716175037.1844929-4-james.hilliard1@gmail.com \
    --to=james.hilliard1@gmail.com \
    --cc=asafka7@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=eric.le.bihan.dev@free.fr \
    --cc=thomas.petazzoni@bootlin.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.