Jade's Tech Notes

More bits more places

OpenWRT on Meraki MR58

This post will guide you through installing OpenWRT 15.05.1 (r48531) on a Meraki MR58.

See my previous post on the MR58 for information on the MR58, including how to access the console port.

Installing OpenWRT

Gather Resources

Download openwrt-15.05.1-ixp4xx-generic-compex-zImage and openwrt-15.05.1-ixp4xx-generic-squashfs.img from the OpenWRT download site. The following example assumes they are saved as openwrt-zImage and openwrt-squashfs respectively.

RedBoot is configured to use http by default so I’m serving them up with the basic python3 http server: python -m http.server 8000

Access RedBoot

On initial powerup you’ll see:

1
2
3
4
5
6
7
8
9
10
11
12
13
+++
RedBoot(tm) bootstrap and debug environment [ROMRAM]
version 2.04m - built 15:15:50, Nov 10 2008

Platform: WP18/WP188/WPM188/NP18 Development Platform (IXP4XX) BE
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.

RAM: 0x00000000-0x04000000, [0x000686e0-0x03fc1000] available
FLASH: 0x50000000 - 0x51000000, 128 blocks of 0x00020000 bytes each.
== Executing boot script in 1.000 seconds - enter ^C to abort
^C
RedBoot> ^C
RedBoot> 

Enter Control-C when you see the Executing boot script message to stop the boot process and access RedBoot.

Prep flash

1
fis init -f

Install kernel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
RedBoot> ip_address -l 192.168.1.2/24 -h 192.168.1.1
IP: 192.168.1.2/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.1.1

Trying NPE-B...link up, full duplex...success. Using NPE-B with PHY 1.
RedBoot> load -p 8000 -r -b %{FREEMEMLO} openwrt-zImage
Using default protocol (HTTP)
Raw file loaded 0x00068800-0x0018e808, assumed entry at 0x00068800
RedBoot> fis create kernel
... Erase from 0x50080000-0x501c0000: ..........
... Program from 0x00068800-0x0018e809 at 0x50080000: ..........
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fd0000-0x03ff0000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
RedBoot> 

Now reboot and get back into RedBoot to continue with install of the root fs. If you do not reboot you will encounter errors when trying to load the root image.

Install root

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
RedBoot> ip_address -l 192.168.1.2/24 -h 192.168.1.1
IP: 192.168.1.2/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.1.1

Trying NPE-B...link up, full duplex...success. Using NPE-B with PHY 1.
RedBoot> fis free
  0x501C0000 .. 0x50FE0000
RedBoot> load -p 8000 -r -b %{FREEMEMLO} openwrt-squashfs
Using default protocol (HTTP)
Raw file loaded 0x00068800-0x002887ff, assumed entry at 0x00068800
RedBoot> fis create -l 0xe20000 rootfs
... Erase from 0x501c0000-0x50fe0000: .................................
.......................................................................
.........
... Program from 0x00068800-0x00288800 at 0x501c0000: .................
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fd0000-0x03ff0000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
RedBoot> 

Configure RedBoot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
RedBoot> fconfig
Run script at boot: true
Boot script: 
.. checksum_load -b 0x02000000 -f 0x502C0000
.. exec
.. checksum_load -b 0x02000000 -f 0x50AC0000
.. exec
.. checksum_load -b 0x02000000 -f 0x50940000
.. exec
.. checksum_load -i -b 0x02000000 -f 0x502C0000
.. exec
.. reset
Enter script, terminate with empty line
>> fis load kernel
>> exec
>> reset
>> 
Boot script timeout (1000ms resolution): 3
Use BOOTP for network configuration: false
Gateway IP address: 
Local IP address: 
Local IP address mask: 
Default server IP address: 
Console baud rate: 115200
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Default network device: npe_eth0
Network hardware address [MAC] for npe_eth0: 0x00:0x03:0x47:0xDF:0x32:0xA8
Network hardware address [MAC] for npe_eth1: 0x00:0x03:0x47:0xDF:0x32:0xAA
Update RedBoot non-volatile configuration - continue (y/n)? y
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fd0000-0x03ff0000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
RedBoot> 

Verify flash layout

After all this, your flash layout should look something like this:

1
2
3
4
5
6
7
8
RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0x50000000  0x50000000  0x00080000  0x00000000
kernel            0x50080000  0x00068800  0x00140000  0x00068800
rootfs            0x501C0000  0x00068800  0x00E20000  0x00068800
FIS directory     0x50FE0000  0x50FE0000  0x0001F000  0x00000000
RedBoot config    0x50FFF000  0x50FFF000  0x00001000  0x00000000
RedBoot> 

Reboot into OpenWRT

Power cycle and you should see Linux boot. If you see a that begins with $T050f: it is likely that the kernel image is corrupted. Go back and reflash the kernel.

On initial boot you’ll see the following message, ignore it and wait for normal console.

1
2
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level

You’ll need to wait for OpenWRT to create a jffs2 overlay. The overlay goes in the free space after the squashfs image in the rootfs partition that you created in RedBoot. This will take several minutes.

When it is finished you’ll see something like this:

1
2
3
4
5
[  117.128728] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[  117.146169] jffs2_build_filesystem(): unlocking the mtd device... done.
[  160.574177] jffs2_build_filesystem(): erasing all blocks after the end marker... done.
[  223.297449] jffs2: notice: (2177) jffs2_build_xattr_subsystem: complete building xattr subsystem, 
  0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.

Reboot again. This time we should see the jffs2 overlay go active:

1
[   97.788681] mount_root: switching to jffs2 overlay

Your MR58 is now ready to use like any other freshly installed OpenWRT device. Enjoy!