| ipkg package system Tutorial |
|
|
|
| Written by macsat | |
| Friday, 25 November 2005 | |
|
This is a step for step guide for adding support for the ipkg package system to your ASUS WLxxxx linux-based wireless product. In the tutorial I will also install the first ipkg package - the text editor nano. Following the guide will not change the default features of your device, it will just add some nice functionality to it.The guide is made using a ASUS WL-500G Deluxe (or WL-500GX as it is sometimes called). It should however apply to all the ASUS wireless line of products that are Linux based. Theese products are to my knowledge :
If you are the lucky owner of any of the above devices, you have come to the right place. Guide Index1. Prerequisites - What is needed to get started.2. Basic Knowledge - Basic information about the system, and the packages that are beeing installed 3. Disk Setup - Setting up harddrive / usb memory key 4. Installing basic software - install a text editor and the webserver 5. Configuring the router to mount on boot PrerequisitesAll you need is :The firmware IS needed. You will NOT get the steps below working if you use the stock firmware. The firmware on your device can be upgraded using the webinterface, please consult your users manual for details. If you dont already own one of the ASUS devices above, but consider buying one in order to take advantage of the server-possibilities, you should probably go for the WL-500gx or the WL-HDD. The WL-500gx has USB2.0 and the WL-HDD uses a normal IDE interface, while the other devices uses the slow USB 1.1 interface. Basic KnowledgeThe ASUS WL-series routers are all running on a Broadcom BCM947XX Mipsel CPU and a customized linux.They all run a telnet server on the LAN side, allowing the users to access the routers console, using a telnet client like Putty ASUS are not the only manufactures making linux-based networking devices. Also Linksys have made quite a few products based on linux. One of theese products is the NSLU2, where a quite large community has developed a custom linux called Unslung. Unslung has its own package system, and a lot of theese packages has been ported to the ASUS WL devices. These packages are the ones used below. Disk SetupIn the following, I will be using an USB disk, since I use the WL-500gx, not the WL-HDD. Even witht he WL-HDD things should be the same.I am not sure about the standard mount-point of the WL-HDD, but I guess it is the same as the other devices There are multiple approaches regarding the disksystem. I have chosen to use a dedicated disk for storing my additional linux packages, and my html/php files for my webpages. Also I have chosen to use some of my diskspace for SWAP, to ensure stability of my system. Another approach would be to use only part of the disk for it, and then using the rest of it for the normal build-in ftpserver. This can be done on two ways. One way is to use a FAT (windows) formatted disk, and create a file on that disk that contains the ext3 filesystem. The other is to split the disk in multiple partitions, one with ext3, one with linux-swap and one with windows filesystem. If there is demand for a walk-through of theese methods, I will consider adding them to the guide. The extra packages we are going to install are all going to be installed in the /opt directory on the system. Since the /opt directory is empty and a part of the onboard Flash ram - which dont have enough space to store our files - we are going to partition a disk, create the ext3 filesystem on it, and mounting it as /opt. If you just connect a usb disk to the WL-500gx, it will automaticly mount it to /tmp/harddisk and start the build-in ftp-server. We need it to be mounted on /opt and hence need to make a few system-configuration changes. Configuring your diskspace1) Connect your USB memory/disk device (in this example I am using an USB2.0 256MB memory thing from Kingston (DataTravelerII)2) Log on to your router using telnet. As mentioned, putty would be a good choice of client. If you havent changed it, the router address is 192.168.1.1 and username / password is the same as you use for the webinterface. (In my screenshot I use 192.168.0.1, since this is my router address!) ![]() 3) Check if the USB device you connected is mounted : ![]() As you can see, my device automounted on : /tmp/harddisk and the devicename is : /dev/discs/disc0/part1 . Whenever I write this devicename, you should replace with the devicename of YOUR device. 4) You need to unmount the device. If the umount command fails, it is probably because you have enabled the ftpserver in your administration web pages. You can kill the ftp-server by issuing the commands as in this screenshot: ![]() 5) Now we are ready to create the linux (ext3) and swap partitions. Issue the commands below, but please do READ what the output is as you move along. Particularly you should consider changing values for "Last Cylinder / Size" to fit your harddrive size. I am creating a 220 MB linux/ext3 partition, and a swap partition using the remaining space (36 MB).
fdisk /dev/discs/disc0/disc < enter >
d < enter > n < enter > p < enter > 1 < enter > < enter > +220M < enter > n < enter > p < enter > 2 < enter > < enter > < enter > t < enter > 2 < enter > 82 < enter > w < enter > You can now list your new partitions by :
fdisk -l
My output is : ![]() 6) With the partitions created, filesystem has to be created (like when you are formatting your drives in windows).
mke2fs -j /dev/discs/disc0/part1 < enter >
mkswap /dev/discs/disc0/part2 < enter > 7) Now reboot your router, and after that login again using telnet, and if needed go through 4) again to unmount the device
reboot < enter >
8) Mount the newly created disk as /opt and enable the swap partition.
mount /dev/discs/disc0/part1 /opt < enter >
You can see your mounted drive, and the swap-space by :
swapon /dev/discs/disc0/part2 < enter >
df < enter >
Mount-on-boot will be enabled in the Making the router mount on boot section of this tutorial.
free < enter > Installing Basic SoftwareFirst thing to install is the ipkg package management system.
mkdir /opt/tmp < enter >
Now update the packagelist for ipkg and install the nano text editor
mkdir /opt/tmp/ipkg < enter > ipkg.sh update < enter > ipkg.sh install ipkg < enter >
/opt/bin/ipkg update < enter >
IF one of the commands return some text ended by: "Segmentation fault" try to issue the same command again. /opt/bin/ipkg install nano < enter > It seems like the ipkg version is not completely stable. Now you have successfully installed the ipkg package system and a nice editor Configuring the router to mount on bootThe Firmware version 1.9.2.7-4 (and later) by Oleg has a nice feature that it runs certain files at boot time, if they exist. Create theese files :
mkdir /usr/local < enter >
Open the post-boot file in the nano editor:
mkdir /usr/local/sbin < enter > touch /usr/local/sbin/post-boot < enter > touch /usr/local/sbin/post-firewall < enter > chmod +x /usr/local/sbin/* < enter >
/opt/bin/nano /usr/local/sbin/post-boot < enter >
Copy-Paste this into the editor window (on putty, paste with < enter > + < insert > ):
#!/bin/sh
Save the file by pressing < ctrl > + O followed by < enter >, exit nano with < ctrl > + X followed by < enter > # wait for /opt to mount mount /dev/discs/disc0/part1 /opt i=0 while [ $i -le 30 ] do if [ -d /opt/etc ] then break fi sleep 1 i=`expr $i + 1` done # Activate swap swapon /dev/discs/disc0/part2 # Run all active services - active means starts with S /opt/etc/init.d/rc.unslung Only thing now, is to save the changes we made. Since /usr/local/sbin is not on the USB disk we connected, but instead in the internal flash memory of the ASUS Device, we need to save it to flash and tell the router to use the files by enabling flashfs :
flashfs save < enter >
flashfs commit < enter > flashfs enable < enter > That is basically it, reboot your ASUS WL device, and enjoy your external storage, your swap space, your new editor and your ipkg package sytem :-)
reboot < enter >
I hope you found this guide useful. Comments are welcome to This e-mail address is being protected from spam bots, you need JavaScript enabled to view it If you feel like it, donations are more than welcome as well :-) |
|
| Last Updated ( Monday, 29 January 2007 ) |
| < Prev | Next > |
|---|











