[Howto] Install Optware on Atheros units (such as WNDR3700)

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Atheros WiSOC based Hardware
Goto page 1, 2, 3 ... 27, 28, 29  Next
Author Message
dynek
DD-WRT User


Joined: 19 Oct 2006
Posts: 131

PostPosted: Fri Jan 28, 2011 10:39    Post subject: [Howto] Install Optware on Atheros units (such as WNDR3700) Reply with quote
I quit using DD-WRT (at least for the moment) so this guide will not be maintained anymore.

All thanks are going to this guy:
http://g300nh.blogspot.com/2010/06/software-installation-on-dd-wrt-part-1.html
http://g300nh.blogspot.com/2010/06/software-installation-on-dd-wrt-part-2.html

1. Prepare the USB disk
Create an ext3 partition using GParted for instance

2. Configure DD-WRT
Under Services->Services->Secure Shell:
* Enable SSHd
* Click Apply Settings

Under Services->USB:
* Enable Core USB Support
* Disable USB Printer Support (enable it if you need printing support)
* Enable USB Storage Support
* Enable Automatic Drive Mount
* Set Disk Mount Point to /mnt
* Click Apply Settings

3. Plug the USB drive into the router and reboot it
* SSH into your box using user root and make sure, using mount, that your USB stick was mounted correctly (you can also check this on the web interface under Services->USB).

4. Create and prepare necessary structure
* SSH into your box using user root if not already done at previous step:

cd /mnt
mkdir /sda_part1
cd /mnt/sda_part1
mkdir etc opt root
touch optware.enable
chmod 755 etc opt root
mkdir opt/lib
chmod 755 opt/lib
cp -a /etc/* /mnt/sda_part1/etc/
mount -o bind /mnt/sda_part1/etc /etc
mount -o bind /mnt/sda_part1/opt /jffs


5. Install the required libraries for the MIPS (big-endian) architecture and OpenWRT's opkg
cd /tmp
wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/libc_0.9.33.2-1_ar71xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/opkg_618-3_ar71xx.ipk
ipkg libc_0.9.33.2-1_ar71xx.ipk opkg_618-3_ar71xx.ipk


You will get the following output with error messages. You can't avoid it so don't worry about it.

ERROR: File not found: //usr/local/lib/ipkg/lists/whiterussian
You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/non-free
You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/backports
You probably want to run `ipkg update'
/bin/ipkg: line 1184: sort: not found
Unpacking libc...Done.
Configuring libc...Done.
ERROR: File not found: //usr/local/lib/ipkg/lists/whiterussian
You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/non-free
You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/backports
You probably want to run `ipkg update'
/bin/ipkg: line 1184: sort: not found
Unpacking opkg...Done.
Configuring opkg...Done.


Type the following lines to create the configuration file for opkg:

cat > /etc/opkg.conf << EOF
src/gz snapshots http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages
dest root /opt
dest ram /opt/tmp
lists_dir ext /opt/tmp/var/opkg-lists
EOF


Let's make sure everything works properly:

umount /jffs
mount -o bind /mnt/sda_part1/root /tmp/root
mount -o bind /mnt/sda_part1/opt /opt
export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib'
opkg update


You should see:

Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz.
Inflating http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/Packages.gz.
Updated list of available packages in /opt/tmp/var/opkg-lists/snapshots.


6. Set the startup script to make the changes take effect each time upon reboot

Under DD-WRT’s web interface, Administration->Commands, input the following commands in the window then click "Save Startup":

#!/bin/sh

sleep 5
if [ -f /mnt/sda_part1/optware.enable ]; then
mount -o bind /mnt/sda_part1/etc /etc
mount -o bind /mnt/sda_part1/root /tmp/root
mount -o bind /mnt/sda_part1/opt /opt
else
exit
fi

if [ -d /opt/usr ]; then
export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib'
export PATH='/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/sbin:/usr/sbin:/usr/bin'
else
exit
fi


Note that some users have reported issues that they were able to fix by making the script sleep 10 seconds instead of 5.

7. Modification of the profile file

SSH into your box then copy/paste the commands below to PuTTY window to create a script running each time when user root logins:

cat > /mnt/sda_part1/root/.profile << EOF
export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib:/opt/usr/local/lib'
export PATH='/sbin:/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/usr/bin:/usr/sbin:/opt/usr/local/bin'
export PS1='\[\033[01;31m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
export TERMINFO='/opt/usr/share/terminfo'
EOF


The above script will set the variables for us and also provide a nice colored command line prompt.

8. Reboot and check

Reboot your device with reboot
When it's back on the track, SSH into your box.
Run opkg update

You can start installing all kind of wild things ! Yeeehhhaaa ! Smile


Last edited by dynek on Thu Mar 06, 2014 8:05; edited 21 times in total
Sponsor
buddee
DD-WRT Guru


Joined: 06 Feb 2010
Posts: 7382
Location: Little Rock

PostPosted: Fri Jan 28, 2011 15:04    Post subject: Reply with quote
Cool, hopefully you have tested this and its working properly for you, i am going to link this guide into the wiki for reference, thanks.
_________________
Wireless N Config | Linking Routers | DD-WRT Wiki | DD-WRT Builds | Peacock - Broadcom FAQ

Having problems with port forwarding? Check out Port Forward Troubleshooting for more info.
dynek
DD-WRT User


Joined: 19 Oct 2006
Posts: 131

PostPosted: Fri Jan 28, 2011 16:06    Post subject: Reply with quote
[removing own comment]

Last edited by dynek on Thu Mar 06, 2014 8:09; edited 3 times in total
Diehardshorty
DD-WRT Novice


Joined: 20 Jan 2011
Posts: 31
Location: US

PostPosted: Sat Jan 29, 2011 0:00    Post subject: Reply with quote
Amazing was waiting for a simple guide for the WNDR3700

What about adding a swap partition would that help lessen the load on the router with certain apps like torrents
Diehardshorty
DD-WRT Novice


Joined: 20 Jan 2011
Posts: 31
Location: US

PostPosted: Sat Jan 29, 2011 1:11    Post subject: Reply with quote
Im getting some errors at ipkg install
6. Install OpenWRT's opkg:

Code:
login as: root
DD-WRT v24-sp2 std (c) 2010 NewMedia-NET GmbH
Release: 12/24/10 (SVN revision: 15962)
root@192.168.1.1's password:
==========================================================

 ____  ___    __        ______ _____         ____  _  _
 | _ \| _ \   \ \      / /  _ \_   _| __   _|___ \| || |
 || | || ||____\ \ /\ / /| |_) || |   \ \ / / __) | || |_
 ||_| ||_||_____\ V  V / |  _ < | |    \ V / / __/|__   _|
 |___/|___/      \_/\_/  |_| \_\|_|     \_/ |_____|  |_|

                       DD-WRT v24-sp2
                   http://www.dd-wrt.com

==========================================================


BusyBox v1.13.4 (2010-12-24 10:48:55 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.

root@DD-WRT:~# cd /mnt
root@DD-WRT:/mnt# mkdir etc opt root
root@DD-WRT:/mnt# touch optware.enable
root@DD-WRT:/mnt# chmod 755 etc opt root
root@DD-WRT:/mnt# mkdir opt/lib
root@DD-WRT:/mnt# chmod 755 opt/lib
root@DD-WRT:/mnt# cp -a /etc/* /mnt/etc/
root@DD-WRT:/mnt# mount -o bind /mnt/etc /etc
root@DD-WRT:/mnt# mount -o bind /mnt/opt /jffs
root@DD-WRT:/mnt# ls /jffs/lib
ld-uClibc.so.0         libgcc_s.so.1          libuClibc-0.9.30.1.so
libc.so.0              libm.so.0              libutil.so.0
libcrypt.so.0          libnsl.so.0
libdl.so.0             libresolv.so.0
root@DD-WRT:/mnt# chmod a+x /jffs/lib/*
root@DD-WRT:/mnt# cd /tmp
root@DD-WRT:/tmp# wget http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/
packages/opkg_576-1_ar71xx.ipk
Connecting to downloads.openwrt.org (78.24.191.177:80)
opkg_576-1_ar71xx.ip 100% |*******************************| 57133  00:00:00 ETA
root@DD-WRT:/tmp# ipkg install opkg_576-1_ar71xx.ipk
ERROR: File not found: //usr/local/lib/ipkg/lists/whiterussian
       You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/non-free
       You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/backports
       You probably want to run `ipkg update'
/bin/ipkg: line 1184: sort: not found
Unpacking opkg...Done.
Configuring opkg...Done.


Then i try ipkg update
Code:
root@DD-WRT:/tmp# ipkg update
mkdir: cannot create directory '//usr/local/lib/': Read-only file system



And then opkg update
Code:
root@DD-WRT:~# opkg update
opkg: can't resolve symbol 'glob64' in lib 'opkg'.


I did restart like you said but still got the globe64 thing
dynek
DD-WRT User


Joined: 19 Oct 2006
Posts: 131

PostPosted: Sat Jan 29, 2011 9:25    Post subject: Reply with quote
Diehardshorty wrote:
What about adding a swap partition would that help lessen the load on the router with certain apps like torrents

Adding a swap partition won't probably help for two reason. The USB stick is way slower than internal memory + the WNDR3700 has plenty of available memory. Maybe if you install hungry packages you will need it.


Diehardshorty wrote:
ERROR: File not found: //usr/local/lib/ipkg/lists/whiterussian
You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/non-free
You probably want to run `ipkg update'
ERROR: File not found: //usr/local/lib/ipkg/lists/backports
You probably want to run `ipkg update'
/bin/ipkg: line 1184: sort: not found
Unpacking opkg...Done.
Configuring opkg...Done.


I don't remember seeing this but in the end it says opkg was installed.
Did you really disable JFFS2 ? Can you check it ?
Also can you show me what "mount" returns ?

There is something weird. Can you still see what's in /jffs/lib ?
wesleyrpg
DD-WRT Novice


Joined: 22 Sep 2010
Posts: 4

PostPosted: Sat Jan 29, 2011 13:22    Post subject: Reply with quote
ok quick noob question......if i play around and get all this to work, and install Ctorrent or Enhanced Ctorrent directly to the router will i be able to access it through the usual pretty ddwrt GUI?
dynek
DD-WRT User


Joined: 19 Oct 2006
Posts: 131

PostPosted: Sat Jan 29, 2011 16:47    Post subject: Reply with quote
Nope.
Diehardshorty
DD-WRT Novice


Joined: 20 Jan 2011
Posts: 31
Location: US

PostPosted: Sun Jan 30, 2011 2:02    Post subject: Reply with quote
Quote:
I don't remember seeing this but in the end it says opkg was installed.
Did you really disable JFFS2 ? Can you check it ?
Also can you show me what "mount" returns ?

There is something weird. Can you still see what's in /jffs/lib ?



Code:
root@DD-WRT root $ mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
ramfs on /tmp type ramfs (rw,relatime)
none on /dev type tmpfs (rw,relatime,size=512k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
devpts on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda2 on /mnt type ext3 (rw,relatime,errors=continue,data=writeback)
/dev/sda2 on /etc type ext3 (rw,relatime,errors=continue,data=writeback)
/dev/sda2 on /tmp/root type ext3 (rw,relatime,errors=continue,data=writeback)
/dev/sda2 on /opt type ext3 (rw,relatime,errors=continue,data=writeback)
root@DD-WRT root $


Hmm weird it might be installed idk im getting different readings 2 days later
Diehardshorty
DD-WRT Novice


Joined: 20 Jan 2011
Posts: 31
Location: US

PostPosted: Sun Jan 30, 2011 2:11    Post subject: Reply with quote
weirdest thing though after a couple days its now working hmm

Weird well thanks for the tut was very helpful
buddee
DD-WRT Guru


Joined: 06 Feb 2010
Posts: 7382
Location: Little Rock

PostPosted: Sun Jan 30, 2011 3:40    Post subject: Reply with quote
And just in general, this works on different Atheros units and is not exclusive to the netgear 3700, i've already installed optware packages to my wzr-hp-g300nh plenty of times.

So don't let the title post fool any of you other Atheros based users. Wink

_________________
Wireless N Config | Linking Routers | DD-WRT Wiki | DD-WRT Builds | Peacock - Broadcom FAQ

Having problems with port forwarding? Check out Port Forward Troubleshooting for more info.
Jenot
DD-WRT Novice


Joined: 29 Jan 2011
Posts: 6

PostPosted: Sun Jan 30, 2011 7:59    Post subject: Reply with quote
@dynek: In Your startup script there is no line "mount -o bind /mnt/opt /jffs ", so after restart /jffs isn't mounted.
Diehardshorty
DD-WRT Novice


Joined: 20 Jan 2011
Posts: 31
Location: US

PostPosted: Sun Jan 30, 2011 8:03    Post subject: Reply with quote
Hmm yea thats right i didnt see that cuz when i ran mount it was always mounted and i haven't restarted my router yet
buddee
DD-WRT Guru


Joined: 06 Feb 2010
Posts: 7382
Location: Little Rock

PostPosted: Sun Jan 30, 2011 8:12    Post subject: Reply with quote
Not even sure why you would even need /jffs

jffs in general is more for non usb enabled devices for storing scripts, certs etc, here since you have a USB storage, you wouldn't really need jffs

_________________
Wireless N Config | Linking Routers | DD-WRT Wiki | DD-WRT Builds | Peacock - Broadcom FAQ

Having problems with port forwarding? Check out Port Forward Troubleshooting for more info.
Jenot
DD-WRT Novice


Joined: 29 Jan 2011
Posts: 6

PostPosted: Sun Jan 30, 2011 8:21    Post subject: Reply with quote
opkg desn't run when /jffs isn't mounted rw.
Goto page 1, 2, 3 ... 27, 28, 29  Next Display posts from previous:    Page 1 of 29
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Atheros WiSOC 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 cannot attach files in this forum
You cannot download files in this forum