Skip to contentSkip to conversation

tools/gpio: switch to tools buildsystem

PATCH Superseded Andy Shevchenko 2 participants 7 messages Jun 18, 2016 – Jun 19, 2016

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#1 lore raw

PATCH v2 1/3 tools/gpio: remove old Makefile

In reply to Andy Shevchenko

Prepare to switch to tools build system, i.e. remove Makefile completely. There is no much sense to keep it since it will be rewritten (almost) completely.

---
 tools/gpio/Makefile | 14 --------------
 1 file changed, 14 deletions(-)
 delete mode 100644 tools/gpio/Makefile
tools/gpio/Makefile deleted +0 -14
deleted file mode 100644
index 619314f..0000000
@@ -1,14 +0,0 @@
-CC = $(CROSS_COMPILE)gcc
-CFLAGS += -O2 -Wall -g -D_GNU_SOURCE
-
-all: lsgpio gpio-hammer gpio-event-mon
-
-lsgpio: lsgpio.o gpio-utils.o
-gpio-hammer: gpio-hammer.o gpio-utils.o
-gpio-event-mon: gpio-event-mon.o gpio-utils.o
-
-%.o: %.c gpio-utils.h
-
-.PHONY: clean
-clean:
-	rm -f *.o lsgpio gpio-hammer gpio-event-mon
Signature · 1 line
2.8.1
#2 lore raw

PATCH v2 2/3 tools/gpio: move to tools buildsystem

In reply to Andy Shevchenko

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 | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100644 tools/gpio/Build
 create mode 100644 tools/gpio/Makefile
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 new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.8.1
#3 lore raw

PATCH v2 3/3 tools/gpio: add install section

In reply to Andy Shevchenko

Allow user to call install target.

---
 tools/Makefile      | 7 ++++---
 tools/gpio/Makefile | 8 +++++++-
 2 files changed, 11 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 +7 -1
index d151b42..2f9fd55 100644
@@ -72,6 +72,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
#0 lore raw

v2 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 v2:
- remove $(Q) for now for shell commands
- add cover letter

Andy Shevchenko (3):
tools/gpio: remove old Makefile
tools/gpio: move to tools buildsystem
tools/gpio: add install section

 tools/Makefile      |  7 +++--
 tools/gpio/Build    |  3 ++
 tools/gpio/Makefile | 85 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 84 insertions(+), 11 deletions(-)
 create mode 100644 tools/gpio/Build
Signature · 1 line
2.8.1
#4 lore raw
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.

Very good idea. I just have a few issues with the current patchset:

1) I think patch 1 and 2 should be merged, otherwise we would have one commit where the GPIO tools are not available anymore
2) When trying to cross-compile the tools, I am hitting the following error:

arm-linux-gnueabihf-gcc -Wp,-MD,./.lsgpio.o.d,-MT,lsgpio.o -O2 -Wall
-g -D_GNU_SOURCE -Iinclude -D"BUILD_STR(s)=#s" -c -o lsgpio.o
lsgpio.c
arm-linux-gnueabihf-gcc -Wp,-MD,./.gpio-utils.o.d,-MT,gpio-utils.o
-O2 -Wall -g -D_GNU_SOURCE -Iinclude -D"BUILD_STR(s)=#s" -c -o
gpio-utils.o gpio-utils.c
ld -r -o lsgpio-in.o lsgpio.o gpio-utils.o
lsgpio.o: error adding symbols: File in wrong format

Looks like the host linker is invoked instead of the target one.

#5 lore raw
Quoted 11 lines · Alexandre Courbot
Quoted 4 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.

Very good idea. I just have a few issues with the current patchset:

1) I think patch 1 and 2 should be merged, otherwise we would have one commit where the GPIO tools are not available anymore

No objection!

Quoted 12 lines

2) When trying to cross-compile the tools, I am hitting the following error:

  arm-linux-gnueabihf-gcc -Wp,-MD,./.lsgpio.o.d,-MT,lsgpio.o -O2 -Wall -g -D_GNU_SOURCE -Iinclude -D"BUILD_STR(s)=#s"   -c -o lsgpio.o lsgpio.c
  arm-linux-gnueabihf-gcc -Wp,-MD,./.gpio-utils.o.d,-MT,gpio-utils.o -O2 -Wall -g -D_GNU_SOURCE -Iinclude -D"BUILD_STR(s)=#s"   -c -o gpio-utils.o gpio-utils.c
   ld -r -o lsgpio-in.o  lsgpio.o gpio-utils.o
lsgpio.o: error adding symbols: File in wrong format

Quoted 1 line

Looks like the host linker is invoked instead of the target one.

Can you try to add

LD = $(CROSS_COMPILE)ld

into Makefile and re-run?

Signature · 6 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw
Quoted 27 lines · Andy Shevchenko
Quoted 11 lines · Alexandre Courbot
Quoted 4 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.

Very good idea. I just have a few issues with the current patchset:

1) I think patch 1 and 2 should be merged, otherwise we would have one commit where the GPIO tools are not available anymore

No objection!

Quoted 12 lines

2) When trying to cross-compile the tools, I am hitting the following error:

arm-linux-gnueabihf-gcc -Wp,-MD,./.lsgpio.o.d,-MT,lsgpio.o -O2 -Wall
-g -D_GNU_SOURCE -Iinclude -D"BUILD_STR(s)=#s" -c -o lsgpio.o
lsgpio.c
arm-linux-gnueabihf-gcc -Wp,-MD,./.gpio-utils.o.d,-MT,gpio-utils.o
-O2 -Wall -g -D_GNU_SOURCE -Iinclude -D"BUILD_STR(s)=#s" -c -o
gpio-utils.o gpio-utils.c
ld -r -o lsgpio-in.o lsgpio.o gpio-utils.o
lsgpio.o: error adding symbols: File in wrong format

Quoted 7 lines
Quoted 1 line

Looks like the host linker is invoked instead of the target one.

Can you try to add

LD = $(CROSS_COMPILE)ld

into Makefile and re-run?

That fixes it, thanks! Will try again with the next revision.

This series makes me happy, I never found how to cross-compile the GPIO tools with the previous Makefile...