summaryrefslogtreecommitdiff
path: root/pcr/libreboot-utils
diff options
context:
space:
mode:
Diffstat (limited to 'pcr/libreboot-utils')
-rw-r--r--pcr/libreboot-utils/0001-cbfstool-enable-to-disable-Werror-in-standalone-buil.patch88
-rw-r--r--pcr/libreboot-utils/PKGBUILD182
2 files changed, 270 insertions, 0 deletions
diff --git a/pcr/libreboot-utils/0001-cbfstool-enable-to-disable-Werror-in-standalone-buil.patch b/pcr/libreboot-utils/0001-cbfstool-enable-to-disable-Werror-in-standalone-buil.patch
new file mode 100644
index 000000000..689994d01
--- /dev/null
+++ b/pcr/libreboot-utils/0001-cbfstool-enable-to-disable-Werror-in-standalone-buil.patch
@@ -0,0 +1,88 @@
+From 2f61f3547e3e854cb1b1a7752e2a5e4d38e07f74 Mon Sep 17 00:00:00 2001
+From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+Date: Fri, 6 May 2022 03:25:42 +0200
+Subject: [PATCH] cbfstool: enable to disable -Werror in standalone builds
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+With GCC 11.2, on GNU/Linux i686, if we run the following commands:
+$ cd util/cbfstool
+$ make
+the build fails with with the following error:
+ host/lib/extract_vmlinuz.c: In function ‘ExtractVmlinuz’:
+ host/lib/extract_vmlinuz.c:67:9: warning:
+ ‘memcpy’ specified bound between 2147483648 and 4294967295
+ exceeds maximum object size 2147483647 [-Wstringop-overflow=]
+ 67 | memcpy(vmlinuz, kpart_data + vmlinuz_header_offset,
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 68 | vmlinuz_header_size);
+ | ~~~~~~~~~~~~~~~~~~~~
+
+Enabling to build cbfstool (and its dependencies like vboot where the
+above error comes from), we can enable users and distributions to
+build cbfstool with the distribution toolchain.
+
+For that they would need to pass WERROR='' to make, like that:
+$ cd util/cbfstool
+$ make WERROR=''
+
+Since util/cbfstool/lz4/Makefile isn't used during the build of a
+standalone cbfstool or a coreboot image, we can simply ignore the
+-Werror that are inside.
+
+Change-Id: I24f59661d3fc218d1e4cd4c36006172ead08b18d
+Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+---
+Description: This patch is needed to fix the cbfstool compilation on
+32bit architectures.
+Forwarded: https://review.coreboot.org/c/coreboot/+/64131
+Author: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+---
+ util/cbfstool/Makefile | 2 ++
+ util/cbfstool/Makefile.inc | 5 ++++-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/util/cbfstool/Makefile b/util/cbfstool/Makefile
+index 034aca26a6be..6fc8cdf1635c 100644
+--- a/util/cbfstool/Makefile
++++ b/util/cbfstool/Makefile
+@@ -11,6 +11,8 @@ INSTALL ?= /usr/bin/env install
+ OBJCOPY ?= objcopy
+ override objutil := ..
+
++WERROR ?= -Werror
++
+ VBOOT_SOURCE ?= $(top)/3rdparty/vboot
+ VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib)
+
+diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc
+index f3e6c75dced2..d35f734c8b16 100644
+--- a/util/cbfstool/Makefile.inc
++++ b/util/cbfstool/Makefile.inc
+@@ -1,3 +1,5 @@
++WERROR ?= -Werror
++
+ compressionobj :=
+ compressionobj += compress.o
+ # LZ4
+@@ -110,7 +112,7 @@ cse_serger_obj += common.o
+ cse_serger_obj += cse_helpers.o
+ cse_serger_obj += $(foreach var, $(bpdt_formats_obj), $(var))
+
+-TOOLCFLAGS ?= -Werror -Wall -Wextra -Wshadow
++TOOLCFLAGS ?= $(WERROR) -Wall -Wextra -Wshadow
+ TOOLCFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow
+ TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings
+ TOOLCFLAGS += -O2
+@@ -156,6 +158,7 @@ $(VBOOT_HOSTLIB):
+ PKG_CONFIG="true" \
+ V=$(V) \
+ DEBUG= \
++ WERROR=$(WERROR) \
+ hostlib
+
+ $(objutil)/cbfstool/%.o: $(objutil)/cbfstool/%.c
+--
+2.36.0
+
diff --git a/pcr/libreboot-utils/PKGBUILD b/pcr/libreboot-utils/PKGBUILD
new file mode 100644
index 000000000..04e987507
--- /dev/null
+++ b/pcr/libreboot-utils/PKGBUILD
@@ -0,0 +1,182 @@
+# Copyright (C) 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+# Copyright (C) 2022 Wael Karram <wael@waelk.tech>
+# SPDX-License-Identifier: CC0-1.0
+# Maintainer: Parabola Hackers <dev@lists.parabola.nu>
+
+pkgname=libreboot-utils
+pkgrel=2
+_upstream_ver=20220710
+pkgver=4.15.libreboot${_upstream_ver}
+pkgdesc="Misc. Coreboot/Libreboot utils (bucts, cbfstool, ECtool, nvramtool, superiotool)"
+url="https://libreboot.org/"
+arch=('x86_64' 'i686' 'armv7h')
+license=('GPL2')
+makedepends=('pciutils' 'python' 'python-setuptools' 'flex')
+
+_mirror="https://mirrors.mit.edu/libreboot" # use a mirror per libreboot's request
+source=("${_mirror}/stable/${_upstream_ver}/libreboot-${_upstream_ver}_src.tar.xz"{,.sig}
+ "0001-cbfstool-enable-to-disable-Werror-in-standalone-buil.patch")
+sha256sums=('92439034828aa66d52507c97d8260a7d0335abbeedb1a70e5e1466b92a903645'
+ 'e8afb35e6d9328baa5cee5325c60cb40467559596e93a7ae218883ece3484b8f'
+ 'SKIP')
+sha512sums=('73fe77983d30997295747e365a363f6fc4897f469d9b24640fc6a7105f0ddb623890e797723077222212695dbbe9abb5186b04d75dad39f99cb62733f4b0de60'
+ 'aa4f35df0da8e93dda169034e906576db291ac2e6fe27b5c9693827ff99ecaa8c45b80892f0792505fb1d9c6d5190517a59309304f93c3e1f504ddacf95684c1'
+ 'SKIP')
+validpgpkeys=('98CCDDF8E56047F475C044BDD0C62464FA8B4856') # Leah Rowe
+
+prepare() {
+ cd "$srcdir/libreboot-${_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/libreboot-${_upstream_ver}_src/coreboot/default/util/bucts/"
+ sed 's#/sbin#/bin#' -i Makefile
+ cd "$srcdir/libreboot-${_upstream_ver}_src/coreboot/default/util/cbfstool/"
+ sed 's#/sbin#/bin#' -i Makefile
+ cd "$srcdir/libreboot-${_upstream_ver}_src/coreboot/default/util/cbmem/"
+ sed 's#/sbin#/bin#' -i Makefile
+ cd "$srcdir/libreboot-${_upstream_ver}_src/coreboot/default/util/ectool/"
+ sed 's#/sbin#/bin#' -i Makefile
+ cd "$srcdir/libreboot-${_upstream_ver}_src/coreboot/default/util/intelmetool/"
+ sed 's#/sbin#/bin#' -i Makefile
+ cd "$srcdir/libreboot-${_upstream_ver}_src/coreboot/default/util/inteltool/"
+ sed 's#/sbin#/bin#' -i Makefile
+ cd "$srcdir/libreboot-${_upstream_ver}_src/coreboot/default/util/nvramtool/"
+ sed 's#/sbin#/bin#' -i Makefile
+ cd "$srcdir/libreboot-${_upstream_ver}_src/coreboot/default/util/superiotool/"
+ sed 's#/sbin#/bin#' -i Makefile
+
+ # Remove uneeded files.
+ cd "$srcdir/libreboot-${_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/libreboot-${_upstream_ver}_src"
+ make -C ich9utils
+
+ # Get to the directory.
+ cd "$srcdir/libreboot-${_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
+ # 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/libreboot-${_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/libreboot-${_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"
+}