On Fri, 13 Oct 2023 09:24:05 +0100
Wael Karram <[email protected]> wrote:

> Hello,
> Seeing as Libreboot is no longer considered fit for building packages
> from under the FSDG, I have packaged gnuboot-utils as a replacement.
> Note though that this package might be changed soon as upstream
> stabilizes, though from my understanding the utils are stable anyway
> as they haven't been changed much if at all compared to older
> libreboot versions (when it was still FSDG compliant).
> 
> 

Over a year has passed, and by now GNU Boot has RC5.
From Adrien's presentation at 38C3 most of the code has stabilized, it
still is technically an RC just because most of the documentation is
still lacking and the instructions for installation aren't
user-friendly yet.
For our use case, that doesn't matter much if at all.
This patch creates the gnuboot-utils package (to replace our outdated
libreboot-utils).
I believe it can already go in and updating should generally be easy as
the structure hasn't changed much there (even if both projects are
using divergent build systems, that part is similar in both).

-- 
Kind Regards,
Wael Karram.
From 179791e7fda64e8e1db0f7ae431b7211f4a6dcf8 Mon Sep 17 00:00:00 2001
From: wael <[email protected]>
Date: Thu, 9 Jan 2025 10:33:45 +0200
Subject: [PATCH] Added gnuboot-utils.

---
 pcr/gnuboot-utils/PKGBUILD | 183 +++++++++++++++++++++++++++++++++++++
 1 file changed, 183 insertions(+)
 create mode 100644 pcr/gnuboot-utils/PKGBUILD

