Tuesday, November 3, 2015

Exroot OpenWRT on TPLink MR3020

Langkah langkah exroot

1. siapkan usb flashdisk, buat 2 partisi, partisi 1 buat swap file besarnya 500M saja,
   partisi 2 jenisnya ext4 besarnya sisa dari partisi yg ada.
2. siapkan MR3020 dengan firmware barrier breaker dan sudah tersetting konek ke internet.
3. masuk ssh ke ip router
4. ketik perintah update
opkg update
5. install driver usb storage
opkg install block-mount kmod-usb-storage kmod-fs-ext4

kalau ada error
kmod: failed to insert /lib/modules/3.10.49/ext4.ko
biarin aja

6. reboot
7. cek apakah usbnya sudah terdeteksi

root@OpenWrt:~# dmesg|grep sda
[   10.410000] sd 0:0:0:0: [sda] 15820800 512-byte logical blocks: (8.10 GB/7.54 GiB)
[   10.410000] sd 0:0:0:0: [sda] Write Protect is off
[   10.420000] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[   10.430000] sd 0:0:0:0: [sda] No Caching mode page found
[   10.430000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   10.450000] sd 0:0:0:0: [sda] No Caching mode page found
[   10.450000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   10.480000]  sda: sda1 < sda5 sda6 >
[   10.510000] sd 0:0:0:0: [sda] No Caching mode page found
[   10.510000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   10.520000] sd 0:0:0:0: [sda] Attached SCSI removable disk

8. install paket untuk exroot
opkg install block-mount kmod-fs-ext4 kmod-usb-storage kmod-usb-ohci

9. cek partisi yg ada di flash disk
block info

root@OpenWrt:~# block info
/dev/mtdblock2: UUID="20ad40ea-d33a421e-785b7d2d-ada99230" VERSION="4.0" TYPE="squashfs"
/dev/mtdblock3: TYPE="jffs2"
/dev/sda1: VERSION="2" TYPE="swap"
/dev/sda2: UUID="f5e53d37-b516-d101-70e5-3d37b516d101" NAME="EXT_JOURNAL" VERSION="1.0" TYPE="ext4"

yg sda1 --> swap  yg sda2 --> ext4

10. copy file system ke sda2

langkah langkahnya

mkdir -p /mnt/sda2
mount /dev/sda2 /mnt/sda2
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda2 -xf -
umount /tmp/cproot
umount /mnt/sda2

11. Buat router boot melalui flashdisk

Jalankan perintah ini

block detect > /etc/config/fstab


Edit file /etc/config/fstab

config global
        option anon_swap '0'
        option anon_mount '0'
        option auto_swap '1'
        option auto_mount '1'
        option delay_root '5'
        option check_fs '0'

config swap
        option device '/dev/sda1'
        option enabled '1'

config mount
        option target '/'
        option uuid '78e2ef58-6318-d101-7022-e4586318d101'
        option enabled '1'

11. reboot

12. cek

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    5.5G     16.0E      5.2G 100% /
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    14.1M    564.0K     13.5M   4% /tmp
/dev/sda2                 5.5G     16.0E      5.2G 100% /
tmpfs                   512.0K         0    512.0K   0% /dev

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)


13. DONE!

No comments: