tools: gpio: add kernel headers in CFLAGS
PATCH 1/1 tools: gpio: add kernel headers in CFLAGS
From: Bamvor Jian Zhang <[email protected]>
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.
--- tools/gpio/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/gpio/Makefile +7 -1
@@ -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
Signature · 1 line
2.6.2
Quoted 8 lines · Bamvor Jian Zhang
From: Bamvor Jian Zhang <[email protected]>
Gpio tools require
linux/gpio.hwhich 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 <[email protected]>
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