How to make extRoot for openwrt on TL MR3040 v2

Preliminary : Upgrade firmware
  - Grab the firmware from here:
  - From command line :
     cd /tmp
     sysupgrade -n -v openwrt-ar71xx-generic-tl-mr3040-v2-squashfs-sysupgrade.bin

Preliminary : Format your flash drive with an ext4 or ext3 filesystem.
for example format from your PC:

Install Packages:
root@OpenWrt:~# opkg update
root@OpenWrt:~# opkg install kmod-usb-storage kmod-fs-ext4 block-mount
Find the name of your flash drive with the : block info
root@OpenWrt:~# block info
/dev/mtdblock2: UUID="20ad40ea-d33a421e-785b7d2d-ada99230" VERSION="4.0" TYPE="squashfs" /dev/mtdblock3: TYPE="jffs2"
/dev/sda2: UUID="9fa36631-ac09-42a0-b090-f61efe6c1bfb" NAME="EXT_JOURNAL" VERSION="1.0" TYPE="ext4"

Create a directory and mount your device on it:
root@OpenWrt:~# mkdir -p /mnt/flash
root@OpenWrt:~# mount -t ext4 /dev/sda2 /mnt/flash

Copy the router's internal flash to the flash drive :
root@OpenWrt:~# mkdir -p /tmp/cproot
root@OpenWrt:~# mount --bind / /tmp/cproot
root@OpenWrt:~# tar -C /tmp/cproot -cvf - . | tar -C /mnt/flash -xf -
root@OpenWrt:~# umount /tmp/cproot

Edit /etc/config/fstab file :
root@OpenWrt:~# vi /etc/config/fstab

config global
                option delay_root 1

config global automount
  option from_fstab 1
  option anon_mount 1

config global autoswap
  option from_fstab 1
  option anon_swap 0

config mount
  option target   /
  option device   /dev/sda2
  option fstype   ext4
  option options  rw,sync
  option enabled  1
  option enabled_fsck 0

config swap
  option device   /dev/sda1
  option enabled  1

Enable and Start fstab :
root@OpenWrt:~# /etc/init.d/fstab enable
root@OpenWrt:~# /etc/init.d/fstab start

Restart the router :
root@OpenWrt:~# reboot -f

After booting and login, check the mount point:
root@OpenWrt:~# mount

You should see that /dev/sda2 has been mounted on /
root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,noatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/sda2 on / type ext4 (rw,relatime,data=ordered)
tmpfs on /dev type tmpfs (rw,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

No comments:

Post a Comment