Skip to content

Instantly share code, notes, and snippets.

@Oceanswave
Last active July 19, 2022 06:05
Show Gist options
  • Save Oceanswave/0ba18f598e5482f0572d663699cbf4a1 to your computer and use it in GitHub Desktop.
Save Oceanswave/0ba18f598e5482f0572d663699cbf4a1 to your computer and use it in GitHub Desktop.
Tips on configuring OpenWRT chaos_calmer on MR3040 v2 to use extoverlay

The issue is that chaos_calmer default image doesn't have enough storage to hold kmod-fs-ext4 on the MR3040. ug!

This is a good start, https://wiki.openwrt.org/doc/howto/extroot

but there's some other tips here.

So, you've got to use image generator to make a custom image that initially doesn't have luci initially, but does have kmod-fs-ext4.

This is much simpler if you've already configured the router and it's connected to the internet.

Also partition and format the USB device on OSx by installing

$ brew install e2fsprogs
$ diskutil list
$ sudo $(brew --prefix e2fsprogs)/sbin/mkfs.ext4 /dev/disk2s2
  1. Create an Ubuntu VM

  2. Follow the directions at https://wiki.openwrt.org/doc/howto/obtain.firmware.generate

to get the image file and apt-get the make dependencies

For the MR3040, the image builder file should be at https://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/OpenWrt-ImageBuilder-15.05.1-ar71xx-generic.Linux-x86_64.tar.bz2

apt-get install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc
  1. unzip this archive, go into the folder, and then execute
make image PROFILE="TLMR3040" PACKAGES="kmod-fs-ext4 kmod-usb-storage block-mount"
  1. in the /bin folder you'll get a fancy .bin file (use v2...factory.bin) and flash the MR3040 with this. Maintain your configuration so you can connect to the internet to opkg install luci later on.

  2. Now this build doesn't have luci, so you'll have to ssh into the router and mount the ext4 formatted usb drive

root@OpenWrt:~# block info
root@OpenWrt:~# mkdir -p /mnt/sda2
root@OpenWrt:~# mount -t ext4 /dev/sda2 /mnt/sda2
  1. copy the contents of the current overlay folder to the usb drive
root@OpenWrt:~# mkdir -p /tmp/cproot
root@OpenWrt:~# mount --bind /overlay /tmp/cproot
root@OpenWrt:~# tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda2 -xf -
root@OpenWrt:~# umount /tmp/cproot
  1. Edit the fstab file to mount the drive as the overlay
root@OpenWrt:~# block detect > /etc/config/fstab ; vi /etc/config/fstab

should look like this:

config 'mount'
        option  target  '/overlay'
        option  fstype  'ext4'
        option  enabled '1'
  1. Test mounting it (if the wrong kmod-fs is installed for the usb's fat, it won't mount)
root@OpenWrt:~# mount /dev/sda1 /overlay
root@OpenWrt:~# df
  1. Reboot the router
root@OpenWrt:~# reboot -f
  1. Check that the usb-backed overlay is mounted, and df shows the appropriate amount of free space
root@OpenWrt:~# mount
root@OpenWrt:~# df
  1. Go ahead and install luci
root@OpenWrt:~# opkg install luci
root@OpenWrt:~# /etc/init.d/uhttpd start
root@OpenWrt:~# /etc/init.d/uhttpd enable

and browse to 192.168.1.1

  1. Tada!
@eternaleclipse
Copy link

Really helped me, thank you so much! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment