WNDR4700 New Install

A lot of code has changed since the 17.1.x release, it's in constant flux. For example: the APM821xx target moved from the 4.4 kernel via 4.9 to the current 4.14 branch. Furthermore, the target's infrastructure has been modified and updated a lot over the time as well: introduction of metadata, switch to dts-compatible identifier, dts cleanups and more. It's not too unlikely that something externally broke the script that was working in 17.1 you should check if the dwc2 module really gets loaded and unloaded when you insert and remove a card.

1 Like

Folks:

Just a few updates. The router wndr4700 is working fine with Openwrt 17.1.06 dual wan and statistics and samba loaded. I plan to write up my detailed observations for other newB / novices like me. Summary is like this:

  1. My Ethernet drop that I was troubleshooting may have been due to a faulty retractable ethernet cable because after I changed to a normal Cat5e cable, I never encountered that anomaly.

  2. I was tempted and did try to install and configure 18x with a clean TFTP to Factory Netgear (and then to 18x) to bypass the 3.5MiB patch as I am not very confident of applying patches myself. It was fine but the front page kept pointing out multi-wan status to wan6 and to wanb even though I had wan and wan2 that I now have reserved my 18x adventure a few weeks later when I am bored of not having tried something new!!!

  3. I did not have to add any SDCARD or USB as the 16MB (or so for /overlay) was enough for mwan3, usb-kmod, samba, and statistics etc. and its working great.

  4. I did install the USB3 drivers as per the pointers given by Chris. And I had an unused 512MB USB that I was having trouble sending to landfill!!! So I added that as a swap device.

  5. I also put in 2.5 inch hdd (used a double sided 3M tape to secure it and avoid it falling off) and have been watching its temperature and it has not exceeded 54 Centigrade even though the fan has been disconnected. Perhaps the 2.5 inch introduces enough space around it to allow for reasonable passive heat loss. IT could also be because, I also entered and saved "hdparm -S 120 /dev/sda" in the local start up.

  6. In addition, I have a reboot in the scheduled job by entering "30 4 * * * sleep 70 && touch /etc/banner && reboot" which reboots at 4:30AM everyday. Keep memory leak etc away, although I think this is perhaps needless as Linux usually have a much cleaner code.

Much Much thanks to all you wonderful folks for helping me when I was getting this wndr4720 working.

Anil Garg

1 Like

Hi Folks
my WNDR4700 slept too long in the shelf and I do not see anything better than to update to OpenWRT.
I have just found this interesting article.
What is not clear to me is : is more beneficial to run with 18x or with 17x ?
is there any drawback with 18x with respect to 17x ?
thank you
Gege

17.x should only be used on devices with small memory. 18.x is a newer kernel and under continued development. The WNDR4700 has sufficient RAM and flash to run 18.x

1 Like

The SD-Card detection code was buggy in the 18.x releases and this was only fixed recently. If you plan on using SDcards, you either have to do the change manually

(can be done through ssh and vi. Just open up /etc/rc.button/BTN_1 file and add a "netgear," in front of the "wndr4700" and save) or you have to wait for the next new 18.x.

Hi Christian
thanks for the heads-up.
I do not plan to use SD now but it is good to know for the future.
Instead I am getting in trouble with USB fix.
I do not find " uPD72020x-firmware_2_powerpc_464fp.ipk " package anymore...
Might you help me please?
thanks
Gege

Hi Agarg,
your post was helpful for my "openwrt trip" with WNDR4700...

BTW may you upload somewhere for me the USB 3.0 driver?

thank you
gee

First off the bat, I want to thank Christian Lamparter without whose
help, my journey would not have been smooth. Also want to thank,
Kapil Dev who helped me with USB 3.0


So, I had been experimenting with Netgear WNDR 4700 on and off and I
kept coming back to use it because it has a SATA drive port in it.
My purpose was simple: I wanted to create a CIFS (Samba) share that
all the machines in my house could leave files to be back up into my
cloud server. I figured that rsync is the best option becuase it is a
one way sync and offered not only incremental back up but also a
resume-able feature where if the previous rsync was aborted, it would
 simply start from where it left off next time the cron job fired
that up.  When the files are backed up, I could delete from the
router samba share and add new to go into the sky and it would not
disturb the previously backup data!!!

