How To: Linksys WRT350N VPN + USB without JFFS!

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Goto page 1, 2  Next
Author Message
sjorge
DD-WRT User


Joined: 08 Mar 2007
Posts: 149

PostPosted: Fri May 18, 2007 20:38    Post subject: How To: Linksys WRT350N VPN + USB without JFFS! Reply with quote
I've been trying to get this to work for the past 2 days and it manged to do it!

Requirements:

    * Linksys WRT350N (similar routers may work but untested)
    * Basic linux knowledge
    * access to a linux system (I did it with a gentoo live CD so that should work too)
    * dd-wrt v24


How to:

    1. download & unpack the Firmware Modification Kit
    2. download the latest beta of dd-wrt v24
    (I chose the VPN build because I wanted VPN aswel)
    3. Create a working directory. I called mine "dd-wrt" and made it inside the Firmware Mod Kit directory
    4. run ./extract_firmware.sh dd-wrt.v24_wrt350n.bin dd-wrt/
    5. download kmod-usb-uhci, kmod-usb-core, kmod-usb2 & kmod-usb-storage from http://downloads.openwrt.org/whiterussian/packages/
    6. install the packages e.g. ./ipkg_install.sh kmod-usb-uhci_2.4.30-brcm-5_mipsel.ipk dd-wrt/
    Note: I didn't install any filesystem packages... I use ext2 on my usb key and that is allready include in v24 so there is no need to install it. If you use fat or something else you need to install the packages aswel.
    7. Create a new directory where the new firmware images will be placed. I made mine on the same level as the dd-wrt folder and called it "output"
    8. lets create the images... ./build_firmware.sh output/ dd-wrt/


Thats it! You new have your new firmware image in the output folder.
You can now use a startup script to load the drivers and mount the disk.
Note: there now longer located in /jffs/lib... but they are now in /lib...

Here is my rc_startup:
Code:

# dd-wrt startup
echo "#!/bin/sh
# load kmod's
for module in usbcore ehci-hcd scsi_mod usb-storage sd_mod ext2; do {
    if [ -x \"/lib/modules/2.4.34/\$module.o\" ]; then
        insmod /lib/modules/2.4.34/\$module.o
    fi
    if [ \"\`lsmod | grep -c \$module\`\" == "0" ]; then
        insmod /lib/modules/2.4.30/\$module.o
    fi
}; done
sleep 5

# boot wait for USB
/tmp/usb_wait &
rm \$0
" > /tmp/load_kmod

echo "#!/bin/sh
# boot wait for USB
if [ \`dmesg | tail | grep -c 'USB Mass Storage device found at ' \` ] ; then
    mount /dev/scsi/host0/bus0/target0/lun0/part1 /opt
    sleep 2
    # configure firewall
    /opt/orion.fw
    # setup envirement & start services
    /opt/run/env-setup
    /opt/run/service startup &
    rm \$0
else
    gpio disable 4
    sleep 2
    gpio enable 4
    sleep 2
    \$0 &
fi
" > /tmp/usb_wait

chmod +x /tmp/usb_wait
chmod +x /tmp/load_kmod

/tmp/load_kmod &

Note: Before I create the new firmware image I updated dd-wrt/rootfs/etc/ipkg.conf and added a new destination called usb which points to opt so when I run ipkg -d usb install URL it works :)

As you can see I mount my disk in /opt and have a folder /opt/run with my startup scripts for VPN and some others.
I included run.zip which is my own service manager feel free to edit it to suite your needs.
It requires optware perl as a minimum, a startup script for VPN is included.
also make sure to edit env-setup!

env-setup updates the root username, and does some minor other things like mouting my swap partition so edit it to suit your needs.

I know this ain't perfect but I'm not to great at writing a documentation.
I hope this will help someone or inspire somebody do write a decent wiki artikel on this.



dd-wrt.v24_vpn+usb(20070620).bin
 Description:
v24 vpn build from 20070620 with USB modules.

Download
 Filename:  dd-wrt.v24_vpn+usb(20070620).bin
 Filesize:  3.66 MB
 Downloaded:  2935 Time(s)


run.zip
 Description:
my run folder with service script.
Note: I installed Optware tools like perl, busybox with swapon etc...
So you need to tweak this I'm sure of this!

Download
 Filename:  run.zip
 Filesize:  3.57 KB
 Downloaded:  1561 Time(s)



Last edited by sjorge on Fri Jul 06, 2007 10:30; edited 4 times in total
Sponsor
dionysian_mind
DD-WRT Novice


Joined: 26 May 2007
Posts: 1

PostPosted: Sat May 26, 2007 7:02    Post subject: Reply with quote
the build_firmare.sh out-puts .bin files that are named the following: custom_image-wrt54g.bin
custom_image-wrt54gs.bin
custom_image-wrt54gsv4.bin
custom_image-wrtsl54gs.bin

Which one should be used? does it matter? is this incorrect?
BanditRider
DD-WRT Novice


Joined: 15 May 2007
Posts: 4

PostPosted: Sat May 26, 2007 16:57    Post subject: Reply with quote
It also creates a link called custom_image-generic.bin which is a bad link to custom_image.trx.

You can rename custom_image.trx to custom_image.bin and use that bin.

That's what I did and it works fine.
metronet
DD-WRT Novice


Joined: 31 Jan 2007
Posts: 16
Location: Vancouver, BC CANADA

PostPosted: Wed May 30, 2007 23:17    Post subject: Reply with quote
sjorge, thanks for the nice HowTo.

Would you be kind enough to attach the modified firmware (if it's not against the rules here).

thx
metronet
meex
DD-WRT User


Joined: 26 Dec 2006
Posts: 127
Location: Würzburg, Germany

PostPosted: Thu May 31, 2007 7:34    Post subject: Reply with quote
i don't think its against the rules because its open source and any body can modify it!

but i think i will try this @ home *muhaha*


Very nice How to. Surprised
sjorge
DD-WRT User


Joined: 08 Mar 2007
Posts: 149

PostPosted: Thu May 31, 2007 9:05    Post subject: Reply with quote
Ok I've added the firmware to my original post.

The startup script I posted worked in about 2/10 times Sad
I got a new version running now that works in 9/10 I'll update it once I'm home.
meex
DD-WRT User


Joined: 26 Dec 2006
Posts: 127
Location: Würzburg, Germany

PostPosted: Thu May 31, 2007 12:58    Post subject: Reply with quote
does this how to works for WRT350N too?

Because i have downloaded v24 Beta 30.05.2007 --> dd-wrt.v24_wrt350n.bin than i have modifyed it and i have integrate

kmod-usb-uhci
kmod-usb-core
kmod-usb2
kmod-usb-storage
kmod-vfat


than i have built the custom image.. and i have taken "custom_image-wrt54g.bin" an now its the question does this work? Or is the kit only for WRT54G ?


can i kill my router by trying to get this image work?
sjorge
DD-WRT User


Joined: 08 Mar 2007
Posts: 149

PostPosted: Thu May 31, 2007 13:58    Post subject: Reply with quote
Should work with any firmware... aslong as the resulting image isn't to big :)

I use a wrt350n and my build works, I did use the generic VPN as source but it doesn't matter since only a few headers in the bin are missing.

Do use the mini to flash for the first time like you noramly would when upgrading from the stock firmware, after that it doesn't matter.
metronet
DD-WRT Novice


Joined: 31 Jan 2007
Posts: 16
Location: Vancouver, BC CANADA

PostPosted: Thu May 31, 2007 16:40    Post subject: Reply with quote
sjorge wrote:
Ok I've added the firmware to my original post.

The startup script I posted worked in about 2/10 times Sad
I got a new version running now that works in 9/10 I'll update it once I'm home.


Awesome!!!

thank you sjorge, I'll give it a try Very Happy
sjorge
DD-WRT User


Joined: 08 Mar 2007
Posts: 149

PostPosted: Fri Jun 01, 2007 15:24    Post subject: Reply with quote
Put up my services manager aswel!
User at own risk though! It requries optware perl.
edit the env-setup script before rebooting. Since I didn't change it before I uploaded (only swapped out my root name Wink)

I use this to setup the envirement, like binding a new profile file and other things like mouting a swap partition...

My startup script runs this before it fires of the service manager.
I've removed all my script and left the openvpn one.

sry this is so chaotic... I really suck at writing documentation and guids Sad
sjorge
DD-WRT User


Joined: 08 Mar 2007
Posts: 149

PostPosted: Fri Jul 06, 2007 10:31    Post subject: Reply with quote
Update firmware to a newer version 20070620 grab and enjoy
Rekoil
DD-WRT User


Joined: 13 Jun 2007
Posts: 234

PostPosted: Fri Jul 13, 2007 17:00    Post subject: Reply with quote
Heres my generic standard build with usb support, most file systems, printer support and a built in startup-script for it all. All you have to do is mount the drive Wink
http://www.dd-wrt.com/phpBB2/viewtopic.php?p=96302#96302

_________________
Asus RT-AC66U - DD-WRT build 23083


Last edited by Rekoil on Wed Aug 01, 2007 9:43; edited 1 time in total
roger_ming
DD-WRT Novice


Joined: 19 Jul 2007
Posts: 1

PostPosted: Thu Jul 19, 2007 18:28    Post subject: Re: How To: Linksys WRT350N VPN + USB without JFFS! Reply with quote
Hi, I am newbie to cook firmware, can anyone tell me where should the rc_startup locate ?
Just putting the script in the one folder below?
/etc/config/
/jffs/etc/config/
/mmc/etc/config/
/tmp/etc/config/


Thx! Very Happy
sjorge
DD-WRT User


Joined: 08 Mar 2007
Posts: 149

PostPosted: Fri Jul 20, 2007 7:48    Post subject: Reply with quote
You save it in nvram via the web interface.

Note: firefox doesn't seem to work Sad I had to use opera to get ti to accept \n unix style line endings.

Note2: if anyone know if I can bake this into the bin's fs and it still be execute that would be great.
Rekoil
DD-WRT User


Joined: 13 Jun 2007
Posts: 234

PostPosted: Fri Jul 20, 2007 8:55    Post subject: Reply with quote
Yeah sjorge thats how I did it. They go in /etc/config and don't forget to make them executable and name them *.startup.
_________________
Asus RT-AC66U - DD-WRT build 23083
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum