Monday, May 10, 2010

Fixing Mvix Ultio firmware

I always dreamed of a small NAS with BitTorrent capabilities to replace my noisy and always hot AMD-based HTPC computer. Last week I've received Mvix Ultio (MX-800HD), which I bought on eBay. This box connected to your LAN via either a cable or wireless from one side, and to your TV panel (via HDMI video and optical audio) from the other side, while having a 3.5 SATA disk bundled inside can be turned into a powerful entertainment device (with minimal power consumption).

The first thing I did when I connected this device, is flashing a new firmware v3.0 from Mvix Ultio support site. I enabled BitTorrent client and Samba plug-ins, as was described in manual. At that time I didn't expect any disappointment, but it came soon when I left it on overnight: the device hanged every couple of hours with no possibility to reboot it using remote control or panel buttons. I've read in one forum that unlimited number of peers in a bundled BitTorrent client (btpd) can kill this device easily. I tried to change settings of btpd startup script via telnet, but with no success as /etc is actually mapped to memory, and is not changeable.

Below comes a remedy process based on fixing an existing firmware, and preparing it for further hacking :)

DISCLAIMER: I take no responsibility for any damage you might cause to your device by following this guide.

1. You must have some Linux machine for that (choose yourself, what's easier: installing Ubuntu on VirtualBox or installing Cygwin on Windows? :-])

2. Download, compile and put mkyaffs2image and unyaffs utilities under your $PATH.

3. Extract existing firmware image:

mkdir install
cd install
tar xvf ../intsall.img

4. Extract contents of yaffs2_1.img:

cd package2
mkdir yaffs2_1
cd yaffs2_1
unyaffs ../yaffs2_1.img
cd ../

5. Extract contents of usr.local.etc.tar.bz2 (this archive will be extracted into a writable partition on a device, partition size is controlled by <sizeBytesMin> entry in configuration.xml):

mkdir usr_local_etc
cd usr_local_etc
tar jxvf ../usr.local.etc.tar.bz2
cd ../

The whole idea is to place things that we might need to configure later on a running device into this archive. So I've just merged contents of package2/yaffs2_1/etc/ into this archive (please do it carefully as there are plenty of symlinks pointing to the same place: /usr/local/etc). Then, I removed whole directory package2/yaffs2_1/etc/, and created a symlink instead:

rm -rf yaffs2/etc
ln -s /usr/local/etc yaffs2/etc

6. Now, lets fix the BitTorrent client settings:

vi yaffs2_1/usr/local/bin/package/script/bt.script
# find "start running btpd", and add needed settings after the $btpdbin
# (I've just limited a number of peers by adding: --max-peers 48)

BTW, you can move this script into /usr/local/etc archive too, and create a symbolic link to it, if you wish to modify it later on a running device.

7. Compress usr.local.etc.tar.bz2 back:

cd .usr_local_etc/

# Restore original files ownership (I don't know whether this is crucial):
chown -R 500:500 .

tar jcvf ../usr.local.etc.tar.bz2 *
cd ..
rm -rf usr_local_etc

7.1 (maybe optional) I don't know what's the point in duplicate /usr/local/etc/ folder contents under package2/yaffs2_1/usr/local/etc/, so I just did the following:

cd yaffs2_1/usr/local/etc/
rm -rf *
tar jxvf ../../../../usr.local.etc.tar.bz2
cd ../../../../

8. Compress yaffs2_1.img back:

# Restore original files ownership
chown -R 500:500 yaffs2_1/

mkyaffs2image yaffs2_1 yaffs2_1.img
chmod 644 yaffs2_1.img
rm -rf yaffs2_1

9. Compress the firmware image back:

# Restore original files ownership again :)
chown -R 500:500 .

tar cvf ../install.img *
cd ../
rm -rf install/

That's all. Now you're ready to go, and flash your box with the updated firmware.

PS: I'm too lazy to write how to setup "ipkg" package manager on Mvix Ultio, which allows installing additional software on this device, may be later...

2 comments:

Marcus said...

Hi Michael just came across this entry and have to say I'm glad I did. I own an earlier MVIX box which isn't as easily hackable and is now quite old so I'm considering the ultio (along with the sumvision cyclone and the HDX BD1. It would be nice if this stuff just worked out of the box but the ability to play is nice too!

Have you made any other modifications to the firmware?

Cheers
Marcus

Michael said...

@The Dude Abides, no, I haven't. Everything worked OK, except for the torrent, so I did a small modification to fix it.