* [PATCH] tools: gpio: add kernel headers in CFLAGS
@ 2016-02-26 14:06 Bamvor Jian Zhang
2016-03-07 5:01 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Bamvor Jian Zhang @ 2016-02-26 14:06 UTC (permalink / raw)
To: linux-gpio; +Cc: linus.walleij, broonie, Bamvor Jian Zhang
From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Gpio tools require linux/gpio.h which may be only exist in kernel
source code in a cross compile environment.
Add such header to CFLAGS to avoid compiling failure.
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
---
tools/gpio/Makefile | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
index 4d198d5..6b8804f 100644
--- a/tools/gpio/Makefile
+++ b/tools/gpio/Makefile
@@ -1,5 +1,11 @@
+ifneq ($(INSTALL_HDR_PATH),)
+KERNEL_HEADERS := $(INSTALL_HDR_PATH)/include
+else
+KERNEL_HEADERS ?= $(abspath ../../usr/include)
+endif
+
CC = $(CROSS_COMPILE)gcc
-CFLAGS += -Wall -g -D_GNU_SOURCE
+CFLAGS += -Wall -g -D_GNU_SOURCE -I $(KERNEL_HEADERS)
all: lsgpio
--
2.6.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tools: gpio: add kernel headers in CFLAGS
2016-02-26 14:06 [PATCH] tools: gpio: add kernel headers in CFLAGS Bamvor Jian Zhang
@ 2016-03-07 5:01 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2016-03-07 5:01 UTC (permalink / raw)
To: Bamvor Jian Zhang; +Cc: linux-gpio, Mark Brown, Bamvor Jian Zhang
On Fri, Feb 26, 2016 at 9:06 PM, Bamvor Jian Zhang <bamv2005@gmail.com> wrote:
> From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
>
> Gpio tools require linux/gpio.h which may be only exist in kernel
> source code in a cross compile environment.
>
> Add such header to CFLAGS to avoid compiling failure.
>
> Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
I already got a patch like this and NACKed it: the procedure to compile
userspace tools is:
make -C ${LINUX_TREE} headers_install ARCH=<arch> INSTALL_HDR_PATH=<bar>
cd tools/gpio
make CFLAGS="${CFLAGS} -I<bar>"
So you push the new locations of your fresh kernel headers to the front of the
include path. But make headers_install is mandatory before trying to compile
userspace, as uapi may differ between architectures.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-07 5:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 14:06 [PATCH] tools: gpio: add kernel headers in CFLAGS Bamvor Jian Zhang
2016-03-07 5:01 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.