Recent Linux on the Netgear WG302
(Last boot 2024-12-23 on kernel v6.6.66 with OpenWRT flash-resident 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 ethernet is just 100Mbit so your router socket LED will be yellow and it's no speed monster.

Installing a recent OpenWrt

The flash memory on this device is too small to fit both the kernel and the root filesystem for OpenWrt. What we need to do is to just have the root filesystem on the device, and load the kernel over TFTP. It's pretty straight forward to set up an environment like this, provided you know how to operate a TFTP server on your network which is stable.

EXPERIMENTAL STUFF

EXPERIMENTS: initially I tried to do things the other way around: boot the kernel from the flash and have to rootfs on NFS. This never worked, and that's when it finally dawned on me that I have to do things the other way around: boot from TFTP (which is usually simpler to set up than NFS anyway) and have just the rootfs on the flash. This was a bad idea but the notes are kept here anyway.

Booting from command prompt

Pre-cooked Bootable Image

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

NFS mounted root

The way I imagined 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.

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";
};

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