mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-04-20 11:38:34 +00:00
flashrom: Fix build with clang and aarch64
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
From d9e4dc750dc45e42b482d744829254a3672c11b3 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 19 Oct 2016 00:24:08 +0000
|
||||
Subject: [PATCH 1/3] Fix compilation on aarch64
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
arch.h | 2 +-
|
||||
hwaccess.c | 2 +-
|
||||
hwaccess.h | 6 +++---
|
||||
3 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: flashrom-0.9.6.1/arch.h
|
||||
===================================================================
|
||||
--- flashrom-0.9.6.1.orig/arch.h
|
||||
+++ flashrom-0.9.6.1/arch.h
|
||||
@@ -27,7 +27,7 @@
|
||||
#define __FLASHROM_ARCH__ "mips"
|
||||
#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__)
|
||||
#define __FLASHROM_ARCH__ "ppc"
|
||||
-#elif defined(__arm__)
|
||||
+#elif defined(__arm__) || defined(__aarch64__)
|
||||
#define __FLASHROM_ARCH__ "arm"
|
||||
#endif
|
||||
__FLASHROM_ARCH__
|
||||
Index: flashrom-0.9.6.1/hwaccess.c
|
||||
===================================================================
|
||||
--- flashrom-0.9.6.1.orig/hwaccess.c
|
||||
+++ flashrom-0.9.6.1/hwaccess.c
|
||||
@@ -121,7 +121,7 @@ int rget_io_perms(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#elif defined (__arm__)
|
||||
+#elif defined (__arm__) || defined (__aarch64__)
|
||||
|
||||
static inline void sync_primitive(void)
|
||||
{
|
||||
Index: flashrom-0.9.6.1/hwaccess.h
|
||||
===================================================================
|
||||
--- flashrom-0.9.6.1.orig/hwaccess.h
|
||||
+++ flashrom-0.9.6.1/hwaccess.h
|
||||
@@ -68,8 +68,8 @@
|
||||
#error Little-endian PowerPC #defines are unknown
|
||||
#endif
|
||||
|
||||
-#elif defined (__arm__)
|
||||
-#if defined (__ARMEL__)
|
||||
+#elif defined (__arm__) || defined (__aarch64__)
|
||||
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
#define __FLASHROM_LITTLE_ENDIAN__ 1
|
||||
#else
|
||||
#error Big-endian ARM #defines are unknown
|
||||
@@ -337,7 +337,7 @@ int libpayload_wrmsr(int addr, msr_t msr
|
||||
|
||||
/* PCI port I/O is not yet implemented on MIPS. */
|
||||
|
||||
-#elif defined(__arm__)
|
||||
+#elif defined(__arm__) || defined (__aarch64__)
|
||||
|
||||
/* Non memory mapped I/O is not supported on ARM. */
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 9be0d152dfe8ac0f9b665d61aeb3f99dae533e0f Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 19 Oct 2016 00:25:09 +0000
|
||||
Subject: [PATCH 2/3] Disable Wtautological-pointer-compare when using clang
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
flashrom.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/flashrom.c b/flashrom.c
|
||||
index 04e9934..bf49104 100644
|
||||
--- a/flashrom.c
|
||||
+++ b/flashrom.c
|
||||
@@ -1569,6 +1569,9 @@ int selfcheck(void)
|
||||
* For 'flashchips' we check the first element to be non-null. In the
|
||||
* other cases there exist use cases where the first element can be
|
||||
* null. */
|
||||
+#pragma clang diagnostic push
|
||||
+#pragma clang diagnostic ignored "-Wtautological-pointer-compare"
|
||||
+
|
||||
if (flashchips == NULL || flashchips[0].vendor == NULL) {
|
||||
msg_gerr("Flashchips table miscompilation!\n");
|
||||
ret = 1;
|
||||
@@ -1602,6 +1605,7 @@ int selfcheck(void)
|
||||
msg_gerr("Known laptops table does not exist!\n");
|
||||
ret = 1;
|
||||
}
|
||||
+#pragma clang diagnostic pop
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
From 42ec9bd51e60aa38fe6e78f644e742d6989b6683 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 19 Oct 2016 00:25:23 +0000
|
||||
Subject: [PATCH 3/3] remove duplicate const qualifiers
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
bitbang_spi.c | 12 ++++++------
|
||||
dummyflasher.c | 2 +-
|
||||
2 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/bitbang_spi.c b/bitbang_spi.c
|
||||
index 11d2de1..508cf45 100644
|
||||
--- a/bitbang_spi.c
|
||||
+++ b/bitbang_spi.c
|
||||
@@ -26,33 +26,33 @@
|
||||
#include "spi.h"
|
||||
|
||||
/* Note that CS# is active low, so val=0 means the chip is active. */
|
||||
-static void bitbang_spi_set_cs(const const struct bitbang_spi_master *master, int val)
|
||||
+static void bitbang_spi_set_cs(const struct bitbang_spi_master *master, int val)
|
||||
{
|
||||
master->set_cs(val);
|
||||
}
|
||||
|
||||
-static void bitbang_spi_set_sck(const const struct bitbang_spi_master *master, int val)
|
||||
+static void bitbang_spi_set_sck(const struct bitbang_spi_master *master, int val)
|
||||
{
|
||||
master->set_sck(val);
|
||||
}
|
||||
|
||||
-static void bitbang_spi_set_mosi(const const struct bitbang_spi_master *master, int val)
|
||||
+static void bitbang_spi_set_mosi(const struct bitbang_spi_master *master, int val)
|
||||
{
|
||||
master->set_mosi(val);
|
||||
}
|
||||
|
||||
-static int bitbang_spi_get_miso(const const struct bitbang_spi_master *master)
|
||||
+static int bitbang_spi_get_miso(const struct bitbang_spi_master *master)
|
||||
{
|
||||
return master->get_miso();
|
||||
}
|
||||
|
||||
-static void bitbang_spi_request_bus(const const struct bitbang_spi_master *master)
|
||||
+static void bitbang_spi_request_bus(const struct bitbang_spi_master *master)
|
||||
{
|
||||
if (master->request_bus)
|
||||
master->request_bus();
|
||||
}
|
||||
|
||||
-static void bitbang_spi_release_bus(const const struct bitbang_spi_master *master)
|
||||
+static void bitbang_spi_release_bus(const struct bitbang_spi_master *master)
|
||||
{
|
||||
if (master->release_bus)
|
||||
master->release_bus();
|
||||
diff --git a/dummyflasher.c b/dummyflasher.c
|
||||
index 66d0df0..d0de41c 100644
|
||||
--- a/dummyflasher.c
|
||||
+++ b/dummyflasher.c
|
||||
@@ -66,7 +66,7 @@ int spi_ignorelist_size = 0;
|
||||
static uint8_t emu_status = 0;
|
||||
|
||||
/* A legit complete SFDP table based on the MX25L6436E (rev. 1.8) datasheet. */
|
||||
-static const uint8_t const sfdp_table[] = {
|
||||
+static const uint8_t sfdp_table[] = {
|
||||
0x53, 0x46, 0x44, 0x50, // @0x00: SFDP signature
|
||||
0x00, 0x01, 0x01, 0xFF, // @0x04: revision 1.0, 2 headers
|
||||
0x00, 0x00, 0x01, 0x09, // @0x08: JEDEC SFDP header rev. 1.0, 9 DW long
|
||||
--
|
||||
1.9.1
|
||||
|
||||
@@ -5,11 +5,17 @@ HOMEPAGE = "http://flashrom.org"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
|
||||
DEPENDS = "pciutils"
|
||||
|
||||
SRC_URI = "http://download.flashrom.org/releases/flashrom-${PV}.tar.bz2"
|
||||
SRC_URI = "http://download.flashrom.org/releases/flashrom-${PV}.tar.bz2 \
|
||||
file://0001-Fix-compilation-on-aarch64.patch \
|
||||
file://0002-Disable-Wtautological-pointer-compare-when-using-cla.patch \
|
||||
file://0003-remove-duplicate-const-qualifiers.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "407e836c0a2b17ec76583cb6809f65e5"
|
||||
SRC_URI[sha256sum] = "6f7b588cce74c90b4fe9c9c794de105de76e0323442fb5770b1aeab81e9d560a"
|
||||
|
||||
CFLAGS += "-Wno-error=unknown-pragmas"
|
||||
|
||||
do_install() {
|
||||
oe_runmake PREFIX=${prefix} DESTDIR=${D} install
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user