Re: [PATCH v1 2/5] ixp4xx: Resurrect IXP4xx support using device tree

2023-08-17 Thread Linus Walleij
Thanks for reviewing this Hauke!

I fixed most things, will post v2 as time permits.

On Fri, Aug 11, 2023 at 4:27 PM Hauke Mehrtens  wrote:

> Do you still have the fconfig tool which access something in /dev/ to
> get the mac addresses?

Yes it was one of the leftovers that just stayed around after the
removal of the unmaintained ixp4xx boardfile machines. So I
just select it from the top-level makefile and things work fine.

Another thing left behind was the python build script for NSLU2
images.

But I needed them so it's all good when we bring IXP4xx back.
(Please don't delete them...)

I deleted one minor useless script though (patch 5).

Yours,
Linus Walleij

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH v1 2/5] ixp4xx: Resurrect IXP4xx support using device tree

2023-08-11 Thread Hauke Mehrtens

On 6/19/23 13:31, Linus Walleij wrote:

This resurrects the support for IXP4xx using device tree
rather than the old (deleted) board files. The final pieces
of IXP4xx board files were deleted in Linux v5.19.

Ext4 root filesystems on CF and USB are supported by the
default config.

We support these three initial targets:

- The Gateworks Avila GW2348 reference design has 64MB of RAM
   and 32MB of flash and also supports USB and CompactFlash.

- The Gateworks Cambria GW2358 reference design has 128MB of
   RAM and 32MB of flash and also supports USB and CompactFlash.

- The old and stable Linksys NSLU2 works fine as well, albeit
   it only has 32MB of RAM so it has been marked as non-default.
   The 8MB of flash can only fit the kernel, so it has been
   patched to boot from exteral media on USB. I have used
   it successfully as a NAS with ksmbd and LUCI web API, see:
   https://dflund.se/~triad/krad/ixp4xx/

Signed-off-by: Linus Walleij 
---
  package/firmware/ixp4xx-microcode/Makefile|  59 +
  .../ixp4xx-microcode/src/IxNpeMicrocode.h | 148 +++
  .../firmware/ixp4xx-microcode/src/LICENSE.IPL |  27 ++
  target/linux/ixp4xx/Makefile  |  28 ++
  .../ixp4xx/base-files/etc/board.d/02_network  |  21 ++
  .../lib/preinit/05_set_ether_mac_ixp4xx   |  45 
  target/linux/ixp4xx/config-6.1| 246 ++
  target/linux/ixp4xx/image/Makefile|  73 ++
  ...d-cfi_cmdset_0001-Byte-swap-OTP-info.patch |  74 ++
  ...dts-ixp4xx-Boot-NSLU2-from-harddrive.patch |  24 ++
  10 files changed, 745 insertions(+)
  create mode 100644 package/firmware/ixp4xx-microcode/Makefile
  create mode 100644 package/firmware/ixp4xx-microcode/src/IxNpeMicrocode.h
  create mode 100644 package/firmware/ixp4xx-microcode/src/LICENSE.IPL
  create mode 100644 target/linux/ixp4xx/Makefile
  create mode 100644 target/linux/ixp4xx/base-files/etc/board.d/02_network
  create mode 100644 
target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx
  create mode 100644 target/linux/ixp4xx/config-6.1
  create mode 100644 target/linux/ixp4xx/image/Makefile
  create mode 100644 
target/linux/ixp4xx/patches-6.1/0001-mtd-cfi_cmdset_0001-Byte-swap-OTP-info.patch
  create mode 100644 
target/linux/ixp4xx/patches-6.1/301-ARM-dts-ixp4xx-Boot-NSLU2-from-harddrive.patch

diff --git a/package/firmware/ixp4xx-microcode/Makefile 
b/package/firmware/ixp4xx-microcode/Makefile
new file mode 100644
index ..78fedfd1aaf1
--- /dev/null
+++ b/package/firmware/ixp4xx-microcode/Makefile
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#


Please add a SPDX header and remove the OpenWrt copyright.


+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ixp4xx-microcode
+PKG_VERSION:=2.4 > +PKG_RELEASE:=2


Start with pkg release 1


