Boot router from usb flash drive ?


hsyah

Network Guru
Member
Tomato from usb flash drive ?


ASUS 520GU dd-wrt mega TEST OK (BOOT usb flash )

http://www.3iii.dk/linux/ddwrt-micro-usb.htm


1. Unpack micro-plus-ssh with FirmwareModKit
2. Go to /rootfs/usr/sbin and remove 2 files: dropbearmulti и pppd.
3. Copy into /rootfs/lib/modules/<kernel>/ drivers: usbcore.o, usb-ohci.o, scsi_mod.o, usb-storage.o, sd_mod.o,ext2.o. (from unpacked nokaid, mega).
4. Go to rootfs/sbin
5. Move file init into rootfs/usr/sbin
6. Create new file rootfs/sbin/init:
Code:

#!/bin/sh
if [ $1 == "noinitrd" ] ; then
insmod /lib/modules/`uname -r`/usbcore.o
insmod /lib/modules/`uname -r`/usb-ohci.o
insmod /lib/modules/`uname -r`/scsi_mod.o
insmod /lib/modules/`uname -r`/usb-storage.o
insmod /lib/modules/`uname -r`/sd_mod.o
insmod /lib/modules/`uname -r`/ext2.o
sleep 8s
mount -t proc none /proc
mount -t ext2 -o noatime,nodiratime /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
if [ -x /mnt/sbin/init ] ; then
mount -o move /proc /mnt/proc && \
pivot_root /mnt /mnt/mnt && {
mount -o move /mnt/dev /dev
mount -o move /mnt/tmp /tmp
mount -o move /mnt/jffs /jffs
exec /sbin/init $*
}

else
exec /usr/sbin/init $*
fi
else
exec /usr/sbin/init $*
fi



Make this file executable.

7. Build firmware image and put it into router.

8. Create ext2 linux partition on usb flash drive (partition must be first in partition table, and size >= 15Mb)

9. Unpack MEGA firmware and put contents of rootfs to partition on usb flash drive. Change all files owner to 'root'.

Now, you can boot router from usb flash drive avtomaticaly if usb flash drive with ext2 partition is plugged.

Here is MICRO-PLUS-USB firmware, based on http://www.dd-wrt.com/dd-wrtv2/down...1218/dd-wrt.v24-11218_NEWD_micro-plus_ssh.bin

You also do not need to enable /jffs, as /jffs is already running from the USB drive.

You just need to do:

nvram set sys_enable_jffs2=1
nvram commit
mkdir -p /jffs/tmp/ipkg

You may want to consider formatting your HD with three partitions.

/part1 - 256Mb - ext2 (Mega.tar, Optware and extra software...)
/part2 - 64-256Mb - linux swap (Swap partition for the router)
/part3 - the rest - ext2 (NAS data, this is the space that Samba, FTP, NFS will share)


Then install swap-utilities and mount data drive

ipkg update
ipkg install swap-utilities
ipkg install e2fsprogs
mkdir -p /mnt/data
mkdir -p /jffs/etc/config/
mount /dev/discs/disc0/part3 /mnt/data
/jffs/usr/sbin/mkswap /dev/discs/disc0/part2
/jffs/usr/sbin/swapon /dev/discs/disc0/part2
 

Back
Top