The fan on WNDR4700 is slightly noisy when fired up and less noisy
afterward.  And, I did not want noise at all.  And so I opened it up
and disconnected the fan altogether.  When I fired that up, voila,
no noise.  But my 3.5 inch drive started to get "WARM".  So, I
already have a spare 1 TB 2.5 inch sata drive 7200rpm installed in
the sata port and secured with a double side tape. The reason I used
2.5 inch drives as these drives are designed around nearly no
airflow and since the router has 2.5 inch instead of 3.5 inch drive
it has a lot of space for passive heat dissipation.

Then I created my wonder router that has unlimited power and some
day may even serve as a local web server! But that is for another
day!

I could have loaded up the latest 18x on this puppy but I was
familiar with 17x and decided to stick with it....at least for now.
Howver, I am sure this recipe should also work with 18x with minor
adaptations.

I fired up my stock Netgear WNDR4700 and let it boot into stability.
 This was pretty eventless, as expected and I headed to upgrade
firmware.  BTW, below the hood the NEtgear is also using an older
version of Openwrt but has dumbed it down besides not acknowledging
this to the selfless opensource community!!

Once into Netgear web interface and go to advanced >> firmware
upgrade

upload the lede-17.01.6-apm821xx-nand-WNDR4700-squashfs-factory.img
and go away for 10 minutes and enjoy somd coffee (or beer). I have
bricked many devices because I dont give the firmware upgrade from
manufacture to open source sufficient time.  These routers are
usually not incredibly powerful beast and so give them a few moments
to do what the entire firmware upgrade process as it demands.

I disconnected the ethernet cable from my laptop and connected after
30 seconds so that the router updated the IP address etc. We have to
use wired connection as the OpenWRT firmware leaves the wifi radio
disabled upon firmware upload.

Point your browser to 192.168.1.1
and you will be greeted with the first screen of OpenWRT pointing
out that the password needs to be set.  Without this password set,
the device is very unsafe as anyone can access it and its hard to
use the ssh interface for some cruicial configurations.

So log in with password blank.

Use menu at the top and navigate to System >> Administration

Enter new password twice.  I usually keep the router serial number
as the password.
<password>  nOV20!8
<password>  nOV20!8

And for the dropbear instance (this provides SSH access) we pick Lan
interface as we do not wish any other interface to offer access to
the router firmware for security reasons.


now we go to System >> Backup / Flash firmware and update this with
fully functional openwrt firmware:
upload the lede-17.01.6-apm821xx-nand-WNDR4700-squashfs-sysupgrade.tar
and once again leave the router alone for a good 10 minutes to do
its work.  Go get another coffee!!!

And now this puppy is ready to do some serious configurations and
act like an kickass router with deep functionalities..

Even though this router has plenty of NAND flash, the standard image
leaves only 13MB for the packages to be installed.  So we will move
the place to install packages and part of the OS to the hdd as it
has plenty of disk space.

We will devide our 1 TB drive into three parts:

750MB for the software area
250MB for swap
remaining 999 GB for data

We will also make it a dual wan with one wan on DSL from AT&T and
the second wan (wan2) to the guest hotspot of my neighbor who uses
comcast.

so first let us connect this to internet using wan2 and start loading
some optional software

Now change LAN interface IP to 192.168.123.1  (Network >> Interfaces
>> LAN Edit) 
Many use default lan id as 192.168.1.1 and I am not sure what his
router is configured to so this reduces the odds of conflicts.

add following DNS Servers
8.8.8.8
8.8.4.4
208.67.222.222
208.67.220.220

Now go to Network >> Wireless 
Look for 802.11bgn  and click on scan next to it.

Select GuestComcast which is what my neighbor gave me and click join.

on the next screen
Select/Check on Replace wireless configuration
Name the network as wan2
Assign it on the radio button to the red WAN firewall zone

and click on save

on the next screen click first on save and then click on wireless
security

select the correct encryption and enter the correct key.  In my case
it was WPA2-psk and key was kGb-hEaD
Click save and apply.

This will make the wan2 interface alive and assuming the internet on
the neighbors router is working, our router will now also have
internet.

Fantastic
now go to System >> Software and click on update list

It gave me message as follows:
Downloading http://downloads.lede-project.org/releases/17.01.6/targets/apm821xx/nand/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_core
Downloading http://downloads.lede-project.org/releases/17.01.6/targets/apm821xx/nand/packages/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/base/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_base
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/base/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_luci
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/luci/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_packages
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/packages/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_routing
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/routing/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_telephony
Downloading http://downloads.lede-project.org/releases/17.01.6/packages/powerpc_464fp/telephony/Packages.sig
Signature check passed.

now click on tab "available packages" and install nano (easier editor than vi)  and gdisk (disk partition utility)
Also install, if not already there kmod-fs-ext4 for the ext4 file system & htop (I like it more than vanilla top)



now open a terminal software like putty and connect to 192.168.123.1 using ssh

enter password and you should see an interface like as follows:

BusyBox v1.25.1 () built-in shell (ash)

     _________
    /        /\      _    ___ ___  ___
   /  LE    /  \    | |  | __|   \| __|
  /    DE  /    \   | |__| _|| |) | _|
 /________/  LE  \  |____|___|___/|___|                      lede-project.org
 \        \   DE /
  \    LE  \    /  -----------------------------------------------------------
   \  DE    \  /    Reboot (17.01.6, r3979-2252731af4)
    \________\/    -----------------------------------------------------------

root@LEDE:~# 


Perfect
to check that drive exists, we can go to System >> Mount Points and
you will see /dev/sda1
Dont enable this mount yet as we will make changes to it...



gdisk /dev/sda

type n for a new partition and create a partition # 1 for +750MB type linux  (type 8300)
type n again for new partition and create a partition # 2 for +250MB type linux swap  (type 8200)
type n again for new partition and create a partition # 3 for default values to get all remaining space type linux (type 8300)

type w to commit all changes to the disk so that the disk is ready

Let us make file system on the newly created partitions

Type mkfs.ext4 /dev/sda1

Prepare the swap partition
mkswap /dev/sda2



and then again for 3rd partition mkfs.ext4 /dev/sda3

then we transfer the files to the new 750MB partition to move
software there (see ExtRoot on openwrt documentation)

In my case it produced followning file transfers:

root@LEDE:~# mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt
./
./.fs_state
./work/
./work/work/
./upper/
./upper/etc/
./upper/etc/blkid.tab.old
./upper/etc/passwd-
./upper/etc/shadow-
./upper/etc/board.json
./upper/etc/dropbear/
./upper/etc/dropbear/dropbear_rsa_host_key
./upper/etc/passwd
./upper/etc/shadow
./upper/etc/urandom.seed
./upper/etc/uci-defaults/
./upper/etc/uci-defaults/13_fix_group_user
./upper/etc/uci-defaults/10_migrate-shadow
./upper/etc/uci-defaults/10-fstab
./upper/etc/uci-defaults/11_migrate-sysctl
./upper/etc/uci-defaults/12_network-generate-ula
./upper/etc/uci-defaults/50_luci-mod-admin-full
./upper/etc/uci-defaults/00_uhttpd_ubus
./upper/etc/uci-defaults/odhcpd.defaults
./upper/etc/uci-defaults/30_luci-theme-bootstrap
./upper/etc/uci-defaults/20_migrate-feeds
./upper/etc/blkid.tab
./upper/etc/config/
./upper/etc/config/dhcp
./upper/etc/config/luci
./upper/etc/config/rpcd
./upper/etc/config/network
./upper/etc/config/ucitrack
./upper/etc/config/dropbear
./upper/etc/config/fstab
./upper/etc/config/system
./upper/etc/config/uhttpd
./upper/etc/config/wireless
./upper/etc/config/firewall
./upper/etc/ethers
./upper/lib/
./upper/lib/firmware/
./upper/lib/firmware/pci_wmac0.eeprom
./upper/lib/firmware/pci_wmac1.eeprom
./upper/usr/
./upper/usr/bin/
./upper/usr/bin/nano
./upper/usr/lib/
./upper/usr/lib/libformw.so
./upper/usr/lib/libpopt.so.0
./upper/usr/lib/libncursesw.so.6
./upper/usr/lib/opkg/
./upper/usr/lib/opkg/info/
./upper/usr/lib/opkg/info/libpopt.list
./upper/usr/lib/opkg/info/libstdcpp.control
./upper/usr/lib/opkg/info/gdisk.list
./upper/usr/lib/opkg/info/libpopt.control
./upper/usr/lib/opkg/info/nano.control
./upper/usr/lib/opkg/info/terminfo.control
./upper/usr/lib/opkg/info/libstdcpp.prerm
./upper/usr/lib/opkg/info/nano.postinst
./upper/usr/lib/opkg/info/libncurses.postinst
./upper/usr/lib/opkg/info/libpopt.prerm
./upper/usr/lib/opkg/info/libncurses.list
./upper/usr/lib/opkg/info/terminfo.prerm
./upper/usr/lib/opkg/info/terminfo.postinst
./upper/usr/lib/opkg/info/libncurses.prerm
./upper/usr/lib/opkg/info/gdisk.control
./upper/usr/lib/opkg/info/terminfo.list
./upper/usr/lib/opkg/info/libncurses.control
./upper/usr/lib/opkg/info/nano.list
./upper/usr/lib/opkg/info/gdisk.prerm
./upper/usr/lib/opkg/info/libstdcpp.list
./upper/usr/lib/opkg/info/libstdcpp.postinst
./upper/usr/lib/opkg/info/gdisk.postinst
./upper/usr/lib/opkg/info/libpopt.postinst
./upper/usr/lib/opkg/info/nano.prerm
./upper/usr/lib/opkg/status
./upper/usr/lib/libncursesw.so
./upper/usr/lib/libpopt.so.0.0.0
./upper/usr/lib/libmenuw.so.6.0
./upper/usr/lib/libpanelw.so.6
./upper/usr/lib/libncurses.so
./upper/usr/lib/libformw.so.6.0
./upper/usr/lib/libncursesw.so.6.0
./upper/usr/lib/libmenu.so
./upper/usr/lib/libpanelw.so.6.0
./upper/usr/lib/libmenuw.so.6
./upper/usr/lib/libformw.so.6
./upper/usr/lib/libstdc++.so.6.0.21
./upper/usr/lib/libform.so
./upper/usr/lib/libmenuw.so
./upper/usr/lib/libstdc++.so.6
./upper/usr/lib/libpanel.so
./upper/usr/lib/libpanelw.so
./upper/usr/lib/libstdc++.so.6.0.21-gdb.py
./upper/usr/sbin/
./upper/usr/sbin/gdisk
./upper/usr/share/
./upper/usr/share/terminfo/
./upper/usr/share/terminfo/a/
./upper/usr/share/terminfo/a/ansi
./upper/usr/share/terminfo/d/
./upper/usr/share/terminfo/d/dumb
./upper/usr/share/terminfo/l/
./upper/usr/share/terminfo/l/linux
./upper/usr/share/terminfo/r/
./upper/usr/share/terminfo/r/rxvt
./upper/usr/share/terminfo/r/rxvt-unicode
./upper/usr/share/terminfo/s/
./upper/usr/share/terminfo/s/screen
./upper/usr/share/terminfo/v/
./upper/usr/share/terminfo/v/vt100
./upper/usr/share/terminfo/v/vt102
./upper/usr/share/terminfo/x/
./upper/usr/share/terminfo/x/xterm-color
./upper/usr/share/terminfo/x/xterm-256color
./upper/usr/share/terminfo/x/xterm
root@LEDE:~# 


Generate fstab
Automatically

Now we create automatically the fstab uci subsystem and fill it with
the right configuration to have /dev/sda1 as new overlay

block detect > /etc/config/fstab; \
   sed -i s/option$'\t'enabled$'\t'\'0\'/option$'\t'enabled$'\t'\'1\'/ /etc/config/fstab; \
   sed -i s#/mnt/sda1#/overlay# /etc/config/fstab; \
   cat /etc/config/fstab;
 

It should also recognise the swap partition also get added automatically.

At this stage I just reboot just to be sure that all is well. Big
surgery has gone off well!!!

Check htop and it will show the swap is active as well.

now add usb drivers for usb 3

copy the file uPD72020x-firmware_2_powerpc_464fp.ipk to the /tmp
directory of the router

scp uPD72020x-firmware_2_powerpc_464fp.ipk root@192.168.123.1:/tmp/

It will ask for the password for root

then ssh into the router using putty or similar

opkg install uPD72020x-firmware_2_powerpc_464fp.ipk

this will activate the USB 3.0 ports of the machine.

now let us create the share folder on the drive on the router

for that we have to install samba

go to system >> Software   >>>>> Update list if needed

then click on the "available packages"

install luci-app-samba

Also install samba36-client, just in case for future


Now we give it unique names and this is what I did:

Go to System >> System

Change hostname to WNDR4700
timezone to America/Los Angeles

Enable NTP client and Server both

Click save and apply

Go to Services >> Network Share

hostname wndr4700
Description: wndr4700 router with hd

Click save and apply

Click add under shared directories

name shared
mount point from earlier is /mnt/sda3
allow guests 
create mask for files and directories both is 0777 as I have single
user instance in my own home where this will be used.
Samba user access can be whole new ball game and is a very powerful
software but my needs are simple as it needs to serve just pictures.

Also logged into the router again using putty and changed permissions
by making a command 

chmod -R 777 /mnt/sda3


now I should be able to see this shared folder from any computer and
copy files and store there as needed.

MULTI-WAN Set up:

For my applications, I am neither going to use IP6 and so I will go
ahead and delete wan6 interface

Go to Network >>  Interfaces  

Delete WAN6 

Click save and apply

Both Wan & Wan2 need to be assigned metric for the multiwan to work:

wan setting

wan is the default wan interface in this example, and so will get a metric of 10.

    Network > Interfaces
        wan > Edit
            Advanced Settings
                Use default gateway: enabled
                Use gateway metric: 10
            Save

wan2 setting

wan2 is the second wan interface in this example, and so will get the a metric of 20.

    Network > Interfaces
        wan2 > Edit
            Advanced Settings
                Use default gateway: enabled
                Use gateway metric: 20
            Save & Apply

The next step is the configuration of connection tracking in the
firewall configuration /etc/config/firewall. 
Within the wan section of config zone, set the option conntrack '1'  (if missing).

nano /etc/config/firewall

Now it will look like this:
config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        option conntrack '1'
        option network 'wan wan2'

(the conntrack line is inserted on previous line to the last line.
Also in the last line we deleted wan6 as we have already deleted that interface


Make sure that metric of 10 is given to wan and 20 to wan2

Go to System > Software

 click “Update lists” if needed and install “luci-app-mwan3” and rsyncd

REBOOT NOW...

MWAN3 configuration

A mwan3 configuration consists of four section elements, namely:

    interface
    member
    policy
    rule

Openwrt has a lot great documentation to read and understand, you
should consider reading it.

Just copy the same to wan2 

nano /etc/config/mwan3

copy the wan section into wan2

mine is as follows:

        option enabled '1'
        list track_ip '8.8.4.4'
        list track_ip '8.8.8.8'
        list track_ip '208.67.222.222'
        list track_ip '208.67.220.220'
        option reliability '2'
        option timeout '2'
        option down '3'
        option up '8'
        option count '2'
        option interval '3'


Since the default configuration has wan2 disabled – this will also enable the wan2 interface in the mwan3 configuration


####################################################################################################################
Policy configuration

MOVE {config policy 'balanced'} TO THE TOP


Using LUCI

Go to Network >> Load Balance >>> Configuration and change the
following parameters on both wan and wan2



Interface	Enabled	Tracking IP	Tracking reliability	Ping count	Ping timeout	Ping interval	Interface down	Interface up	Metric	Errors	Sort	 
wan		Yes	8.8.4.4			2			2		3s		8s		2		3	10
			8.8.8.8
			208.67.222.222
			208.67.220.220
	
wan2		Yes	8.8.4.4			2			2		3s		8s		2		3	20
			8.8.8.8
			208.67.222.222
			208.67.220.220
	
############################################################################################################################

NOW CREATE 5 GHZ access point as rocksafe ssid not hidden yet)
password: 11111111111112222222222222

2.4 Ghz is being used for Client into NETGEAR as wan2


############################################################################################################################

Create GUEST WIFI

Network >> Wireless >> Add in the 802.11bgn

A virtual adapter will be created  (Slave to the client adapter)

Guest_22745
Access point 
Network Zone will be open  (Not lan as we dont want then to see our lan)

Click on wireless security
WPA2-PSK
cifer will be TPIK & AES
1234567890 is the key

Next click on Network >> Interfaces >> Click edit for Open

Switch protocol to static

ip4 address: 192.168.55.1
ip4 netmask 255.255.255.0
ip4 gateway 192.168.55.1

Click save


Now click on "setup DHCP server at the bottom

start at 10
sessions 85
each for 12h at one time


SAVE AND APPLY

NOW FIREWALL RULES

ADD OPEN TO WAN >>>> ACCEPT ACCEPT ACCEPT

Add Open to something else Reject Accept Reject]

############################################################################################################################

Now let us some software goodies:

luci-app-adblock
luci-app-sqm
kmod-usb-storage-extras  (fot sd card readers)
smartmontools
smartd
hdparm

Insert the following command to /etc/rc.local:

hdparm -S 120 /dev/sda

OR Use LuCi
Use menu System >> Startup and go to the bottom

In the startup box 

enter new line 
hdparm -S 120 /dev/sda

just before the line
exit 0


This is to spin down the drive when not in use.
############################################################################################################################

Configure Adblock


Click on enable adblock


Now block lists:
adaway
adguard (not default)
blacklist
disconnect
malware (not default)
yoyo



And we are done.

Enjoy your new router which is loaded with lot of goodies.  Please 
also do not mind my shorthand and error in grammar....If you have any
question, please let me now, and I will gladly clarify.


1 Like

Hi Chris: I was planning to kill some time by upgrading my wndr4700 to 18x. Not because I need it but because we can! Haha!!

When I do that I was wondering if we should use ecos to exroot. If not the whole partition, then perhaps a directory in it and make this partition into rw. Is that possible? Easypz or stuff meant for Ninja?
Love to hear your reactions.

Anil

Make sure to use the tftp update method.

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=c555b524c7e55f54aea69d11113bc36326aabafe

And backup your configuration first.

I played around with extroot. Problem was: you would need to somehow attach the ecos partition during boot. It's possible by editing the bootcmd in u-boot or patching the bootargs. Question is: do you want to learn something or not.

1 Like

Haha! I do have a bucket list of things to learn! For now I will use a spare usb pen drive, if it is needed!

Thanks.

Well, if you are just want the extroot that fine too.

