flashrom: switch to building with meson

Added patches to fix meson compilation.

Reworked flashrom.mk to work with meson.

Several minor Makefile cleanups.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2020-07-17 21:30:21 -07:00
parent d44b9e9062
commit 81618c5465
7 changed files with 134 additions and 109 deletions
+20
View File
@@ -0,0 +1,20 @@
--- a/meson.build
+++ b/meson.build
@@ -33,6 +33,7 @@ add_project_arguments('-DFLASHROM_VERSION="' + meson.project_version() + '"', la
config_atahpt = get_option('config_atahpt')
config_atapromise = get_option('config_atapromise')
config_atavia = get_option('config_atavia')
+config_bitbang_spi = get_option('config_bitbang_spi')
config_buspirate_spi = get_option('config_buspirate_spi')
config_ch341a_spi = get_option('config_ch341a_spi')
config_dediprog = get_option('config_dediprog')
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,6 +4,7 @@ option('usb', type : 'boolean', value : true, description : 'use libusb1')
option('config_atahpt', type : 'boolean', value : false, description : 'Highpoint (HPT) ATA/RAID controllers')
option('config_atapromise', type : 'boolean', value : false, description : 'Promise ATA controller')
option('config_atavia', type : 'boolean', value : true, description : 'VIA VT6421A LPC memory')
+option('config_bitbang_spi', type : 'boolean', value : true, description : 'Bitbang')
option('config_buspirate_spi', type : 'boolean', value : true, description : 'Bus Pirate SPI')
option('config_ch341a_spi', type : 'boolean', value : true, description : 'Winchiphead CH341A')
option('config_dediprog', type : 'boolean', value : true, description : 'Dediprog SF100')
@@ -0,0 +1,10 @@
--- a/meson.build
+++ b/meson.build
@@ -263,6 +263,7 @@ endif
if config_satasii
srcs += 'satasii.c'
cargs += '-DCONFIG_SATASII=1'
+ need_raw_access = true
endif
if config_serprog
srcs += 'serprog.c'
+11
View File
@@ -0,0 +1,11 @@
--- a/hwaccess.c
+++ b/hwaccess.c
@@ -71,7 +71,7 @@ static inline void sync_primitive(void)
* See also https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/memory-barriers.txt
*/
#if IS_PPC // cf. http://lxr.free-electrons.com/source/arch/powerpc/include/asm/barrier.h
- asm("eieio" : : : "memory");
+ __asm__ ("eieio" : : : "memory");
#elif IS_SPARC
#if defined(__sparc_v9__) || defined(__sparcv9)
/* Sparc V9 CPUs support three different memory orderings that range from x86-like TSO to PowerPC-like
+11
View File
@@ -0,0 +1,11 @@
--- a/meson.build
+++ b/meson.build
@@ -25,7 +25,7 @@ conf = configuration_data()
cc = meson.get_compiler('c')
add_project_arguments(cc.get_supported_arguments(warning_flags), language : 'c')
add_project_arguments('-D_DEFAULT_SOURCE', language : 'c')
-add_project_arguments('-D_POSIX_C_SOURCE', language : 'c') # required for fileno
+add_project_arguments('-D_POSIX_C_SOURCE=200809L', language : 'c') # required for fileno, nanosleep, and strndup
add_project_arguments('-D_BSD_SOURCE', language : 'c') # required for glibc < v2.19
add_project_arguments('-DFLASHROM_VERSION="' + meson.project_version() + '"', language : 'c')
@@ -1,18 +0,0 @@
--- a/Makefile
+++ b/Makefile
@@ -424,15 +424,6 @@ endif
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 '^\#'))
-# Disable the internal programmer on unsupported architectures (everything but x86 and mipsel)
-ifneq ($(ARCH)-little, $(filter $(ARCH),x86 mips)-$(ENDIAN))
-ifeq ($(CONFIG_INTERNAL), yes)
-UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes
-else
-override CONFIG_INTERNAL = no
-endif
-endif
-
# PCI port I/O support is unimplemented on PPC/MIPS/SPARC and unavailable on ARM.
# Right now this means the drivers below only work on x86.
ifneq ($(ARCH), x86)