mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-02 15:53:42 +00:00
[ Upstream commit b68c1c65de ]
Currently the gpio selftests fail to build if the source tree is read
only:
make -j 160 -C tools/testing/selftests TARGETS=gpio
make[1]: Entering directory '/linux/tools/testing/selftests/gpio'
make OUTPUT=/linux/tools/gpio/ -C /linux/tools/gpio
make[2]: Entering directory '/linux/tools/gpio'
mkdir -p /linux/tools/gpio/include/linux 2>&1 || true
ln -sf /linux/tools/gpio/../../include/uapi/linux/gpio.h /linux/tools/gpio/include/linux/gpio.h
ln: failed to create symbolic link '/linux/tools/gpio/include/linux/gpio.h': Read-only file system
This happens because we ask make to build ../../../gpio (tools/gpio)
without pointing OUTPUT away from the source directory.
To fix it we create a subdirectory of the existing OUTPUT directory,
called tools-gpio, and tell tools/gpio to build in there.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
35 lines
806 B
Makefile
35 lines
806 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
VAR_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
|
|
VAR_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
|
|
ifeq ($(VAR_LDLIBS),)
|
|
VAR_LDLIBS := -lmount -I/usr/include/libmount
|
|
endif
|
|
|
|
CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(VAR_CFLAGS)
|
|
LDLIBS += $(VAR_LDLIBS)
|
|
|
|
TEST_PROGS := gpio-mockup.sh
|
|
TEST_FILES := gpio-mockup-sysfs.sh
|
|
TEST_GEN_PROGS_EXTENDED := gpio-mockup-chardev
|
|
|
|
KSFT_KHDR_INSTALL := 1
|
|
include ../lib.mk
|
|
|
|
GPIODIR := $(realpath ../../../gpio)
|
|
GPIOOUT := $(OUTPUT)/tools-gpio/
|
|
GPIOOBJ := $(GPIOOUT)/gpio-utils.o
|
|
|
|
override define CLEAN
|
|
$(RM) $(TEST_GEN_PROGS_EXTENDED)
|
|
$(RM) -rf $(GPIOOUT)
|
|
endef
|
|
|
|
$(TEST_GEN_PROGS_EXTENDED): $(GPIOOBJ)
|
|
|
|
$(GPIOOUT):
|
|
mkdir -p $@
|
|
|
|
$(GPIOOBJ): $(GPIOOUT)
|
|
$(MAKE) OUTPUT=$(GPIOOUT) -C $(GPIODIR)
|