Skip to contentSkip to conversation

package/linux-tools: add support for pcitest tool

PATCH New Gustavo Pimentel 3 participants 5 messages Nov 8, 2018 – Nov 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/linux-tools: add support for pcitest tool

Add support for selection and compiling the pcitest tool on buildroot.

This tool is available to be compiled since kernel 4.20.

---
 package/linux-tools/Config.in            |  7 +++++++
 package/linux-tools/linux-tool-pci.mk.in | 29 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-pci.mk.in
package/linux-tools/Config.in +7 -0
index 349dc6b..d1b94c2 100644
@@ -34,6 +34,13 @@ config BR2_PACKAGE_LINUX_TOOLS_IIO
 
 	  These tools are available only from kernel version 4.7.
 
+config BR2_PACKAGE_LINUX_TOOLS_PCI
+	bool "pci"
+	select BR2_PACKAGE_LINUX_TOOLS
+	help
+	  pcitest is a tool for testing capabilities related to a
+	  PCI Endpoint (only works with specific Endpoints).
+
 config BR2_PACKAGE_LINUX_TOOLS_PERF
 	bool "perf"
 	select BR2_PACKAGE_LINUX_TOOLS
package/linux-tools/linux-tool-pci.mk.in new file +29 -0
new file mode 100644
index 0000000..e49d4eb
@@ -0,0 +1,29 @@
+################################################################################
+#
+# pci
+#
+################################################################################
+
+LINUX_TOOLS += pci
+
+PCI_MAKE_OPTS = $(LINUX_MAKE_FLAGS)
+
+define PCI_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/pci/Makefile >/dev/null 2>&1 ; then \
+		echo "Your kernel version is too old and does not have install section in the pci tools." ; \
+		echo "At least kernel 4.7 must be used." ; \
+		exit 1 ; \
+	fi
+
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/pci \
+		$(PCI_MAKE_OPTS)
+endef
+
+# DESTDIR used since kernel version 4.14
+define PCI_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/pci \
+		$(PCI_MAKE_OPTS) \
+		INSTALL_ROOT=$(TARGET_DIR) \
+		DESTDIR=$(TARGET_DIR) \
+		install
+endef
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 package/linux-tools: add support for pcitest tool

Hello Gustavo,

Thanks for this contribution, however, I have a question below.

package/linux-tools/linux-tool-pci.mk.in line 14

Quoted 4 lines · Gustavo Pimentel
package/linux-tools/linux-tool-pci.mk.in new file +4 -0
+define PCI_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/pci/Makefile >/dev/null 2>&1 ; then \
+		echo "Your kernel version is too old and does not have install section in the pci tools." ; \
+		echo "At least kernel 4.7 must be used." ; \

I tried building with 4.18, but still ran into this error. Indeed, it's only in 4.19 that your patch
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/tools/pci?id=1ce78ce09430a5ffb987015ab2e24d145690b9a3
was added, which adds the Makefile.

So, either you fallback to building pcitest.c manually if there is no Makefile, or the error message should be updated to say "At least kernel 4.19 must be used".

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/linux-tools: add support for pcitest tool

Quoted 16 lines · Thomas Petazzoni

Hello Gustavo,

Thanks for this contribution, however, I have a question below.

package/linux-tools/linux-tool-pci.mk.in line 14

Quoted 4 lines · Gustavo Pimentel
package/linux-tools/linux-tool-pci.mk.in new file +4 -0
+define PCI_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/pci/Makefile >/dev/null 2>&1 ; then \
+		echo "Your kernel version is too old and does not have install section in the pci tools." ; \
+		echo "At least kernel 4.7 must be used." ; \

I tried building with 4.18, but still ran into this error. Indeed, it's only in 4.19 that your patch
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/tools/pci?id=1ce78ce09430a5ffb987015ab2e24d145690b9a3
was added, which adds the Makefile.

Quoted 3 lines

So, either you fallback to building pcitest.c manually if there is no Makefile, or the error message should be updated to say "At least kernel 4.19 must be used".

Also, your patch mentions 3 different kernel versions: in the commit log it's
4.20, in the help text it's not mentioned (it should be), in the error message it's 4.7, and in the comment about DESTDIR it's 4.14.

But if it's only available in 4.19+, that thing about DESTDIR is irrelevant,
no? So it should always be DESTDIR, never INSTALL_ROOT?

Regards,
Arnout

#3 lore raw

PATCH 1/1 package/linux-tools: add support for pcitest tool

Quoted 19 lines · Arnout Vandecappelle
Quoted 16 lines · Thomas Petazzoni

Hello Gustavo,

Thanks for this contribution, however, I have a question below.

package/linux-tools/linux-tool-pci.mk.in line 14

Quoted 4 lines · Gustavo Pimentel
package/linux-tools/linux-tool-pci.mk.in new file +4 -0
+define PCI_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/pci/Makefile >/dev/null 2>&1 ; then \
+		echo "Your kernel version is too old and does not have install section in the pci tools." ; \
+		echo "At least kernel 4.7 must be used." ; \

I tried building with 4.18, but still ran into this error. Indeed, it's only in 4.19 that your patch
https://urldefense.proofpoint.com/v2/url?u=https-3A__git.kernel.org_pub_scm_linux_kernel_git_torvalds_linux.git_commit_tools_pci-3Fid-3D1ce78ce09430a5ffb987015ab2e24d145690b9a3&d=DwICaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=bkWxpLoW-f-E3EdiDCCa0_h0PicsViasSlvIpzZvPxs&m=42FtAgE43Y-ecR9vgGhkkdOiiFMdSJR9VC4_qQjO2uA&s=0c1L3G6rzwM1VCMyKHTixgwJlepqW9_c3sEIS6V2Qpg&e=
was added, which adds the Makefile.

Quoted 7 lines
Quoted 3 lines

So, either you fallback to building pcitest.c manually if there is no Makefile, or the error message should be updated to say "At least kernel 4.19 must be used".

Also, your patch mentions 3 different kernel versions: in the commit log it's
4.20, in the help text it's not mentioned (it should be), in the error message it's 4.7, and in the comment about DESTDIR it's 4.14.

Ok, I will fix it, should all be 4.20

Quoted 3 lines

But if it's only available in 4.19+, that thing about DESTDIR is irrelevant,
no? So it should always be DESTDIR, never INSTALL_ROOT?

It was a copy & paste from linux-tool-iio.mk.in I will fixed it. Thanks.

Quoted 4 lines

Regards,
Arnout

#4 lore raw

PATCH 1/1 package/linux-tools: add support for pcitest tool

In reply to Thomas Petazzoni

Hi Thomas,

Quoted 16 lines · Thomas Petazzoni

Hello Gustavo,

Thanks for this contribution, however, I have a question below.

package/linux-tools/linux-tool-pci.mk.in line 14

Quoted 4 lines · Gustavo Pimentel
package/linux-tools/linux-tool-pci.mk.in new file +4 -0
+define PCI_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/pci/Makefile >/dev/null 2>&1 ; then \
+		echo "Your kernel version is too old and does not have install section in the pci tools." ; \
+		echo "At least kernel 4.7 must be used." ; \

I tried building with 4.18, but still ran into this error. Indeed, it's only in 4.19 that your patch
https://urldefense.proofpoint.com/v2/url?u=https-3A__git.kernel.org_pub_scm_linux_kernel_git_torvalds_linux.git_commit_tools_pci-3Fid-3D1ce78ce09430a5ffb987015ab2e24d145690b9a3&d=DwICAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=bkWxpLoW-f-E3EdiDCCa0_h0PicsViasSlvIpzZvPxs&m=qVWqkVnASamZzXF3WT9zuVfDKzd-ifqSCFv7Y-iN10s&s=hndtmBXj6oMoxc26JB-kTsCWJbyEVOy2kYhSbLfqMng&e=
was added, which adds the Makefile.

Quoted 3 lines

So, either you fallback to building pcitest.c manually if there is no Makefile, or the error message should be updated to say "At least kernel 4.19 must be used".

You're right. I'll update the error message.
Thanks.

Gustavo

Quoted 5 lines

Best regards,

Thomas