Skip to content

Instantly share code, notes, and snippets.

@Thinkscape
Created August 22, 2012 15:07
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Thinkscape/3426581 to your computer and use it in GitHub Desktop.
Save Thinkscape/3426581 to your computer and use it in GitHub Desktop.
Optware on DD-WRT with TL-WR1043ND
# From: http://www.dd-wrt.com/phpBB2/viewtopic.php?t=86912
# 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 etc opt root
touch optware.enable
chmod 755 etc opt root
mkdir opt/lib
chmod 755 opt/lib
cp -a /etc/* /mnt/etc/
mount -o bind /mnt/etc /etc
mount -o bind /mnt/opt /jffs
#5. Install the required libraries for the MIPS (big-endian) architecture and OpenWRT's opkg
#cd /tmp
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/libc_0.9.30.1-43.32_ar71xx.ipk
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/opkg_576-2_ar71xx.ipk
ipkg install libc_0.9.30.1-43.32_ar71xx.ipk opkg_576-2_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/root /tmp/root
mount -o bind /mnt/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 10
#if [ -f /mnt/optware.enable ]; then
#mount -o bind /mnt/etc /etc
#mount -o bind /mnt/root /tmp/root
#mount -o bind /mnt/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/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 !
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment