WARNING:
This tutorial will show you how to put rootfs on USB stick off ASUS WL-500gPv1 router. Please try this at your own risk, as I am not responsible or will not be held accountable for any damages done to your router. Although there may be a resolution to almost all errors, please read the instructions carefully when flashing image to your router (always have serial console attached to your router) so you won’t encounter any problems along the way.
I will try to contribute how to setup ASUS WL-500gP with rootfs on USB using OpenWRT Backfire branche and block-extroot package.
In your home dir we will create directory openwrt and download current svn code for Backfire branche:
Now we are going to configure some stuff for ASUS WL-500gP v1 router. We need to compile tools for OpenWRT if we wanna chnage some kernel settings with make kernel_menuconfig:Code:$ mkdir openwrt $ cd openwrt $svn co svn://svn.openwrt.org/openwrt/branches/backfire $cd backfire $svn up && ./scripts/feeds update
Exit and save changes. Now will will add usb support and all stuff for block-extroot.Code:make tools/compile make tools/install //now we will add FPU emulation into kernel: make kernel_menuconfig [*] Enable FPU emulation
Exit and save changes you done above and compile image:Code:make menuconfig Global Build Settings: [*] Compile the kernel with symbol table information (NEW) Kernel Modules: Filesystems ---> <*> kmod-fs-ext3..................................... EXT4 filesystem support which enable this --- kmod-fs-mbcache......................... mbcache (used by ext2/ext3/ext4) <*> kmod-nls-utf8...................................................... UTF-8 which enable then this: --- kmod-nls-base.................................... Native Language Support USB Support ---> <*> kmod-usb-core............................................ Support for USB <*> kmod-usb-serial..................... Support for USB-to-Serial converters <*> kmod-usb-serial-ftdi............................ Support for FTDI devices <*> kmod-usb-storage..................................... USB Storage support <*> kmod-usb-uhci............................... Support for UHCI controllers <*> kmod-usb2................................... Support for USB2 controllers Utilities ---> Filesystem ---> <*> blkid....... Command-line utility to locate/print block device attributes <*> e2fsprogs.................................. Ext2/3/4 filesystem utilities disc ---> <*> block-extroot....................... root filesystem on secondary storage ---> <*> fdisk............................... Partition table manipulation utility <*> swap-utils............................... Swap space management utilities <*> ldd.................................................... LDD trace utility <*> mount-utils........................... Devices mount/unmounting utilities
First time will take more time then usualy because first time toolchain is needed to compile..Code:make V=99 ; echo -e '\a'
After the compile proces is finished we will have our image inside
openwrt/backfire/bin/brcm47xx/ named as: openwrt-brcm47xx-squashfs.trx
Copy this file to /tmp/ directory of your router runing OpenWRT Kamikaze version and flash image with:
After a fev minutes you will see info Rebooting.... wait till power led on router on is and fireup putty and login to your router which is on 192.168.1.1 using telnet protocol.Code:mtd -r write /tmp/openwrt-brcm47xx-squashfs.trx linux
As you are loging first time you need to setup root password so type "passwd" and type your new password two time..
Logout from that session and open now SSH session to 192.168.1.1 and login using your new password.
Now we are going to prepare USB stick. Plug it in one of two ports of ASUS WL-500gPv1 and check dmesg to see on what device node is it found. In my case it was /dev/sda . We are going to wipe all stuff on that USB stick so if you have anything on it backup now as they will be deleted.
Now that our USB Stick is ready we are going to edit /etc/config/fstab to get it ready for block-extroot, this is how fstab should look for paritition table and filesystem used in this howto:Code://Wipe everthing from usb stick with: dd if=/dev/zero of=/dev/sda bs=512 count=1 Now we are going to create two partition swap and ext4 partition for our rootfs: fdisk /dev/sda p n -> p ->1->Enter->+128M p t->L->82 p n->p->2->Enter->Enter w q //Check if partition are created with: fdisk /dev/sda -l //now you see two partition /dev/sda1 as swap and /dev/sda2 as linux, so lets format swap and linux partition: mkswap /dev/sda1 mkfs.ext4 /dev/sda2
Not that i still didnt enable is_rootfs, because we wanna get shure that everything will be mounted after reboot and after we see that everything si there we can enable is_rootfs.Code: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 /home option device /dev/sda2 option fstype ext4 option options rw,sync option enabled 1 option enabled_fsck 0 option is_rootfs 0 config swap option device /dev/sda1 option enabled 1
So no we need to reboot and check with "free" if swap is activated and with "mount" if our /dev/sda2 parition is mounten as /home directory:
Now that everything is mounted as i should, we need to edit again /etc/config/fstab and change "option is_rootfs 0" to "option is_rootfs 1" and again reboot, and wait a bit longer then usualy.Code:root@OpenWrt:~# free total used free shared buffers Mem: 29728 28292 1436 0 6588 Swap: 0 0 0 Total: 29728 28292 1436 root@OpenWrt:~# root@OpenWrt:~# mount rootfs on / type rootfs (rw) /dev/root on /rom type squashfs (ro,relatime) none on /proc type proc (rw,relatime) sysfs on /sys type sysfs (rw,relatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime) tmpfs on /dev type tmpfs (rw,relatime,size=512k) devpts on /dev/pts type devpts (rw,relatime,mode=600) /dev/mtdblock3 on /overlay type jffs2 (rw,relatime) mini_fo:/overlay on / type mini_fo (rw,relatime) /dev/sda on /home ext4 (rw,XXX) <-- this is just example debugfs on /sys/kernel/debug type debugfs (rw,relatime) none on /proc/bus/usb type usbfs (rw,relatime) root@OpenWrt:~#
But after power led is turned on you should be able to login to 192.168.1.1 and have your /dev/sda2 as /overlay mouned like above:
Now you have your Asus WL-500gPv1 router with everything on USB stick and plenty of space for everything..Code:root@OpenWrt:~# mount rootfs on / type rootfs (rw) /dev/root on /rom type squashfs (ro,relatime) none on /proc type proc (rw,relatime) sysfs on /sys type sysfs (rw,relatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime) tmpfs on /dev type tmpfs (rw,relatime,size=512k) devpts on /dev/pts type devpts (rw,relatime,mode=600) /dev/sda2 on /overlay type ext4 (rw,sync,relatime,barrier=1,data=ordered) mini_fo:/overlay on / type mini_fo (rw,relatime) debugfs on /sys/kernel/debug type debugfs (rw,relatime) none on /proc/bus/usb type usbfs (rw,relatime) root@OpenWrt:~# root@OpenWrt:~# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 2048 2048 0 100% /rom tmpfs 14864 48 14816 0% /tmp tmpfs 512 0 512 0% /dev /dev/sda2 362449 20490 323245 6% /overlay mini_fo:/overlay 2048 2048 0 100% / root@OpenWrt:~#
PS: Why i cant edit my post after some time??





Reply With Quote