Install optware

Be warned: you are doing this at your own risk.

Updates: 2010-06-17: added a todo section for stuff pending or partly resolved 2010-06-18: replaced symlink on opt with proper mount -o bind

1. Create a new install.img

The first step will be to create a new install.img. This step is required as we will need more space on / to create a few symbolic links and the default root has no space (type df in a shell to verify that).

On my device with firmware 1.28P it looks like:

  / # df
  Filesystem           1k-blocks      Used Available Use% Mounted on
  /dev/root                92160     92160         0 100% /
  ...
  

Detailed Instructions can be found here: http://minimodding.com/blogpost37-Custom-root-Partition

To increase the size of the root partition we will:

  1. decompress the install.img (you can found it in the firmware zip you've dowloaded from Asus)
  2. adjust the partition map in configuration.xml
  3. compress to a new install.img
  4. update the O!Play with that new firmware

Here's a summary of the commands to do that, assuming you have an install.img in the current directory:

  mkdir install_img
  tar -C install_img -xvf install.img
  cd install_img

Now look for the definition of / in configuration.xml:

  <image type="yaffs2">
    <fileName>package2/yaffs2_1.img</fileName>
    <mountPoint>/</mountPoint>
  </image>

and add the size for it to look like (the value you chose is really depending on the firmware):

  <image type="yaffs2">
    <fileName>package2/yaffs2_1.img</fileName>
    <mountPoint>/</mountPoint>
    <sizeBytesMin>0x6000000</sizeBytesMin>
  </image>

Now we just have to recompress to a new image:

  tar cvf ../install.img.new *
  cd ..

Copy install.img.new to install.img on your USB stick and update your device with this image.

In a shell run df and you will see:

  / # df
  Filesystem           1k-blocks      Used Available Use% Mounted on
  /dev/root                95360     93352      2008  98% /

2. Install optware

In order to install optware you will need an USB stick as we won't install anything on the tiny device storage. What we will do in this section:

  1. Remount the root partition to read/write
  2. format the USB stick to ext3 and present it to /opt using a symbolic link
  3. download and install optware

Detailed instructions can be found here: http://oplayware.some.randomhash.net/hacked:optware

2.1 Prepare the USB stick

In this section we will format the USB stick and create a mountpoint for it in /opt. In order for this to survive reboots you need to make sure the USB stick is always the first USB device in case you use a hub.

Mount / to read/write:

  mount / -o remount,rw

Create the symbolic link:ln -s /tmp/usbmounts/sda1 /opt

Umount the USB stick:

  umount /tmp/usbmounts/sda1

Format it to ext3:

  mke2fs -j -M /opt -L opt /dev/discs/disc0/part1

Remount it:

  mount /dev/discs/disc0/part1 /tmp/usbmounts/sda1

Mount /opt and /home:

  mkdir -p /home
  mkdir -p /opt
  mount /tmp/usbmounts/sda1/home /home -o bind
  mount /tmp/usbmounts/sda1 /opt -o bind

2.2. Download and install optware

In this section we will download the optware packages and install them. In order to do this you may need to modify /etc/resolv.conf: echo <your-DNS-goes-here> > /etc/resolv.conf

2.2.1. Create an temp dir and go there

  mkdir /opt/tmp
  cd /opt/tmp

2.2.2. Download ''optware'' packages

  wget http://www.kovari.priv.hu/download/ipkg-cl.tgz
  wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/uclibc-opt_0.9.28-13_mipsel.ipk
  wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/ipkg-opt_0.99.163-10_mipsel.ipk

2.2.3. Extract the installer

  tar -xvf ipkg-cl.tgz

2.2.4. Install

  /opt/tmp/ipkg-cl install uclibc-opt_0.9.28-13_mipsel.ipk
  /opt/tmp/ipkg-cl install ipkg-opt_0.99.163-10_mipsel.ipk

2.2.5. Clean up

  rm /opt/tmp/ipkg-cl
  rm /opt/tmp/ipkg-cl.tgz 
  rm /opt/tmp/ipkg-opt_0.99.163-10_mipsel.ipk 
  rm /opt/tmp/uclibc-opt_0.9.28-13_mipsel.ipk

2.2.6. ipkg

Update ipkg:

  /opt/bin/ipkg update

List packages:

  /opt/bin/ipkg list
  

Install package:

  /opt/bin/ipkg install <package> (e.g. /opt/bin/ipkg install openssh)
  

3. make optware persistent

Now you may have noticed that whatever daemons you have installed they are all gone upon reboot. The reason is o!play's and optware's startups are kept strictly separated: o!play runs /usr/local/etc/rcS at boot, optware keeps it's startup sequence in /opt/etc/init.d/. Right now I'm not confident enough to extend rcS for my needs because I noticed that USB is not always mounting the same way (remember, we have a symlink on /opt) so I've created a separated script to start optware. The major benefit is that I don't have to care about proper error handling in rcS for situations I don't know of yet.

To summarize my solution is a script /usr/local/etc/postboot.sh doing the init stuff that I run by hand after each boot:

  #!/bin/sh
  # mounts
  mkdir -p /home
  mkdir -p /opt
  mount /tmp/usbmounts/sda1/home /home -o bind
  mount /tmp/usbmounts/sda1 /opt -o bind
  
  # startup daemons
  if [ -d /opt/etc/init.d ]; then
    for f in /opt/etc/init.d/S* ; do
      [ -x $f ] && $f 
    done
  fi 
  # make optware visible          
  PATH=$PATH:/opt/bin:/opt/sbin
  export PATH
  # create convenience symlinks for network shares
  mkdir -p /tmp/ramfs/volumes/Movies
  mount -t cifs -o username=XXXX,password=YYYY,iocharset=utf8 //<ip>/video /tmp/ramfs/volumes/Movies/
  mkdir -p /tmp/ramfs/volumes/Video
  mount -t cifs -o username=XXXX,password=YYYY,iocharset=utf8 //192.168.20.53/video /tmp/ramfs/volumes/Video/
  # add another directory within a share
  ln -s /tmp/ramfs/volumes/Movies/new /tmp/ramfs/volumes/New

4. Todo

  • I've noticed that my /etc/resolv.conf (/usr/local/etc/resolv.conf) gets added lines that makes no sense to me at the top probably solowing down name resolution as my DNS (router) moves down the list. I assume one “bad” item is added at each boot. My solution wouulb be to add echo <my-dns> > /usr/local/etc/resolv.conf in the boot sequence (I guess I'll have to remount / in read-write mode for that.
  • We still need to update the profile to export /opt/bin/
  • done 2010-06-18: I guess the symlink to /tmp/usbmounts/sda1 as /opt is not that good. We need to mount it properly.

Discussion

ph83, 2010/06/19 13:31
Hi!

Many (many) thanks for this very clearly layed out howto! I'd got the feeling the info was out there but dispersed and sometimes a little cryptic.

Now I'm pretty confident I can go ahead and at last turn on SSH on my HRP-R1 to make it at last a NAS so I can access the attached USB drive on my linux PC! I was betting this would be added to the ASUS FW soon, but we only seem to see totally insignificant FW updates...

My only question is: how do you recommend setting the new root partition size? Basically add the size of the postboot.sh file (+ a little extra for comfort and future lines that might be added to postboot.sh) to the factory root size? How do I determine the maximum safe partition size for HDP-R1 under 1.24P?

Best,
Pascal
ph83, 2010/06/19 13:33
PS: if the USB stick stays in the same slot (any preference here?) then does it reliably become visible as /tmp/usbmounts/sda1 ?
ph83, 2010/06/20 00:00
I had to increase the root partition size steadily until I got free space : <sizeBytesMin>0x6000000</sizeBytesMin>

Now I've got (1.24P):

Filesystem 1k-blocks Used Available Use% Mounted on
/dev/root 95360 85496 9864 90% /
/dev/mtdblock/2 40960 1384 39576 3% /usr/local/etc
/dev/rd/0 40 40 0 100% /mnt/rd

Everything went fine, excellent instructions!

In order to get the ssh/sftp server started automatically at startup, I added the following lines at the end of the /usr/local/etc/rcS (the sleep 15 secs was the key, since the USB drives take time to come up):

sleep 15

mkdir -p /home
mkdir -p /opt
if [ -d /tmp/usbmounts/sdb1/etc/init.d ]; then
mount /tmp/usbmounts/sdb1/home /home -o bind
mount /tmp/usbmounts/sdb1 /opt -o bind
elif [ -d /tmp/usbmounts/sda1/etc/init.d ]; then
mount /tmp/usbmounts/sda1/home /home -o bind
mount /tmp/usbmounts/sda1 /opt -o bind
fi

# startup daemons
if [ -d /opt/etc/init.d ]; then
for f in /opt/etc/init.d/S* ; do
[ -x $f ] && $f
done
fi

# make optware visible
PATH=$PATH:/opt/bin:/opt/sbin
export PATH

That wraps it up for me: the HDP-R1 finally becomes the perfect universal solution as NAS and media player!
cri, 2010/07/02 23:09
I've tested ph83 solution to mount the disks and to start the daemons at start-up and it works.
ph83, 2010/12/02 22:50
BTW: I've replaced OpenSSH on the ASUS and replaced it with dropbear, the latter is much lighter and allows me to do some heavy rsync over SSH (which openssh didn't: it kept dying unpredictably).
bianca, 2012/04/22 19:30
I've got to show my personal htanks to this particular writer simply for saving myself via a real establishing. As a consequence of browsing on through the the web as well as getting guidelines which were not pleasurable, I figured my entire life has been around. Being alive without the solutions to the down sides you've got resolved through all of your website is a crucial case, in addition to kinds which may possess poorly harmed my personal complete occupation only hadn't identified your website. Your main expertise along with goodness in dealing with everything ended up being beneficial. I’m unsure what I might have done only hadn’t come upon this kind of that. I can also at this time stay up for my own potential. Cheers a lot for your specialised along with remarkable assist. I won’t think twice to propose your web site to be able to anyone who wants suggestions about it subject material.
Mena, 2012/04/23 00:17
I've got to show my personal tnkhas to this particular writer simply for saving myself via a real establishing. As a consequence of browsing on through the the web as well as getting guidelines which were not pleasurable, I figured my entire life has been around. Being alive without the solutions to the down sides you've got resolved through all of your website is a crucial case, in addition to kinds which may possess poorly harmed my personal complete occupation only hadn't identified your website. Your main expertise along with goodness in dealing with everything ended up being beneficial. I’m unsure what I might have done only hadn’t come upon this kind of that. I can also at this time stay up for my own potential. Cheers a lot for your specialised along with remarkable assist. I won’t think twice to propose your web site to be able to anyone who wants suggestions about it subject material.
Enter your comment
 
  • Bookmark at
  • Bookmark "Install optware" at del.icio.us
  • Bookmark "Install optware" at Digg
  • Bookmark "Install optware" at blogmarks
  • Bookmark "Install optware" at Google
  • Bookmark "Install optware" at Rojo
  • Bookmark "Install optware" at Simpy
  • Bookmark "Install optware" at Spurl
  • Bookmark "Install optware" at StumbleUpon
  • Bookmark "Install optware" at Tailrank
  • Bookmark "Install optware" at Technorati
  • Bookmark "Install optware" at Live Bookmarks
  • Bookmark "Install optware" at Memori
  • Bookmark "Install optware" at Favorites
  • Bookmark "Install optware" at Facebook
  • Bookmark "Install optware" at Twitter
  • Bookmark "Install optware" at Mister Wong
oplay/optware.txt · Last modified: 2010/06/18 09:18 by sven
Recent changes RSS feed