Skip to contentSkip to conversation

package: Add iotools package

PATCH Applied Andy Shevchenko 4 participants 11 messages Sep 27, 2024 – Oct 31, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package: Add iotools package

The iotools package provides a set of simple command line tools which allow access to hardware device registers. Supported register interfaces include PCI, IO, memory mapped IO, SMBus, CPUID, and MSR. Also included are some utilities which allow for simple arithmetic, logical, and other operations.

If you ever have to debug hardware, you could probably use these tools.

---

v2: removed explicit strip (Baruch), added to DEVELOPERS

 DEVELOPERS                   |  1 +
 package/Config.in            |  1 +
 package/iotools/Config.in    | 14 ++++++++++++++
 package/iotools/iotools.hash |  3 +++
 package/iotools/iotools.mk   | 20 ++++++++++++++++++++
 5 files changed, 39 insertions(+)
 create mode 100644 package/iotools/Config.in
 create mode 100644 package/iotools/iotools.hash
 create mode 100644 package/iotools/iotools.mk
DEVELOPERS +1 -0
index c3b1d66b016b..158313be9335 100644
@@ -230,6 +230,7 @@ F:	package/sysdig/
 
 N:	Andy Shevchenko <[email protected]>
 F:	package/fb-test-app/
+F:	package/iotools/
 
 N:	Anisse Astier <[email protected]>
 F:	package/go/
package/Config.in +1 -0
index bfbec1c21d04..08977a3a92db 100644
@@ -533,6 +533,7 @@ endmenu
 	source "package/i7z/Config.in"
 	source "package/input-event-daemon/Config.in"
 	source "package/intel-microcode/Config.in"
+	source "package/iotools/Config.in"
 	source "package/ipmitool/Config.in"
 	source "package/ipmiutil/Config.in"
 	source "package/irda-utils/Config.in"
package/iotools/Config.in new file +14 -0
new file mode 100644
index 000000000000..ffa1a3666738
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_IOTOOLS
+	bool "iotools"
+	help
+	  Tools for poking all types of IO, supported are:
+	  - CMOS NVRAM (via /dev/nvram)
+	  - CPU ID (x86)
+	  - IO port (x86, PowerPC)
+	  - MMIO
+	  - MSR (x86)
+	  - PCI configuration space
+	  - SCOM (PowerPC)
+	  - SMBus
+
+	  https://github.com/andy-shev/iotools
package/iotools/iotools.hash new file +3 -0
new file mode 100644
index 000000000000..11d7ffb73e39
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  13b8b87c7d1f22b8d8f50c499af09f9414a0879d69c22393f1051ed4bf28f378  iotools-v1.7.tar.gz
+sha256  ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6  COPYING
package/iotools/iotools.mk new file +20 -0
new file mode 100644
index 000000000000..03b87c89e9d0
@@ -0,0 +1,20 @@
+################################################################################
+#
+# iotools
+#
+################################################################################
+
+IOTOOLS_VERSION = v1.7
+IOTOOLS_SITE = $(call github,andy-shev,iotools,$(IOTOOLS_VERSION))
+IOTOOLS_LICENSE = GPL-2.0+
+IOTOOLS_LICENSE_FILES = COPYING
+
+define IOTOOLS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CROSS_COMPILE=$(TARGET_CROSS) all
+endef
+
+define IOTOOLS_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -t $(TARGET_DIR)/usr/bin -D $(@D)/iotools
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.43.0.rc1.1336.g36b5255a03ac

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Shevchenko,
Thanks for your patch,I have a quick test with this tool, it can work on arm64 platform. But i found it also lacks some features that IO doesn't have, such as io cmd support a length arguments, that make it can read It can read a batch of registers at once. Would you consider adding these features in the future?

Quoted 109 lines · Andy Shevchenko

The iotools package provides a set of simple command line tools which allow access to hardware device registers. Supported register interfaces include PCI, IO, memory mapped IO, SMBus, CPUID, and MSR. Also included are some utilities which allow for simple arithmetic, logical, and other operations.

If you ever have to debug hardware, you could probably use these tools.

---

v2: removed explicit strip (Baruch), added to DEVELOPERS

DEVELOPERS                   |  1 +
package/Config.in            |  1 +
package/iotools/Config.in    | 14 ++++++++++++++
package/iotools/iotools.hash |  3 +++
package/iotools/iotools.mk   | 20 ++++++++++++++++++++
5 files changed, 39 insertions(+)

create mode 100644 package/iotools/Config.in
create mode 100644 package/iotools/iotools.hash
create mode 100644 package/iotools/iotools.mk

DEVELOPERS +0 -0
index c3b1d66b016b..158313be9335 100644
@@ -230,6 +230,7 @@ F:	package/sysdig/
 

N: Andy Shevchenko <[email protected]>
F: package/fb-test-app/
+F: package/iotools/

N: Anisse Astier <[email protected]>
F: package/go/

package/Config.in +1 -0
index bfbec1c21d04..08977a3a92db 100644
@@ -533,6 +533,7 @@ endmenu
 	source "package/i7z/Config.in"
 	source "package/input-event-daemon/Config.in"
 	source "package/intel-microcode/Config.in"
+	source "package/iotools/Config.in"
 	source "package/ipmitool/Config.in"
 	source "package/ipmiutil/Config.in"
 	source "package/irda-utils/Config.in"
package/iotools/Config.in new file +14 -0
new file mode 100644
index 000000000000..ffa1a3666738
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_IOTOOLS
+	bool "iotools"
+	help
+	  Tools for poking all types of IO, supported are:
+	  - CMOS NVRAM (via /dev/nvram)
+	  - CPU ID (x86)
+	  - IO port (x86, PowerPC)
+	  - MMIO
+	  - MSR (x86)
+	  - PCI configuration space
+	  - SCOM (PowerPC)
+	  - SMBus
+
+	  https://github.com/andy-shev/iotools
package/iotools/iotools.hash new file +3 -0
new file mode 100644
index 000000000000..11d7ffb73e39
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  13b8b87c7d1f22b8d8f50c499af09f9414a0879d69c22393f1051ed4bf28f378  iotools-v1.7.tar.gz
+sha256  ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6  COPYING
package/iotools/iotools.mk new file +20 -0
new file mode 100644
index 000000000000..03b87c89e9d0
@@ -0,0 +1,20 @@
+################################################################################
+#
+# iotools
+#
+################################################################################
+
+IOTOOLS_VERSION = v1.7
+IOTOOLS_SITE = $(call github,andy-shev,iotools,$(IOTOOLS_VERSION))
+IOTOOLS_LICENSE = GPL-2.0+
+IOTOOLS_LICENSE_FILES = COPYING
+
+define IOTOOLS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CROSS_COMPILE=$(TARGET_CROSS) all
+endef
+
+define IOTOOLS_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -t $(TARGET_DIR)/usr/bin -D $(@D)/iotools
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.43.0.rc1.1336.g36b5255a03ac

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 5 lines · Andy Yan

Thanks for your patch,I have a quick test with this tool, it can work on arm64 platform. But i found it also lacks some features that IO doesn't have, such as io cmd support a length arguments, that make it can read It can read a batch of registers at once. Would you consider adding these features in the future?

I'm not sure I got this. There are two commands mmio_dump (to read any memory mapped IO range) and mmio_load (to write the range from a file).

Quoted 8 lines
Quoted 7 lines · Andy Shevchenko

The iotools package provides a set of simple command line tools which allow access to hardware device registers. Supported register interfaces include PCI, IO, memory mapped IO, SMBus, CPUID, and MSR. Also included are some utilities which allow for simple arithmetic, logical, and other operations.

If you ever have to debug hardware, you could probably use these tools.

Signature · 8 lines
With Best Regards,
Andy Shevchenko


_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to Andy Shevchenko
Quoted 7 lines · Andy Shevchenko

The iotools package provides a set of simple command line tools which allow access to hardware device registers. Supported register interfaces include PCI, IO, memory mapped IO, SMBus, CPUID, and MSR. Also included are some utilities which allow for simple arithmetic, logical, and other operations.

If you ever have to debug hardware, you could probably use these tools.

Can this be pulled eventually? Or is there any comment I have to address?

Signature · 8 lines
With Best Regards,
Andy Shevchenko


_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

---- On Mon, 14 Oct 2024 10:38:22 -0500 Andy Shevchenko wrote ---

Quoted 7 lines

Can this be pulled eventually? Or is there any comment I have to address?

Signature · 2 lines
With Best Regards, 
Andy Shevchenko 

Hi Andy,
I contributed the {mem,mmio}_{load,dump} commands to your repo back in 2021 and had been considering submitting a package to Buildroot, since I find the utility so useful. It's the first package that I add to br2_external trees that I work with. Thanks for taking the lead.

There are a couple of things that I noticed in the patch that could easily be fixed.

1. Despite being tagged as v1.7, the Makefile VER_MINOR is still 6, so the resulting binary reports "version 1.6".
2. It would be nice if the package populated command symlinks in the target filesystem. That could be done in a number of way, like using an explicit list of commands maintained in the package Makefile (iotools.mk) or adding a host-build dependency and leveraging the --list-cmds output to get the list of embedded commands for linking.

-Aaron
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
Quoted 9 lines · Aaron Sierra

---- On Mon, 14 Oct 2024 10:38:22 -0500 Andy Shevchenko wrote ---

Quoted 2 lines

Can this be pulled eventually? Or is there any comment I have to address?

I contributed the {mem,mmio}_{load,dump} commands to your repo back in 2021 and had been considering submitting a package to Buildroot, since I find the utility so useful. It's the first package that I add to br2_external trees that I work with. Thanks for taking the lead.

Quoted 5 lines

There are a couple of things that I noticed in the patch that could easily be fixed.

1. Despite being tagged as v1.7, the Makefile VER_MINOR is still 6, so the resulting binary reports "version 1.6".

Thanks for catching this! I'll look at this at some point, have a lot of stuff to do...

Quoted 5 lines

2. It would be nice if the package populated command symlinks in the target filesystem. That could be done in a number of way, like using an explicit list of commands maintained in the package Makefile (iotools.mk) or adding a host-build dependency and leveraging the --list-cmds output to get the list of embedded commands for linking.

No, I don't do this. I explained why in the reply to Vincent.

Signature · 8 lines
With Best Regards,
Andy Shevchenko


_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw
In reply to Andy Shevchenko
Quoted 10 lines · On Fri, 27 Sep 2024 21:34:59 +0300 Andy Shevchenko…

The iotools package provides a set of simple command line tools which allow access to hardware device registers. Supported register interfaces include PCI, IO, memory mapped IO, SMBus, CPUID, and MSR. Also included are some utilities which allow for simple arithmetic, logical, and other operations.

If you ever have to debug hardware, you could probably use these tools.

---

Applied to master after doing some tweaks:

- Used STATIC=1/STATIC=0 to achieve the proper behavior with regard to BR2_STATIC_LIBS

- Use the canonical $(INSTALL) incantation for the installation step

One thing that isn't super nice is your handling of the DEBUG variable. Ideally in Buildroot we would want neither DEBUG=0 nor DEBUG=1, but "don't do anything and let Buildroot pass the CFLAGS it wants".

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw
Quoted 9 lines · Thomas Petazzoni via buildroot
Quoted 6 lines · On Fri, 27 Sep 2024 21:34:59 +0300 Andy Shevchenko…

The iotools package provides a set of simple command line tools which allow access to hardware device registers. Supported register interfaces include PCI, IO, memory mapped IO, SMBus, CPUID, and MSR. Also included are some utilities which allow for simple arithmetic, logical, and other operations.

Quoted 3 lines
Quoted 1 line

If you ever have to debug hardware, you could probably use these tools.

Applied to master after doing some tweaks:

Thank you!

Quoted 8 lines

- Used STATIC=1/STATIC=0 to achieve the proper behavior with regard to BR2_STATIC_LIBS

- Use the canonical $(INSTALL) incantation for the installation step

One thing that isn't super nice is your handling of the DEBUG variable. Ideally in Buildroot we would want neither DEBUG=0 nor DEBUG=1, but "don't do anything and let Buildroot pass the CFLAGS it wants".

Any suggestion how it may be addressed?

Signature · 8 lines
With Best Regards,
Andy Shevchenko


_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Hello Andy,

Quoted 5 lines · On Mon, 28 Oct 2024 09:57:58 +0200 Andy Shevchenko…
Quoted 3 lines

One thing that isn't super nice is your handling of the DEBUG variable. Ideally in Buildroot we would want neither DEBUG=0 nor DEBUG=1, but "don't do anything and let Buildroot pass the CFLAGS it wants".

Any suggestion how it may be addressed?

1. Don't override the CFLAGS passed by the user

2. Allow a value of DEBUG= that tells your Makefile to not do anything (i.e neither DEBUG=0 nor DEBUG=1)

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw
Quoted 7 lines · Thomas Petazzoni via buildroot
Quoted 4 lines · On Mon, 28 Oct 2024 09:57:58 +0200 Andy Shevchenko…
Quoted 3 lines

One thing that isn't super nice is your handling of the DEBUG variable. Ideally in Buildroot we would want neither DEBUG=0 nor DEBUG=1, but "don't do anything and let Buildroot pass the CFLAGS it wants".

Quoted 6 lines
Quoted 1 line

Any suggestion how it may be addressed?

1. Don't override the CFLAGS passed by the user

2. Allow a value of DEBUG= that tells your Makefile to not do anything (i.e neither DEBUG=0 nor DEBUG=1)

Thanks!

Seems Aaron already does a lot to improve this by moving to CMake. I asked him for a few changes in his PR and most likely we soon have the updated version in Buildroot that satisfies the requirements.

Signature · 8 lines
With Best Regards,
Andy Shevchenko


_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw
Quoted 3 lines · On Thu, 31 Oct 2024 19:25:00 +0200 Andy Shevchenko…

Seems Aaron already does a lot to improve this by moving to CMake. I asked him for a few changes in his PR and most likely we soon have the updated version in Buildroot that satisfies the requirements.

Clearly using a standardized build system (CMake, meson, etc.) will definitely help in having a more "regular" behavior.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot