diff options
-rw-r--r-- | pcr/libreboot-utils/0001-cbfstool-enable-to-disable-Werror-in-standalone-buil.patch | 88 | ||||
-rw-r--r-- | pcr/libreboot-utils/PKGBUILD | 22 |
2 files changed, 101 insertions, 9 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 index d18125a1d..956cffac6 100644 --- a/pcr/libreboot-utils/PKGBUILD +++ b/pcr/libreboot-utils/PKGBUILD @@ -4,7 +4,7 @@ # Maintainers: Parabola hackers <dev@lists.parabola.nu> pkgname=libreboot-utils -pkgrel=2 +pkgrel=3 _upstream_ver=20211122 pkgver=4.15.libreboot${_upstream_ver} pkgdesc="Misc. Coreboot/Libreboot utils (bucts, cbfstool, ECtool, nvramtool, superiotool)" @@ -14,14 +14,22 @@ license=('GPL2') makedepends=('pciutils') _mirror="https://mirrors.mit.edu/libreboot" # use a mirror per libreboot's request -source=(${_mirror}/testing/${_upstream_ver}/libreboot-${_upstream_ver}_src.tar.xz{,.sig}) +source=("${_mirror}/testing/${_upstream_ver}/libreboot-${_upstream_ver}_src.tar.xz"{,.sig} + "0001-cbfstool-enable-to-disable-Werror-in-standalone-buil.patch") sha256sums=('e8a610e51e668c34627a6d9c048c554592fd2c2ab4dbcad83c85c06d132e5ad1' - '4442fc225383e1edf8f45e1aecba81868ae43db19978f15c17828389364c0434') + '4442fc225383e1edf8f45e1aecba81868ae43db19978f15c17828389364c0434' + 'SKIP') sha512sums=('3eac75b33bc6d2874c3ca1ad2392db7287992cf91d37879bb3244dbd6716bc7ffa3f8d31e15d821899e91a55b6fe665d918bea4e9da92e5e98345e9bcbe1bb95' - '3a532ecef550ef27b723845544e91ff6b13ed6f2f1188d40fdeb7b3c416be619ff58103c3b01cd52ff88c28df6d419d2113b92d0b8ba36d1a74cfc16f70e0e63') + '3a532ecef550ef27b723845544e91ff6b13ed6f2f1188d40fdeb7b3c416be619ff58103c3b01cd52ff88c28df6d419d2113b92d0b8ba36d1a74cfc16f70e0e63' + '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 @@ -62,11 +70,7 @@ build() { fi # Build cbfstool. - case "${CARCH}" in - armv7h) make -C cbfstool;; - #i686) make -C cbfstool;; #broken - x86_64) make -C cbfstool;; - esac + make -C cbfstool WERROR='' # Build ECtool. make -C ectool # Build nvramtool. |