+
+PKG_SOURCE:=IPL_ixp400NpeLibraryWithCrypto-2_4.zip
+PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
+PKG_HASH:=1b1170d0657847248589d946048c0aeaa9cd671966fc5bec5933283309485eaa
+
+PKG_FLAGS:=nonshared
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ixp4xx-microcode
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Microcode for the IXP4xx network engines
+  DEPENDS:=@TARGET_ixp4xx
+endef
+
+define Package/ixp4xx-microcode/description
+ This package contains the microcode needed to use the network engines in 
IXP4xx CPUs
+endef
+
+define Build/Prepare
+   rm -rf $(PKG_BUILD_DIR)
+   mkdir -p $(PKG_BUILD_DIR)
+   unzip -d $(PKG_BUILD_DIR)/ $(DL_DIR)/$(PKG_SOURCE)
+   mv $(PKG_BUILD_DIR)/ixp400_xscale_sw/src/npeDl/IxNpeMicrocode.c 
$(PKG_BUILD_DIR)/
+   rm -rf $(PKG_BUILD_DIR)/ixp400_xscale_sw
+   $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Build/Compile
+   (cd $(PKG_BUILD_DIR); \
+   $(HOSTCC) -Wall -I$(STAGING_DIR_HOST)/include IxNpeMicrocode.c 
-o IxNpeMicrocode; \
+   ./IxNpeMicrocode -be \
+   )
+endef
+
+define Package/ixp4xx-microcode/install
+   $(INSTALL_DIR) $(1)/lib/firmware
+   $(INSTALL_DIR) $(1)/usr/share/doc
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/NPE-A $(1)/lib/firmware/
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/NPE-A-HSS $(1)/lib/firmware/
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/NPE-B $(1)/lib/firmware/
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/NPE-C $(1)/lib/firmware/


Are all these FW files always needed, or do you need them depending on 
the use case or device? If they are not always needed maybe add them 
into seperate packages.



+   $(INSTALL_DATA) $(PKG_BUILD_DIR)/LICENSE.IPL $(1)/usr/share/doc/
+endef
+
+$(eval $(call BuildPackage,ixp4xx-microcode))





diff --git a/target/linux/ixp4xx/Makefile b/target/linux/ixp4xx/Makefile
new file mode 100644
index ..546964a6a876
--- /dev/null
+++ b/target/linux/ixp4xx/Makefile
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2006-2023 OpenWrt.org
+

[PATCH v1 2/5] ixp4xx: Resurrect IXP4xx support using device tree

2023-06-19 Thread Linus Walleij
This resurrects the support for IXP4xx using device tree
rather than the old (deleted) board files. The final pieces
of IXP4xx board files were deleted in Linux v5.19.

Ext4 root filesystems on CF and USB are supported by the
default config.

We support these three initial targets:

- The Gateworks Avila GW2348 reference design has 64MB of RAM
  and 32MB of flash and also supports USB and CompactFlash.

- The Gateworks Cambria GW2358 reference design has 128MB of
  RAM and 32MB of flash and also supports USB and CompactFlash.

- The old and stable Linksys NSLU2 works fine as well, albeit
  it only has 32MB of RAM so it has been marked as non-default.
  The 8MB of flash can only fit the kernel, so it has been
  patched to boot from exteral media on USB. I have used
  it successfully as a NAS with ksmbd and LUCI web API, see:
  https://dflund.se/~triad/krad/ixp4xx/

Signed-off-by: Linus Walleij 
---
 package/firmware/ixp4xx-microcode/Makefile|  59 +
 .../ixp4xx-microcode/src/IxNpeMicrocode.h | 148 +++
 .../firmware/ixp4xx-microcode/src/LICENSE.IPL |  27 ++
 target/linux/ixp4xx/Makefile  |  28 ++
 .../ixp4xx/base-files/etc/board.d/02_network  |  21 ++
 .../lib/preinit/05_set_ether_mac_ixp4xx   |  45 
 target/linux/ixp4xx/config-6.1| 246 ++
 target/linux/ixp4xx/image/Makefile|  73 ++
 ...d-cfi_cmdset_0001-Byte-swap-OTP-info.patch |  74 ++
 ...dts-ixp4xx-Boot-NSLU2-from-harddrive.patch |  24 ++
 10 files changed, 745 insertions(+)
 create mode 100644 package/firmware/ixp4xx-microcode/Makefile
 create mode 100644 package/firmware/ixp4xx-microcode/src/IxNpeMicrocode.h
 create mode 100644 package/firmware/ixp4xx-microcode/src/LICENSE.IPL
 create mode 100644 target/linux/ixp4xx/Makefile
 create mode 100644 target/linux/ixp4xx/base-files/etc/board.d/02_network
 create mode 100644 
target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx
 create mode 100644 target/linux/ixp4xx/config-6.1
 create mode 100644 target/linux/ixp4xx/image/Makefile
 create mode 100644 
target/linux/ixp4xx/patches-6.1/0001-mtd-cfi_cmdset_0001-Byte-swap-OTP-info.patch
 create mode 100644 
target/linux/ixp4xx/patches-6.1/301-ARM-dts-ixp4xx-Boot-NSLU2-from-harddrive.patch

diff --git a/package/firmware/ixp4xx-microcode/Makefile 
b/package/firmware/ixp4xx-microcode/Makefile
new file mode 100644
index ..78fedfd1aaf1
--- /dev/null
+++ b/package/firmware/ixp4xx-microcode/Makefile
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ixp4xx-microcode
+PKG_VERSION:=2.4
+PKG_RELEASE:=2
+
+PKG_SOURCE:=IPL_ixp400NpeLibraryWithCrypto-2_4.zip
+PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
+PKG_HASH:=1b1170d0657847248589d946048c0aeaa9cd671966fc5bec5933283309485eaa
+
+PKG_FLAGS:=nonshared
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ixp4xx-microcode
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Microcode for the IXP4xx network engines
+  DEPENDS:=@TARGET_ixp4xx
+endef
+
+define Package/ixp4xx-microcode/description
+ This package contains the microcode needed to use the network engines in 
IXP4xx CPUs
+endef
+
+define Build/Prepare
+   rm -rf $(PKG_BUILD_DIR)
+   mkdir -p $(PKG_BUILD_DIR)
+   unzip -d $(PKG_BUILD_DIR)/ $(DL_DIR)/$(PKG_SOURCE)
+   mv $(PKG_BUILD_DIR)/ixp400_xscale_sw/src/npeDl/IxNpeMicrocode.c 
$(PKG_BUILD_DIR)/
+   rm -rf $(PKG_BUILD_DIR)/ixp400_xscale_sw
+   $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Build/Compile
+   (cd $(PKG_BUILD_DIR); \
+   $(HOSTCC) -Wall -I$(STAGING_DIR_HOST)/include IxNpeMicrocode.c 
-o IxNpeMicrocode; \
+   ./IxNpeMicrocode -be \
+   )
+endef
+
+define Package/ixp4xx-microcode/install
+   $(INSTALL_DIR) $(1)/lib/firmware
+   $(INSTALL_DIR) $(1)/usr/share/doc
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/NPE-A $(1)/lib/firmware/
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/NPE-A-HSS $(1)/lib/firmware/
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/NPE-B $(1)/lib/firmware/
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/NPE-C $(1)/lib/firmware/
+   $(INSTALL_DATA) $(PKG_BUILD_DIR)/LICENSE.IPL $(1)/usr/share/doc/
+endef
+
+$(eval $(call BuildPackage,ixp4xx-microcode))
diff --git a/package/firmware/ixp4xx-microcode/src/IxNpeMicrocode.h 
b/package/firmware/ixp4xx-microcode/src/IxNpeMicrocode.h
new file mode 100644
index ..4a843db104f9
--- /dev/null
+++ b/package/firmware/ixp4xx-microcode/src/IxNpeMicrocode.h
@@ -0,0 +1,148 @@
+/*
+ * IxNpeMicrocode.h - Headerfile for compiling the Intel microcode C file
+ *
+ * Copyright (C) 2006 Christian Hohnstaedt 
+ *
+ * This file is released under the GPLv2
+ *
+ *
+ * compile with
+ *
+ * gcc -Wall IxNpeMicrocode.c -o IxNpeMicrocode
+ *
+ * Executing the resulting binary on your build-host creates the
+ * "NPE-[ABC]."