Skip to contentSkip to conversation

tools/gpio: switch to tools buildsystem

PATCH In review Andy Shevchenko 3 participants 5 messages Jun 19, 2016 – Jun 23, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover tools/gpio: switch to tools buildsystem

Current environment is not allowed to easily build the tools. Move to tools buildsystem to allow user build gpio tools using only existing kernel sources. Besides that support O=/path/to/build/dir option.

In v3:
- fold patch 1 & 2 (Alexandre Courbot)
- add CROSS_COMPILE prefix to ld (Alexandre Courbot)
- move definition of bindir to last patch

In v2:
- remove $(Q) for now for shell commands
- add cover letter

Andy Shevchenko (2):
tools/gpio: move to tools buildsystem
tools/gpio: add install section

 tools/Makefile      |  7 ++---
 tools/gpio/Build    |  3 +++
 tools/gpio/Makefile | 77 +++++++++++++++++++++++++++++++++++++++++++++++------
 3 files changed, 76 insertions(+), 11 deletions(-)
 create mode 100644 tools/gpio/Build
Signature · 1 line
2.8.1
#1 lore raw

PATCH v3 1/2 tools/gpio: move to tools buildsystem

There is a nice buildsystem dedicated for userspace tools in Linux kernel tree. Switch gpio target to be built by it.

---
 tools/gpio/Build    |  3 +++
 tools/gpio/Makefile | 69 ++++++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 64 insertions(+), 8 deletions(-)
 create mode 100644 tools/gpio/Build
tools/gpio/Build new file +3 -0
new file mode 100644
index 0000000..620c1937
@@ -0,0 +1,3 @@
+lsgpio-y += lsgpio.o gpio-utils.o
+gpio-hammer-y += gpio-hammer.o gpio-utils.o
+gpio-event-mon-y += gpio-event-mon.o gpio-utils.o
tools/gpio/Makefile +61 -8

75 lines not on this page · raw message

Signature · 1 line
2.8.1
#2 lore raw

PATCH v3 2/2 tools/gpio: add install section

In reply to Andy Shevchenko

Allow user to call install target.

---
 tools/Makefile      |  7 ++++---
 tools/gpio/Makefile | 10 +++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)
tools/Makefile +4 -3
index f10b64d8..daa8fb3 100644
@@ -85,7 +85,7 @@ tmon: FORCE
 freefall: FORCE
 	$(call descend,laptop/$@)
 
-all: acpi cgroup cpupower hv firewire lguest \
+all: acpi cgroup cpupower gpio hv firewire lguest \
 		perf selftests turbostat usb \
 		virtio vm net x86_energy_perf_policy \
 		tmon freefall objtool
@@ -96,7 +96,7 @@ acpi_install:
 cpupower_install:
 	$(call descend,power/$(@:_install=),install)
 
-cgroup_install firewire_install hv_install lguest_install perf_install usb_install virtio_install vm_install net_install objtool_install:
+cgroup_install firewire_install gpio_install hv_install lguest_install perf_install usb_install virtio_install vm_install net_install objtool_install:
 	$(call descend,$(@:_install=),install)
 
 selftests_install:
@@ -114,7 +114,8 @@ freefall_install:
 kvm_stat_install:
 	$(call descend,kvm/$(@:_install=),install)
 
-install: acpi_install cgroup_install cpupower_install hv_install firewire_install lguest_install \
+install: acpi_install cgroup_install cpupower_install gpio_install \
+		hv_install firewire_install lguest_install \
 		perf_install selftests_install turbostat_install usb_install \
 		virtio_install vm_install net_install x86_energy_perf_policy_install \
 		tmon_install freefall_install objtool_install kvm_stat_install
tools/gpio/Makefile +9 -1
index 5a82f15..250a891 100644
@@ -1,5 +1,7 @@
 include ../scripts/Makefile.include
 
+bindir ?= /usr/bin
+
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
@@ -62,6 +64,12 @@ clean:
 	rm -f $(OUTPUT)include/linux/gpio.h
 	find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
 
+install: $(ALL_PROGRAMS)
+	install -d -m 755 $(DESTDIR)$(bindir);		\
+	for program in $(ALL_PROGRAMS); do		\
+		install $$program $(DESTDIR)$(bindir);	\
+	done
+
 FORCE:
 
-.PHONY: all clean FORCE prepare
+.PHONY: all install clean FORCE prepare
Signature · 1 line
2.8.1
Acked-by Tested-by on the v3 series
#3 lore raw
In reply to Andy Shevchenko
Quoted 3 lines · Andy Shevchenko

Current environment is not allowed to easily build the tools. Move to tools buildsystem to allow user build gpio tools using only existing kernel sources. Besides that support O=/path/to/build/dir option.

Cross-compilation working like a charm now!

Both patches,

Thanks!

#4 lore raw
In reply to Andy Shevchenko
Quoted 8 lines · Andy Shevchenko

Current environment is not allowed to easily build the tools. Move to tools buildsystem to allow user build gpio tools using only existing kernel sources. Besides that support O=/path/to/build/dir option.

In v3:
- fold patch 1 & 2 (Alexandre Courbot)
- add CROSS_COMPILE prefix to ld (Alexandre Courbot)
- move definition of bindir to last patch

Both patches applied with Alexandre's ACK/Test tags. Excellent work, thank you for fixing up my uglyhacks.

I think my tools were inspired by tools/iio, now that needs fixing too...

Yours,
Linus Walleij