Recent Linux on the Netgear WG302
(Last boot 2022-07-08 on kernel v5.19-rc5 with OpenWRT initramfs as rootfs)

Netgear WG302v1

Netgear WG302 v1

The WG302 Prosafe is a Netgear router (mostly used as a simple access point) based on the Intel IXP425 XScale SoC This old router can very well run the latest Linux kernels. The resident flash is a bit small (just 8MB) but the RAM is 32MB on the WG302 v1 which makes the kernel work fine.

The way I imagine this to be used is that we augment RedBoot to use TFTP to boot a kernel with initramfs on power-on, then mount root on NFS. The flash could fit the XZ-compressed kernel with initramfs though: it is just ~3MB.

Booting from command prompt

NFS mounted root

First I set up NFS on my server. I use an /etc/exports file like this:

/var/lib/tftpboot/ixp4xx-root  192.168.1.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_check,no_acl,nohide)

I unpack a rootfs to /var/lib/tftpboot/ixp4xx-root and change the permissions:

  cd /var/lib/tftpboot
  mkdir ixp4xx-root
  cd ixp4xx-root
  tar xvfz /tmp/ixp4xx-rootfs.tar.gz

My rootfs has been modified to handle NFS mounts, it is not a vanilla OpenWrt. Also building for IXP4xx BE is not currently possibly other than on custom branches. This is achieved using this script.

I have tried to get NFS root mount to work but didn't get it finished. I added a patch like this to the WG302v1 device tree:

--- a/arch/arm/boot/dts/intel-ixp42x-netgear-wg302v1.dts
+++ b/arch/arm/boot/dts/intel-ixp42x-netgear-wg302v1.dts
@@ -23,7 +23,7 @@ memory@0 {

chosen {
/* The RedBoot comes up in 9600 baud so let's keep this */
-               bootargs = "console=ttyS0,9600n8";
+               bootargs = "console=ttyS0,9600n8 root=/dev/nfs rw nfsroot=192.168.1.144:/var/lib/tftpboot/ixp4xx-root,tcp,v3 ip=dhcp";
                stdout-path = "uart1:9600n8";
};

Pre-cooked Bootable Image

These images are pre-configured for the WG302 ATH5k wireless etc.

Compiling the kernel

I use a special ixp4.mak makefile that I put in the root of the kernel directory, edit the makefile to select the right DTB then I type:

  make -f ixp4.mak config && make -f ixp4.mak build
  
And this will build the whole kernel, attaching an initramfs and a DTB file, and put the resulting zImage in $HOME as well as in /var/lib/tftpboot if it is writeable. You will need the rootfs-ixp4x.cpio rootfs and ixp4xx-firmware.tar.gz for this to succeed.

The special config options used to mount from NFS:

# This target has 64MB RAM and no space for initramfs, use NFS root!
config-wg302: config-base
  $(CURDIR)/scripts/config --file $(config_file) \
  --enable PHYLIB \
  --enable NFS_FS \
  --disable NFS_V2 \
  --enable ROOT_NFS \
  --disable BLK_DEV_INITRD

Links