1 Attachment(s)
Using HDD drive for Root on OpenWRT
I have prepared some scripts (see attachement) to use HDD as root file system. The scripts are based on info found at:
http://wiki.openwrt.org/OpenWrtDocs/...etgear/WGT634U
http://openwrt.pbwiki.com/WGT634U_USB_root
http://forum.openwrt.org/viewtopic.php?pid=24104
As I'm not a big linux guru, the scripts might need improvements. So any feedback is welcome!
The script ini creates mount point (/hdd) in existing root filesystem and creates new file system layout.
linuxrc changes the root filesystem to hdd filesystem.
/etc/init.d/done has a small adition to execute linuxrc:
[ -f /linuxrc ] && . /linuxrc
How to use all this:
1. I assume you already have flashed OpenWRT firmware from http://back2basic.shacknet.nu/WL700Ge/
2. copy ini and linuxrc to /
3. give ini and linuxrc execute permition
4. execute ini
5. copy done to /etc/init.d/done
6. reboot the router.
You should see something like this:
Quote:
root@OpenWrt:/# mount
/dev/root on /jffs/rom type squashfs (ro)
none on /jffs/dev type devfs (rw)
/dev/mtdblock/4 on /jffs/jffs type jffs2 (rw)
/jffs on /jffs type mini_fo (rw)
/dev/discs/disc0/part1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /dev type devfs (rw)
none on /dev/pts type devpts (rw)
better way how to mount HDD
As always, USE ON YOUR OWN RISK!
I took the idea from here: http://openwrt.pbwiki.com/WGT634U_USB_root
I. The concept
I really like Oleg's firmware concept to use NVAM variable boot_dev. As we have not much space, HDD root fs can be only ext3.
II. What has been changed and how
(if you dont want to build an image, skip this section. Read the section III. How to use all this and use already created image)
I changed the mount_root script (the script is here).
What the modified mount_root does:
1. it looks for NVRAM variable boot_dev
2. it tries to mount that partition at mount point /mnt
3. it checks if there are directories /sbin and /rom and file /sbin/hotplug.failsafe on mounted partition. If everything looks ok, it does pivot_root. The old root fs is in /rom.
4. if something fails (partition is not mounted or it does not have directories /sbin and /rom and file /sbin/hotplug.failsafe ), customized mount_root acts as the original OpenWRT mount_root and mounts jffs2 filesystem.
To avoid mounting jffs2 fs, mount_root has to be on squashfs. So we have to compile it into trx image. Do the following:
1. Build the firmware with:
this will create trunk/build_mipsel directory.
2. replace mount_root script in trunk/build_mipsel/target/sbin
3. rebuild the firmware with new mount_root :
Quote:
cd trunk
make target/install
III. How to use all this
1. Create and format an ext3 partition on the HDD drive using:
Quote:
# play with fdisk if you need to repartition drive
fdisk fdisk /dev/discs/disc0/disc
# "format" partition
mke2fs -j /dev/discs/disc0/part1
2. Download my root2hdd.sh script and copy it to the router /tmp directory. You may want to customize boot_partition variable in the script acoording your HDD boot partition.
3. execute the /tmp/root2hdd.sh script to create root fs on HDD. It will also set NVRAM variable boot_dev.
Quote:
# /tmp/root2hdd.sh
4. reboot the router. If you want to boot jffs2 filesystem, simply:
Quote:
nvram unset boot_dev
nvram commit
it is possible to use VFAT
ipkg shows that it depends on nls_base. However you can extract the source and install modules and script manually.
not sure about nls_base, but iso nls modules can be used from WhiteRussian. Can be downloaded here:
http://downloads.openwrt.org/people/...gtest/packages