Commit fc2c039c authored by Yann E. MORIN's avatar Yann E. MORIN Committed by Peter Korsgaard
Browse files

package/flashrom: fix build failures with musl

flashroms makes a few assumptions on the headers to be included.
It forgets that not everything is using glibc, so it is missing
crucial includes.

Fixes:
    http://autobuild.buildroot.org/results/2a3/2a3744007c630c267575a638ebcd83a4b97644f5/
    http://autobuild.buildroot.org/results/3de/3de936d9be79e151e66af15193084d82a0f2c04a/



Signed-off-by: default avatar"Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: default avatarPeter Korsgaard <peter@korsgaard.com>
parent 78521ca8
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
linux_spi: add missing include

Some defines (e.g. _IOC_SIZEBITS) are defined in linux/ioctl.h,
so it must be included before it is used, by SPI_IOC_MESSAGE
from linux/spi/spidev.h

Fixes build errors with the musl C library, as seen in these
Buidlroot autobuilder failures:

    http://autobuild.buildroot.org/results/2a3/2a3744007c630c267575a638ebcd83a4b97644f5/build-end.log
    http://autobuild.buildroot.org/results/3de/3de936d9be79e151e66af15193084d82a0f2c04a/build-end.log

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

diff -durN flashrom-0.9.8.orig/linux_spi.c flashrom-0.9.8/linux_spi.c
--- flashrom-0.9.8.orig/linux_spi.c	2015-10-28 19:42:38.480285847 +0100
+++ flashrom-0.9.8/linux_spi.c	2015-10-28 19:43:15.492994613 +0100
@@ -27,6 +27,7 @@
 #include <ctype.h>
 #include <unistd.h>
 #include <linux/types.h>
+#include <linux/ioctl.h>
 #include <linux/spi/spidev.h>
 #include <sys/ioctl.h>
 #include "flash.h"
+27 −0
Original line number Diff line number Diff line
hwaccess: sys/io.h is not specific to glibc

Under Linux, sys/io.h provides inb and outb, so we really need it.
However, its inclusion is conditional to the _GLIBC_ define. This is
usually OK under Linux, since both glibc and uClibc define it (uclibc
fakes being glibc).

But the mus lC library does not impersonate glibc, so we're missing
including sys/io.h in this case.

Change the include from checking _GLIBC_ to checking whether this is
Linux, looking for the __linux__ define.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

diff -durN flashrom-0.9.8.orig/hwaccess.h flashrom-0.9.8/hwaccess.h
--- flashrom-0.9.8.orig/hwaccess.h	2015-02-10 09:03:10.000000000 +0100
+++ flashrom-0.9.8/hwaccess.h	2015-10-28 20:01:54.259202484 +0100
@@ -27,7 +27,7 @@
 #include "platform.h"
 
 #if IS_X86
-#if defined(__GLIBC__)
+#if defined(__linux__)
 #include <sys/io.h>
 #endif
 #endif