Librarchy

From Lundman Wiki
Revision as of 14:10, 18 April 2009 by Lundman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

librarcy

<google uid="C01">Dune HDi</google>

Since Dune does not handle talking to llink (over HTTP) in any form [1], I found myself missing the unrar streaming support that llink provides. So I started considering a solution for this problem. I have assumed that Dune developers are not approachable, nor particularly interested in helping someone on the outside, so it would have to be a solution I could do myself.

I started on the idea of using LD_PRELOAD to point to my glue code, which intercepts the calls open64/read/lseek/close/opendir/readdir64/closedir/lstat64/stat64.

Please note that librarcy needs a special version of unrar that features the extra option -sk to seek into an archive. This is available in the llink packages.


<paypal></paypal>

Sources

librarcy-1.0.3.tar.gz 

Older sources:

librarcy-1.0.2.tar.gz 
librarcy-1.0.1.tar.gz 


Environment Variable

LIBRARCY_UNRAR=/path   : specify path to unrar. Default "/tmp/unrar"
LIBRARCY_DEBUG=1       : Enable debug log "/tmp/librarcy.log"
LIBRARCY_BUFSiZE=x     : If set, librarcy will allocate 2 buffers of size x. 

Buffers are currently needed for NMT players due to the excessive seeking. Dune does not need it, but will also experience a boost in launch time. Current recommended value is: 525312

Dune binaries

I have made a dune service file for easier testing. Please download the binary file, and place it somewhere where the Dune can see it (NFS, USB, Internal HDD, SMB) and select it in the Dune GUI. It should say "Executing" then restart the GUI.

The effects of RAR streaming are only in memory, and are removed if you reset the Dune. (Binaries are copied to /tmp/, and no changes are made on the system).

dune_service_lundman_unrar-1.0.2.dsf Dune librarcy version 1.0.2.
dune_service_lundman_unrar.dsf Dune librarcy version 1.0.1.


Manual Execution

I have now reached a point where this appears to work. To test the libc replacement library, assuming you already have telnet access, download the binary and setup like:

cd /tmp
wget http://lundman.net/ftp/librarcy/librarcy.so.0.1.0
wget http://lundman.net/ftp/librarcy/unrar
chmod 755 unrar
killall shell root
export LD_LIBRARY_PATH=/tango/firmware/lib
cd /
env LD_PRELOAD=/tmp/librarcy.so.0.1.0 firmware/bin/root &

NMT Manual Execution

cd /tmp
wget http://lundman.net/ftp/librarcy/librarcy.so.0.1.0
wget http://lundman.net/ftp/librarcy/unrar
chmod 755 unrar
killall sybhttpd gaya
cd /opt/sybhttpd
env LD_PRELOAD=/tmp/librarcy.so.0.1.0 ./sybhttpd /opt/sybhttpd &
export LIBRARCY_BUFSIZE=525312
env LD_PRELOAD=/tmp/librarcy.so.0.1.0 gaya


If you enabled debug, it will be sent to stdout.


[1] I note the SMP Libraries handles HTTP:// URLs internally, so possible could exploit this to play remote media.

Changelog

1.0.3:

* Added buffer support for NMT platform that lseek()s far too much
* cache buffer returned partial buffers, not acceptable to SMP863x.

1.0.2:

* d_reclen is not strlen(d_name) apparently. Fixed.
* we would return cache=NULL from findfile sometimes, causing core.
* add unlink to interposed functions, so we can delete directories much easier

1.0.1:

* Stopped opendir()s inside opendir() from causing a rescan for RARs. (Common way to get directory size)
* Small-skips forwards are not handled by reading and discarding bytes.