diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-10-18 22:38:28 -0700 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2016-10-26 10:28:39 +0200 |
commit | b8ecf243e2bd9c1f068fb22e988ae5a3ad65b3c6 (patch) | |
tree | 8be19cabe066d364ba90fea7b7dc2541d0a2c585 | |
parent | 2449866d8293311060f15f5e9ec9c020e1a83ce6 (diff) | |
download | meta-openembedded-b8ecf243e2bd9c1f068fb22e988ae5a3ad65b3c6.tar.gz |
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>
4 files changed, 175 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/0001-Fix-compilation-on-aarch64.patch b/meta-oe/recipes-extended/flashrom/flashrom/0001-Fix-compilation-on-aarch64.patch new file mode 100644 index 000000000..6c2f64ed9 --- /dev/null +++ b/meta-oe/recipes-extended/flashrom/flashrom/0001-Fix-compilation-on-aarch64.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From d9e4dc750dc45e42b482d744829254a3672c11b3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 19 Oct 2016 00:24:08 +0000 | ||
4 | Subject: [PATCH 1/3] Fix compilation on aarch64 | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | arch.h | 2 +- | ||
9 | hwaccess.c | 2 +- | ||
10 | hwaccess.h | 6 +++--- | ||
11 | 3 files changed, 5 insertions(+), 5 deletions(-) | ||
12 | |||
13 | Index: flashrom-0.9.6.1/arch.h | ||
14 | =================================================================== | ||
15 | --- flashrom-0.9.6.1.orig/arch.h | ||
16 | +++ flashrom-0.9.6.1/arch.h | ||
17 | @@ -27,7 +27,7 @@ | ||
18 | #define __FLASHROM_ARCH__ "mips" | ||
19 | #elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__) | ||
20 | #define __FLASHROM_ARCH__ "ppc" | ||
21 | -#elif defined(__arm__) | ||
22 | +#elif defined(__arm__) || defined(__aarch64__) | ||
23 | #define __FLASHROM_ARCH__ "arm" | ||
24 | #endif | ||
25 | __FLASHROM_ARCH__ | ||
26 | Index: flashrom-0.9.6.1/hwaccess.c | ||
27 | =================================================================== | ||
28 | --- flashrom-0.9.6.1.orig/hwaccess.c | ||
29 | +++ flashrom-0.9.6.1/hwaccess.c | ||
30 | @@ -121,7 +121,7 @@ int rget_io_perms(void) | ||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | -#elif defined (__arm__) | ||
35 | +#elif defined (__arm__) || defined (__aarch64__) | ||
36 | |||
37 | static inline void sync_primitive(void) | ||
38 | { | ||
39 | Index: flashrom-0.9.6.1/hwaccess.h | ||
40 | =================================================================== | ||
41 | --- flashrom-0.9.6.1.orig/hwaccess.h | ||
42 | +++ flashrom-0.9.6.1/hwaccess.h | ||
43 | @@ -68,8 +68,8 @@ | ||
44 | #error Little-endian PowerPC #defines are unknown | ||
45 | #endif | ||
46 | |||
47 | -#elif defined (__arm__) | ||
48 | -#if defined (__ARMEL__) | ||
49 | +#elif defined (__arm__) || defined (__aarch64__) | ||
50 | +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | ||
51 | #define __FLASHROM_LITTLE_ENDIAN__ 1 | ||
52 | #else | ||
53 | #error Big-endian ARM #defines are unknown | ||
54 | @@ -337,7 +337,7 @@ int libpayload_wrmsr(int addr, msr_t msr | ||
55 | |||
56 | /* PCI port I/O is not yet implemented on MIPS. */ | ||
57 | |||
58 | -#elif defined(__arm__) | ||
59 | +#elif defined(__arm__) || defined (__aarch64__) | ||
60 | |||
61 | /* Non memory mapped I/O is not supported on ARM. */ | ||
62 | |||
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/0002-Disable-Wtautological-pointer-compare-when-using-cla.patch b/meta-oe/recipes-extended/flashrom/flashrom/0002-Disable-Wtautological-pointer-compare-when-using-cla.patch new file mode 100644 index 000000000..aec11bffa --- /dev/null +++ b/meta-oe/recipes-extended/flashrom/flashrom/0002-Disable-Wtautological-pointer-compare-when-using-cla.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From 9be0d152dfe8ac0f9b665d61aeb3f99dae533e0f Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 19 Oct 2016 00:25:09 +0000 | ||
4 | Subject: [PATCH 2/3] Disable Wtautological-pointer-compare when using clang | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | flashrom.c | 4 ++++ | ||
9 | 1 file changed, 4 insertions(+) | ||
10 | |||
11 | diff --git a/flashrom.c b/flashrom.c | ||
12 | index 04e9934..bf49104 100644 | ||
13 | --- a/flashrom.c | ||
14 | +++ b/flashrom.c | ||
15 | @@ -1569,6 +1569,9 @@ int selfcheck(void) | ||
16 | * For 'flashchips' we check the first element to be non-null. In the | ||
17 | * other cases there exist use cases where the first element can be | ||
18 | * null. */ | ||
19 | +#pragma clang diagnostic push | ||
20 | +#pragma clang diagnostic ignored "-Wtautological-pointer-compare" | ||
21 | + | ||
22 | if (flashchips == NULL || flashchips[0].vendor == NULL) { | ||
23 | msg_gerr("Flashchips table miscompilation!\n"); | ||
24 | ret = 1; | ||
25 | @@ -1602,6 +1605,7 @@ int selfcheck(void) | ||
26 | msg_gerr("Known laptops table does not exist!\n"); | ||
27 | ret = 1; | ||
28 | } | ||
29 | +#pragma clang diagnostic pop | ||
30 | #endif | ||
31 | return ret; | ||
32 | } | ||
33 | -- | ||
34 | 1.9.1 | ||
35 | |||
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/0003-remove-duplicate-const-qualifiers.patch b/meta-oe/recipes-extended/flashrom/flashrom/0003-remove-duplicate-const-qualifiers.patch new file mode 100644 index 000000000..99283d37f --- /dev/null +++ b/meta-oe/recipes-extended/flashrom/flashrom/0003-remove-duplicate-const-qualifiers.patch | |||
@@ -0,0 +1,71 @@ | |||
1 | From 42ec9bd51e60aa38fe6e78f644e742d6989b6683 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 19 Oct 2016 00:25:23 +0000 | ||
4 | Subject: [PATCH 3/3] remove duplicate const qualifiers | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | bitbang_spi.c | 12 ++++++------ | ||
9 | dummyflasher.c | 2 +- | ||
10 | 2 files changed, 7 insertions(+), 7 deletions(-) | ||
11 | |||
12 | diff --git a/bitbang_spi.c b/bitbang_spi.c | ||
13 | index 11d2de1..508cf45 100644 | ||
14 | --- a/bitbang_spi.c | ||
15 | +++ b/bitbang_spi.c | ||
16 | @@ -26,33 +26,33 @@ | ||
17 | #include "spi.h" | ||
18 | |||
19 | /* Note that CS# is active low, so val=0 means the chip is active. */ | ||
20 | -static void bitbang_spi_set_cs(const const struct bitbang_spi_master *master, int val) | ||
21 | +static void bitbang_spi_set_cs(const struct bitbang_spi_master *master, int val) | ||
22 | { | ||
23 | master->set_cs(val); | ||
24 | } | ||
25 | |||
26 | -static void bitbang_spi_set_sck(const const struct bitbang_spi_master *master, int val) | ||
27 | +static void bitbang_spi_set_sck(const struct bitbang_spi_master *master, int val) | ||
28 | { | ||
29 | master->set_sck(val); | ||
30 | } | ||
31 | |||
32 | -static void bitbang_spi_set_mosi(const const struct bitbang_spi_master *master, int val) | ||
33 | +static void bitbang_spi_set_mosi(const struct bitbang_spi_master *master, int val) | ||
34 | { | ||
35 | master->set_mosi(val); | ||
36 | } | ||
37 | |||
38 | -static int bitbang_spi_get_miso(const const struct bitbang_spi_master *master) | ||
39 | +static int bitbang_spi_get_miso(const struct bitbang_spi_master *master) | ||
40 | { | ||
41 | return master->get_miso(); | ||
42 | } | ||
43 | |||
44 | -static void bitbang_spi_request_bus(const const struct bitbang_spi_master *master) | ||
45 | +static void bitbang_spi_request_bus(const struct bitbang_spi_master *master) | ||
46 | { | ||
47 | if (master->request_bus) | ||
48 | master->request_bus(); | ||
49 | } | ||
50 | |||
51 | -static void bitbang_spi_release_bus(const const struct bitbang_spi_master *master) | ||
52 | +static void bitbang_spi_release_bus(const struct bitbang_spi_master *master) | ||
53 | { | ||
54 | if (master->release_bus) | ||
55 | master->release_bus(); | ||
56 | diff --git a/dummyflasher.c b/dummyflasher.c | ||
57 | index 66d0df0..d0de41c 100644 | ||
58 | --- a/dummyflasher.c | ||
59 | +++ b/dummyflasher.c | ||
60 | @@ -66,7 +66,7 @@ int spi_ignorelist_size = 0; | ||
61 | static uint8_t emu_status = 0; | ||
62 | |||
63 | /* A legit complete SFDP table based on the MX25L6436E (rev. 1.8) datasheet. */ | ||
64 | -static const uint8_t const sfdp_table[] = { | ||
65 | +static const uint8_t sfdp_table[] = { | ||
66 | 0x53, 0x46, 0x44, 0x50, // @0x00: SFDP signature | ||
67 | 0x00, 0x01, 0x01, 0xFF, // @0x04: revision 1.0, 2 headers | ||
68 | 0x00, 0x00, 0x01, 0x09, // @0x08: JEDEC SFDP header rev. 1.0, 9 DW long | ||
69 | -- | ||
70 | 1.9.1 | ||
71 | |||
diff --git a/meta-oe/recipes-extended/flashrom/flashrom_0.9.6.1.bb b/meta-oe/recipes-extended/flashrom/flashrom_0.9.6.1.bb index a1f0b303a..d3ec5780e 100644 --- a/meta-oe/recipes-extended/flashrom/flashrom_0.9.6.1.bb +++ b/meta-oe/recipes-extended/flashrom/flashrom_0.9.6.1.bb | |||
@@ -5,11 +5,17 @@ HOMEPAGE = "http://flashrom.org" | |||
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" | 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" |
6 | DEPENDS = "pciutils" | 6 | DEPENDS = "pciutils" |
7 | 7 | ||
8 | SRC_URI = "http://download.flashrom.org/releases/flashrom-${PV}.tar.bz2" | 8 | SRC_URI = "http://download.flashrom.org/releases/flashrom-${PV}.tar.bz2 \ |
9 | file://0001-Fix-compilation-on-aarch64.patch \ | ||
10 | file://0002-Disable-Wtautological-pointer-compare-when-using-cla.patch \ | ||
11 | file://0003-remove-duplicate-const-qualifiers.patch \ | ||
12 | " | ||
9 | 13 | ||
10 | SRC_URI[md5sum] = "407e836c0a2b17ec76583cb6809f65e5" | 14 | SRC_URI[md5sum] = "407e836c0a2b17ec76583cb6809f65e5" |
11 | SRC_URI[sha256sum] = "6f7b588cce74c90b4fe9c9c794de105de76e0323442fb5770b1aeab81e9d560a" | 15 | SRC_URI[sha256sum] = "6f7b588cce74c90b4fe9c9c794de105de76e0323442fb5770b1aeab81e9d560a" |
12 | 16 | ||
17 | CFLAGS += "-Wno-error=unknown-pragmas" | ||
18 | |||
13 | do_install() { | 19 | do_install() { |
14 | oe_runmake PREFIX=${prefix} DESTDIR=${D} install | 20 | oe_runmake PREFIX=${prefix} DESTDIR=${D} install |
15 | } | 21 | } |