Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/flashrom: fix build on riscv
@ 2019-03-07 18:10 Fabrice Fontaine
  2019-03-07 20:37 ` Thomas Petazzoni
  2019-03-19 19:16 ` Peter Korsgaard
  0 siblings, 2 replies; 5+ messages in thread
From: Fabrice Fontaine @ 2019-03-07 18:10 UTC (permalink / raw)
  To: buildroot

Fixes:
 - http://autobuild.buildroot.org/results/fb95c22cbe1d19e73f0089103ed6da2f4b3081c8

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...001-platform-Add-riscv-to-known-platforms.patch | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 package/flashrom/0001-platform-Add-riscv-to-known-platforms.patch

diff --git a/package/flashrom/0001-platform-Add-riscv-to-known-platforms.patch b/package/flashrom/0001-platform-Add-riscv-to-known-platforms.patch
new file mode 100644
index 0000000000..06eb9256e4
--- /dev/null
+++ b/package/flashrom/0001-platform-Add-riscv-to-known-platforms.patch
@@ -0,0 +1,41 @@
+From a9a03cc6ba71825bfae0d64e1888f33c77345bc3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 17 Mar 2018 23:08:29 -0700
+Subject: [PATCH] platform: Add riscv to known platforms
+
+Change-Id: I724a99e2493fcbf71c2fc2d9f6a1ad607c737087
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Reviewed-on: https://review.coreboot.org/25260
+Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
+Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
+Reviewed-by: David Hendricks <david.hendricks@gmail.com>
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Retrieved from:
+https://github.com/flashrom/flashrom/commit/a9a03cc6ba71825bfae0d64e1888f33c77345bc3]
+---
+ platform.h | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/platform.h b/platform.h
+index e3b7674ae..65fe85881 100644
+--- a/platform.h
++++ b/platform.h
+@@ -69,6 +69,9 @@
+ #elif defined (__m68k__)
+ 	#define __FLASHROM_ARCH__ "m68k"
+ 	#define IS_M68K 1
++#elif defined (__riscv)
++	#define __FLASHROM_ARCH__ "riscv"
++	#define IS_RISCV 1
+ #elif defined (__sh__)
+ 	#define __FLASHROM_ARCH__ "sh"
+ 	#define IS_SH 1
+@@ -77,7 +80,7 @@
+ 	#define IS_S390 1
+ #endif
+ 
+-#if !(IS_X86 || IS_MIPS || IS_PPC || IS_ARM || IS_SPARC || IS_ALPHA || IS_HPPA || IS_M68K || IS_SH || IS_S390)
++#if !(IS_X86 || IS_MIPS || IS_PPC || IS_ARM || IS_SPARC || IS_ALPHA || IS_HPPA || IS_M68K || IS_RISCV || IS_SH || IS_S390)
+ #error Unknown architecture
+ #endif
+ 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 1/1] package/flashrom: fix build on riscv
@ 2021-02-07 19:57 Fabrice Fontaine
  2021-02-16 22:04 ` Arnout Vandecappelle
  0 siblings, 1 reply; 5+ messages in thread
From: Fabrice Fontaine @ 2021-02-07 19:57 UTC (permalink / raw)
  To: buildroot

Retrieve an upstream patch to fix build with riscv as it fails to
retrieve architecture due to "Use sigaction with SA_RESTART instead"
being caught before riscv:

exec: export LC_ALL=C ; { /home/fabrice/buildroot/output/host/bin/riscv32-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -E archtest.c 2>/dev/null | grep -v ^# | grep ' | cut -f 2 -d' ; }
Use sigaction with SA_RESTART instead
riscv

Fixes:
 - http://autobuild.buildroot.org/results/61ac6c9bfcd3bd9306aa49faf47b9f16e5abe846

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...kefile-Fix-building-on-AArch64-NixOS.patch | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 package/flashrom/0001-Makefile-Fix-building-on-AArch64-NixOS.patch

diff --git a/package/flashrom/0001-Makefile-Fix-building-on-AArch64-NixOS.patch b/package/flashrom/0001-Makefile-Fix-building-on-AArch64-NixOS.patch
new file mode 100644
index 0000000000..f835172e61
--- /dev/null
+++ b/package/flashrom/0001-Makefile-Fix-building-on-AArch64-NixOS.patch
@@ -0,0 +1,95 @@
+From da6b3b70cb852dd8e9f9e21aef95fa83e7f7ab0d Mon Sep 17 00:00:00 2001
+From: Pyry Kontio <pyry.kontio@drasa.eu>
+Date: Mon, 6 Jul 2020 12:57:35 +0900
+Subject: [PATCH] Makefile: Fix building on AArch64 NixOS
+
+The parsing of the output of archtest.c produced an unexpected
+value on AArch64 NixOS. For example, the make variable ARCH was set to:
+
+```
+bit outside of fd_set selected
+arm
+```
+
+This made the arch and OS checks fail.
+
+This commit simplifies the parsing, making it more robust.
+
+The C files archtest.c, endiantest.c and os.h used to set the
+TARGET_OS, ARCH and ENDIAN variables, respectively, output
+the result of the test as the final line, so just extracting
+the final line and removing double quoting is enough.
+
+This commit also fixes a bug with debug_shell lacking escaping
+single quotes, which prevented using the single quote in the
+debug_shell calls. It used to work by accident before this fix;
+the line in the call happened to contain a balanced pair of double
+quotes and lacked other characters that needed escaping, which
+didn't break the debug_shell, but this was accidental and very
+brittle.
+
+Signed-off-by: Pyry Kontio <pyry.kontio@drasa.eu>
+Change-Id: Iaa4477a71e758cf9ecad2c22f3b77bc6508a3510
+Reviewed-on: https://review.coreboot.org/c/flashrom/+/43140
+Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
+Reviewed-by: Angel Pons <th3fanbus@gmail.com>
+
+[Retrieved from:
+https://github.com/flashrom/flashrom/commit/da6b3b70cb852dd8e9f9e21aef95fa83e7f7ab0d]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ Makefile | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index f3f7717e2..e475cbdbd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -83,7 +83,8 @@ dummy_for_make_3_80:=$(shell printf "Build started on %s\n\n" "$$(date)" >$(BUIL
+ 
+ # Provide an easy way to execute a command, print its output to stdout and capture any error message on stderr
+ # in the build details file together with the original stdout output.
+-debug_shell = $(shell export LC_ALL=C ; { echo 'exec: export LC_ALL=C ; { $(1) ; }' >&2;  { $(1) ; } | tee -a $(BUILD_DETAILS_FILE) ; echo >&2 ; } 2>>$(BUILD_DETAILS_FILE))
++debug_shell = $(shell export LC_ALL=C ; { echo 'exec: export LC_ALL=C ; { $(subst ','\'',$(1)) ; }' >&2; \
++    { $(1) ; } | tee -a $(BUILD_DETAILS_FILE) ; echo >&2 ; } 2>>$(BUILD_DETAILS_FILE))
+ 
+ ###############################################################################
+ # General OS-specific settings.
+@@ -106,7 +107,8 @@ endif
+ # IMPORTANT: The following line must be placed before TARGET_OS is ever used
+ # (of course), but should come after any lines setting CC because the line
+ # below uses CC itself.
+-override TARGET_OS := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E os.h 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"'))
++override TARGET_OS := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E os.h 2>/dev/null \
++    | tail -1 | cut -f 2 -d'"'))
+ 
+ ifeq ($(TARGET_OS), Darwin)
+ override CPPFLAGS += -I/opt/local/include -I/usr/local/include
+@@ -490,8 +492,10 @@ endif
+ # IMPORTANT: The following line must be placed before ARCH is ever used
+ # (of course), but should come after any lines setting CC because the line
+ # below uses CC itself.
+-override ARCH := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E archtest.c 2>/dev/null | grep -v '^\#' | grep '"' | cut -f 2 -d'"'))
+-override ENDIAN := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E endiantest.c 2>/dev/null | grep -v '^\#'))
++override ARCH := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E archtest.c 2>/dev/null \
++    | tail -1 | cut -f 2 -d'"'))
++override ENDIAN := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E endiantest.c 2>/dev/null \
++    | tail -1))
+ 
+ # Disable the internal programmer on unsupported architectures (everything but x86 and mipsel)
+ ifneq ($(ARCH)-little, $(filter $(ARCH),x86 mips)-$(ENDIAN))
+@@ -1299,12 +1303,12 @@ compiler: featuresavailable
+ 	@printf "Target arch is "
+ 	@# FreeBSD wc will output extraneous whitespace.
+ 	@echo $(ARCH)|wc -w|grep -q '^[[:blank:]]*1[[:blank:]]*$$' ||	\
+-		( echo "unknown. Aborting."; exit 1)
++		( echo "unknown (\"$(ARCH)\"). Aborting."; exit 1)
+ 	@printf "%s\n" '$(ARCH)'
+ 	@printf "Target OS is "
+ 	@# FreeBSD wc will output extraneous whitespace.
+ 	@echo $(TARGET_OS)|wc -w|grep -q '^[[:blank:]]*1[[:blank:]]*$$' ||	\
+-		( echo "unknown. Aborting."; exit 1)
++		( echo "unknown (\"$(TARGET_OS)\"). Aborting."; exit 1)
+ 	@printf "%s\n" '$(TARGET_OS)'
+ ifeq ($(TARGET_OS), libpayload)
+ 	@$(CC) --version 2>&1 | grep -q coreboot || \
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-16 22:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-07 18:10 [Buildroot] [PATCH 1/1] package/flashrom: fix build on riscv Fabrice Fontaine
2019-03-07 20:37 ` Thomas Petazzoni
2019-03-19 19:16 ` Peter Korsgaard
  -- strict thread matches above, loose matches on Subject: below --
2021-02-07 19:57 Fabrice Fontaine
2021-02-16 22:04 ` Arnout Vandecappelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox