Photography
Computing
Tags
Filters
Templates
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
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:
install.img (you can found it in the firmware zip you've dowloaded from Asus)configuration.xmlinstall.img
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% /
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:
ext3 and present it to /opt using a symbolic linkoptwareDetailed instructions can be found here: http://oplayware.some.randomhash.net/hacked:optware
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
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
mkdir /opt/tmp cd /opt/tmp
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
tar -xvf ipkg-cl.tgz
/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
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
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)
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
/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./opt/bin//tmp/usbmounts/sda1 as /opt is not that good. We need to mount it properly.
Discussion
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
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!