I authored a post on liberating a WNDR4700 router more than two years ago which garnered some interest in the community on developing a proper OpenWRT image. I’m happy to report that it finally happened! The LEDE (Linux Embedded Development Environment) team is fully supporting the apm821xx system-on-chip and are generating nightly firmware images for our use.

>

Instructions for installing LEDE on your WNDR4700/WNDR4720

  1. Read the following documentation: https://lede-project.org/docs/guide-quick-start/start
  2. Download the LEDE factory image firmware: https://downloads.lede-project.org/snap … actory.img
  3. Flash the LEDE factory image as a firmware upgrade using the router’s web interface.
  4. SSH in to install LuCI:
    opkg update && opkg install luci-ssl

Everything should be working but USB and the SD Card reader. In order to get that working then:

  1. Download this binary firmware: uPD72020x-firmware_2_powerpc_464fp.ipk
  2. Install the above firmware using:
    opkg install uPD72020x-firmware_2_powerpc_464fp.ipk
  3. Reboot and bask in the glory of your upgraded router!

Next up we’re going to install Debian

You will need to either add a USB flash stick or a physical hard drive into your WNDR4700 for this.

  1. Partition your drive to have a 1GB swap with the rest being ext4
  2. Log into the LuCI interface to mount the drives
    1. Head over to System > Mount Points
    2. Add the ext4 partition as a /mnt custom mount point
    3. Add the swap partition and activate it
  3. Next up we need to adjust Local Startup script. Head over to System > Startup and scroll down. Edit your local script to be similar to:
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

mkdir -p /mnt/dev /mnt/tmp /mnt/openwrt-root /mnt/lib/modules

mount -o bind /dev /mnt/dev
mount /tmp /mnt/tmp

# Expose OpenWRT root
mount / /mnt/openwrt-root

# Kernel modules need to be available
mount /lib/modules /mnt/lib/modules

# Start Debian
chroot /mnt /myinit

exit 0

We will now install Debian with debootstrap while utilizing the LEDE kernel. Reference this material if you run into trouble.

  1. Install debootstrap:
    opkg update && opkg install debootstrap
  2. Install Debian using debootstrap:
    debootstrap --arch powerpc jessie /mnt http://ftp.us.debian.org/debian
  3. Chroot into Debian and prime it for use:
mount -o bind /dev /mnt/dev
mount -t sysfs none /mnt/sys
mount -t proc none /mnt/proc
mount -t devpts devpts /mnt/dev/pts

LANG=C.UTF-8 chroot /mnt /bin/bash
apt-get update && apt-get -y upgrade

dpkg-reconfigure tzdata

apt-get install -y locales && dpkg-reconfigure locales

We already configured our rc.local under LEDE to chroot into /mnt/myinit on system reboot. This file will start all the necessary Debian services.

  1. Create this file under /myinit
#!/bin/bash

# Mount
mount -t sysfs none /sys
mount -t proc none /proc
mount -t devpts devpts /dev/pts
sleep 3

# Start Services
/etc/init.d/dbus start

# Disabled Services
#/etc/init.d/ssh start
#/etc/init.d/cron start
#/etc/init.d/unattended-upgrades start
#/etc/init.d/php5-fpm start
#/etc/init.d/mysql start
#/etc/init.d/nginx start

If you reboot everything should now work and Debian should automatically start the services from /myinit too. I have also altered my LEDE environment to use SSH port 2222 and LuCI to use 8080 and 4443 as the ports. This allowed me to install SSH and nginx on Debian and use the standard ports. Good luck!