diff --git a/pcr/gnuboot-utils/PKGBUILD b/pcr/gnuboot-utils/PKGBUILD
new file mode 100644
index 000000000..f77f0934c
--- /dev/null
+++ b/pcr/gnuboot-utils/PKGBUILD
@@ -0,0 +1,183 @@
+# Copyright (C) 2023 Denis 'GNUtoo' Carikli <[email protected]>
+# Copyright (C) 2023 Wael Karram <[email protected]>
+# SPDX-License-Identifier: CC0-1.0
+# Maintainer: Parabola Hackers <[email protected]>
+
+_pkgname=gnuboot
+pkgname=gnuboot-utils
+pkgrel=1
+_upstream_ver=0.1-rc5
+pkgver=0.1.gnuboot
+pkgdesc="Misc. Coreboot/Gnuboot utils (bucts, cbfstool, ECtool, nvramtool, superiotool)"
+url="https://savannah.gnu.org/projects/gnuboot/";
+arch=('x86_64' 'i686' 'armv7h')
+license=('GPL2')
+makedepends=('pciutils' 'python' 'python-setuptools' 'flex')
+
+source=("https://ftp.gnu.org/gnu/gnuboot/gnuboot-${_upstream_ver}/gnuboot-${_upstream_ver}_src.tar.xz";)
+sha256sums=('e5e539ce2d0752baa84c43aeb2cd7378395a3d79b821e995d81f5b1b5d11ca1e')
+
+# Utilities for ich9
+_ich9_utils=(ich9deblob ich9gen demefactory ich9show)
+# Utilities to build for x86
+_x86_utils=(bucts ectool intelmetool inteltool superiotool)
+prepare() {
+	# Patch not needed anymore
+	#cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/"
+	#patch \
+	#    -Np1 -i \
+	#    "${srcdir}/0001-cbfstool-enable-to-disable-Werror-in-standalone-buil.patch"
+
+	# Replace sbin with bin in the makefiles.
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/bucts/"
+	sed 's#/sbin#/bin#' -i Makefile
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/cbfstool/"
+	sed 's#/sbin#/bin#' -i Makefile
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/cbmem/"
+	sed 's#/sbin#/bin#' -i Makefile
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/ectool/"
+	sed 's#/sbin#/bin#' -i Makefile
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/intelmetool/"
+	sed 's#/sbin#/bin#' -i Makefile
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/inteltool/"
+	sed 's#/sbin#/bin#' -i Makefile
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/nvramtool/"
+	sed 's#/sbin#/bin#' -i Makefile
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/superiotool/"
+	sed 's#/sbin#/bin#' -i Makefile
+
+	# Remove files that we don't need.
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/"
+	rm -rf tests
+	rm -rf spd
+	rm -rf payloads
+	rm -rf Documentation
+}
+
+build() {
+	# Build ich9deblob, ich9gen, demefactory, ich9show, etc
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src"
+	make -C ich9utils
+
+	# Get to the directory.
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/"
+
+	# These tools uses port-mapped I/O which doesn't exist on armv7h,
+	# so they fails to compile when including sys/io.h. They also need
+	# port-mapped I/O to work so it's pointless to try to build them
+	# on armv7h.
+	if [ "${CARCH}" = "i686" -o "${CARCH}" = "x86_64" ] ; then
+		for util in $_x86_utils ; do
+			make -C "${util}"
+		done
+		# Build bucts.
+		#make -C bucts
+
+		# Build ECtool.
+		#make -C ectool
+
+		# Build intelmetool.
+		#make -C intelmetool
+
+		# Build inteltool.
+		#make -C inteltool
+
+		# Build superiotool.
+		#make -C superiotool
+	fi
+
+	# Build bincfg.
+	make -C bincfg WERROR=""
+
+	# Build cbfstool.
+	make -C cbfstool WERROR=''
+
+	# Build cbmem.
+	make -C cbmem
+
+	# Build ifdtool
+	make -C ifdtool
+
+	# Build me_cleaner.
+	cd me_cleaner
+	python3 setup.py build
+	cd ..
+
+	# Build nvramtool.
+	make -C nvramtool
+
+	# Build spkmodem_recv.
+	make -C spkmodem_recv
+}
+
+package() {
+	# Set directories up.
+	install -d "${pkgdir}"/usr/bin "${pkgdir}"/usr/share/man/man8
+
+	# Install ich9deblob, ich9gen, demefactory, ich9show, etc
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/ich9utils"
+	for binary in ich9deblob ich9gen demefactory ich9show ; do
+		install -Dm755 "${binary}" "${pkgdir}"/usr/bin/"${binary}"
+	done
+
+	# Get to the directory.
+	cd "$srcdir/${_pkgname}-${_upstream_ver}_src/coreboot/default/util/"
+
+	# These tools uses port-mapped I/O which doesn't exist on armv7h,
+	# so they fails to compile when including sys/io.h. So we also need
+	# to skip their installation.
+	if [ "${CARCH}" = "i686" -o "${CARCH}" = "x86_64" ] ; then
+		# Install bucts.
+		install -Dm755 bucts/bucts "${pkgdir}"/usr/bin/bucts
+
+		# Install ECtool.
+		make -C ectool install PREFIX="${pkgdir}"/usr
+
+		# Install intelmetool.
+		make -C intelmetool install DESTDIR="${pkgdir}" PREFIX=/usr
+
+		# Install inteltool.
+		make -C inteltool install DESTDIR="${pkgdir}" PREFIX=/usr
+
+		# Install superiotool.
+		make -C superiotool install DESTDIR="${pkgdir}" PREFIX=/usr
+	fi
+
+	# Install bincfg.
+	install -Dm755 bincfg/bincfg "${pkgdir}"/usr/bin/bincfg
+
+	install -d "${pkgdir}"/usr/share/bincfg
+	for _file in ddr3_unregistered_spd_128.spec \
+		    ddr3_unregistered_spd_256.spec \
+		    ddr4_registered_spd_512.spec \
+		    ddr4_unbuffered_spd_512.spec \
+		    gbe-82579LM.set \
+		    gbe-82579LM.spec \
+		    gbe-ich9m.set \
+		    gbe-ich9m.spec \
+		    ifd-x200.set \
+		    ifd-x200.spec \
+		    it8718f-ec.spec ; do
+		install -Dm644 bincfg/"${_file}" "${pkgdir}"/usr/share/bincfg/"${_file}"
+	done
+
+	# Install cbfstool.
+	make -C cbfstool install DESTDIR="${pkgdir}" PREFIX=/usr
+
+	# Install cbmem.
+	make -C cbmem install DESTDIR="${pkgdir}" PREFIX=/usr
+
+	# Install ifdtool.
+	make -C ifdtool install DESTDIR="${pkgdir}" PREFIX=/usr
+
+	# Install me_cleaner.
+	cd me_cleaner
+	python3 setup.py install --root="$pkgdir/" --optimize=1
+	cd ..
+
+	# Install nvramtool.
+	make -C nvramtool install DESTDIR="${pkgdir}" PREFIX=/usr
+
+	# Install spkmodem_recv.
+	make -C spkmodem_recv install PREFIX="${pkgdir}/usr"
+}
-- 
2.47.1

Attachment: pgpZ3fq96jrnV.pgp
Description: OpenPGP digital signature

_______________________________________________
Dev mailing list
[email protected]
https://lists.parabola.nu/mailman/listinfo/dev

Reply via email to