mdio-tools: Add package plus kernel module
authorDamien Mascord <redacted>
Tue, 13 Jul 2021 01:30:09 +0000 (11:30 +1000)
committerDamien Mascord <redacted>
Thu, 15 Jul 2021 06:27:46 +0000 (16:27 +1000)
mdio is a low-level Linux debug tool for communicating with devices attached an MDIO bus. It improves on existing tools in this space in a few important ways:

MDIO buses are directly addressable. Previous solutions relied on at least one Ethernet PHY on the bus being attached to a net device, which is typically not the case when the device is an Ethernet switch for example.
Complex operations can be performed atomically. The old API only supported a single read or write of a single register. mdio sends byte code to the mdio-netlink kernel module that can perform multiple operations, store intermediate values, loop etc. As a result, things like read/mask/write operations and accesses to paged PHYs can be performed safely.

Signed-off-by: Damien Mascord <redacted>
kernel/mdio-netlink/Makefile [new file with mode: 0644]
net/mdio-tools/Makefile [new file with mode: 0644]

diff --git a/kernel/mdio-netlink/Makefile b/kernel/mdio-netlink/Makefile
new file mode 100644 (file)
index 0000000..b0e134a
--- /dev/null
@@ -0,0 +1,40 @@
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=mdio-netlink
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=https://github.com/wkz/mdio-tools
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_DATE:=2021-07-02
+PKG_SOURCE_VERSION:=9f989622c21d5464168a4922542be044f21663b0
+PKG_MIRROR_HASH:=9ae5d920e23a7957a5d5a8c5764969382ce6a174c5c5e7f7841fac0c81bbac75
+
+PKG_LICENSE:=GPL-2.0-only
+PKG_LICENSE_FILES:=COPYING
+
+PKG_MAINTAINER:=Damien Mascord <tusker@tusker.org>
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/mdio-netlink
+  SECTION:=kernel
+  CATEGORY:=Kernel modules
+  SUBMENU:=Network Support
+  TITLE:=mdio-netlink Linux MDIO netlink kernel module
+  KCONFIG:=CONFIG_PHYLIB=y CONFIG_MDIO_BUS=y
+  URL:=https://github.com/wkz/mdio-tools.git
+  FILES:=$(PKG_BUILD_DIR)/kernel/mdio-netlink.ko
+  AUTOLOAD:=$(call AutoProbe,mdio-netlink)
+endef
+
+define KernelPackage/mdio-netlink/description
+   mdio-netlink Linux MDIO netlink kernel module
+endef
+
+define Build/Compile
+       $(KERNEL_MAKE) M=$(PKG_BUILD_DIR)/kernel modules
+endef
+
+$(eval $(call KernelPackage,mdio-netlink))
+
diff --git a/net/mdio-tools/Makefile b/net/mdio-tools/Makefile
new file mode 100644 (file)
index 0000000..55e4c36
--- /dev/null
@@ -0,0 +1,38 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=mdio-tools
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=https://github.com/wkz/mdio-tools
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_DATE:=2021-07-02
+PKG_SOURCE_VERSION:=9f989622c21d5464168a4922542be044f21663b0
+PKG_MIRROR_HASH:=9ae5d920e23a7957a5d5a8c5764969382ce6a174c5c5e7f7841fac0c81bbac75
+
+PKG_FIXUP:=autoreconf
+
+PKG_LICENSE:=GPL-2.0-only
+PKG_LICENSE_FILES:=COPYING
+
+PKG_MAINTAINER:=Damien Mascord <tusker@tusker.org>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mdio-tools
+  SECTION:=net
+  CATEGORY:=Utilities
+  TITLE:=mdio-tools Linux MDIO register access
+  URL:=https://github.com/wkz/mdio-tools.git
+  DEPENDS:=+libmnl
+endef
+
+define Package/mdio-tools/description
+   mdio-tools Linux MDIO register access
+endef
+
+define Package/mdio-tools/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mdio/mdio $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,mdio-tools))
git clone https://git.99rst.org/PROJECT