What it requires to do:

  1. run a script (wndr4700-ecos-writeable.sh) on the dtb. If you are using the official images, you can download the netgear_wndr4700-squashfs-kernel.dtb from download.openwrt.org on a linux desktop/vm. This is because mkimage and dumpimage has not been packaged for OpenWrt (yet).

  2. copy over the modified dtb to the WNDR4700

  3. flash it on the WNDR4700 with

    # mtd -e device-tree write netgear_wndr4700-squashfs-kernel.dtb device-tree
    
  4. reboot

  5. ubiformat the ecos partition

    # . /lib/functions.sh
    # ubiformat /dev/mtd$(find_mtd_index ecos) 
    ubiformat: mtd9 (nand), size 100794368 bytes (96.1 MiB), 769 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
    libscan: scanning eraseblock 768 -- 100 % complete  
    ubiformat: 769 eraseblocks have valid erase counter, mean value is 0
    ubiformat: formatting eraseblock 768 -- 100 % complete  
    
  6. attaching the newly created ubi partition

    # ubiattach -p /dev/mtd$(find_mtd_index ecos)
    [  763.364420] ubi1: attaching mtd9
    [  763.601319] ubi1: scanning is finished
    [  763.614107] ubi1: attached mtd9 (name "ecos", size 96 MiB)
    [  763.619614] ubi1: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
    [  763.626529] ubi1: min./max. I/O unit sizes: 2048/2048, sub-page size 512
    [  763.633219] ubi1: VID header offset: 512 (aligned 512), data offset: 2048
    [  763.640025] ubi1: good PEBs: 769, bad PEBs: 0, corrupted PEBs: 0
    [  763.646066] ubi1: user volume: 0, internal volumes: 1, max. volumes count: 128
    [  763.653311] ubi1: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 1101564712
    [  763.662560] ubi1: available PEBs: 745, total reserved PEBs: 24, PEBs reserved for bad PEB handling: 20
    [  763.674078] ubi1: background thread "ubi_bgt1d" started, PID 4034
    UBI device number 1, total 769 LEBs (99219456 bytes, 94.6 MiB), available 745 LEBs (96122880 bytes, 91.6 MiB), LEB size 129024 bytes (126.0 KiB)
    
  7. creation of the extroot volume

    # ubimkvol /dev/ubi1 -m -N extroot
    Set volume size to 96122880
    Volume ID 0, size 745 LEBs (96122880 bytes, 91.6 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "extroot", alignment 1
    
  8. (setting up extroot - if you want to keep your configuration, without it you'll start out like after a first_boot)

    # mount /dev/ubi1_0 /mnt -t ubifs
    # cp -ar /overlay/upper/ /mnt
    # umount /mnt
    
  9. enabling extroot through Luci
    Luci -> System -> Mount points -> Add a new Mount Points - Mount Entry

    Enable "Enable this mount" Checkbox
    UUID: select /dev/ubi1_0 (uuid will differ)
    Mount point: select "Use as external overlay (/overlay)"

    Save and apply.

    Luci -> System -> Reboot -> "Perform reboot"

  10. enjoy extroot


wndr4700-ecos-writeable.sh:

#!/bin/bash

# THIS FILE IS SELF-SERVICE.
# If it does not work - Then fix it yourself.

die()
{
	(>&2 echo "$@")
	[ -n "$OUTFILE" ] && rm -rf "$OUTFILE"
	exit 1
}

[ $# = 1 ] || die "$0 needs a openwrt-netgear,wndr47000.dtb URL as an argument"

for CMD in dtc mkimage dumpimage wget patch mktemp wc pwd basename; do
	$(command -v "$CMD" >/dev/null 2>&1) || die "Please install the '$CMD' program."
done

SOURCE="$1"

RAWDTBFILE="${SOURCE##*/}"
[ -n "RAWDTBFILE" ] || die "bad url/file"

DTBFILE=kernel.dtb
DTSFILE=kernel.dts

TMP=$(mktemp -d)
[ -n "$TMP" ] || die "Failed to create temporary work directory"

trap "rm -rf '$TMP'" SIGINT SIGTERM EXIT

ORIGPWD="$(pwd)"
OUTFILE="$(pwd)/$RAWDTBFILE"

[ -n "$OUTFILE" ] || die "bad url/file"

(
	cd "$TMP"

	case "$SOURCE" in
	http:* |\
	https:* |\
	ftp:*)
		wget "$SOURCE" || die "Failed to download url"
		;;
	*)
		cp "$ORIGPWD/$SOURCE" "$SOURCE" || die "Failed to copy source to work directory"
		;;
	esac

	[[ "$(cat $RAWDTBFILE | wc -c)" != 131072 ]] && die "Input file size does not match"

	dumpimage -T kernel -i "$RAWDTBFILE" "$DTBFILE" || die "DTB extraction failed"

	dtc -I dtb -O dts -o "$DTSFILE" "$DTBFILE" &> /dev/null || die "DTB decompilation failed"

cat << EOF >> "$DTSFILE"
/ {
	chosen {
		bootargs = " ubi.mtd=ubi ubi.mtd=ecos ";
	};


	plb {
		opb {
			ebc {
				ndfc@1,0 {
					nand {
						partition0,9@1fa0000 {
							/delete-property/read-only;
						};
					};
				};
			};
		};
	};
};
EOF

	dtc -I dts -O dtb -o "$DTBFILE" "$DTSFILE" -S 131008 &> /dev/null || die "DTB recompilation failed"
	mkimage -n "Patched WNDR4700" -A powerpc -O linux -T kernel -C none -d "$DTBFILE" "$OUTFILE" &> /dev/null || die "Image recreation failed"

	[ "$(cat $OUTFILE | wc -c)" != 131072 ] && die "Output file size does not match"

	echo "Flash $OUTFILE at your own risk!."
	echo "# mtd -e device-tree write "$(basename $OUTFILE)"  device-tree"
)

Wow....Thanks Chris. I am going to do exactly this. Love this.... I suppose, if it failed, I can still go back to TFTP and reload the 18x anew and ignore the efforts to use ecos as exroot...

Much appreciate.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.