cross-compile ffmpeg for ReadyNAS NV+ (SPARC) pseudo how-to ----------------------------------------------------------- v0.01 (2012-01-10) Because I needed ffmpeg and I couldn't find it, I had to figure out how to compile it for myself. I am not an experienced programmer, that's why these instructions are by far not perfect and I do not know a lot better. In addition, I tried several ways and I didn't start over just to test these instructions; therefore there might be some steps missing or not working. Overview: - install a sarge chroot - get the chroot ready - add the readynas cross-compiler - get the ffmpeg sources and edit ./configure - compile - transfer and install Details: Get your hands on a Debian installation. This can be a real or a virtual machine, I think it is mandatory to have a x86 architecture for the ReadyNAS cross-compiler. 1) install a sarge chroot ------------------------- - Install debootstrap and chroot with: apt-get install debootstrap coreutils - Make a new directory "debian-sarge-cross-chroot": mkdir debian-sarge-cross-chroot - Install Debian in this directory: debootstrap --arch i386 sarge debian-sarge-cross-chroot http://archive.debian.org/debian - Enter the chroot: chroot debian-sarge-cross-chroot 2) get the chroot ready ----------------------- - Edit the package sources: nano /etc/apt/sources.list ...and add sarge-backports to list of sources (between *snip*): *snip*--------------------------------------*snip* deb-src http://archive.debian.org/debian sarge main contrib non-free deb http://archive.debian.org/backports.org sarge-backports main contrib non-free deb-src http://archive.debian.org/backports.org sarge-backports main contrib non-free *snip*--------------------------------------*snip* (Do not delete the existing line, just add the above lines.) ...save and exit nano (CTRL-X). - Install some packages: apt-get update apt-get install build-essential less locales wget apt-get -t sarge-backports install make texi2html - Add "LC_ALL=en_US.UTF-8" to /etc/environment if nothing for LC_ALL is there. - Exit and reenter the chroot: exit chroot debian-sarge-cross-chroot 3) add the readynas cross-compiler to your chroot ------------------------------------------------- - Get the ReadyNAS cross-compiler: cd /root wget http://www.readynas.com/download/development/readynas-cross-3.3.5.tar.gz - Unpack: cd / tar -xvvzf root/readynas-cross-3.3.5.tar.gz - Since I do not know how to tell ffmpeg to use the right compiler, I cheated like this: cd /usr/bin mkdir x86 for prg in `which $(ls -1 /usr/bin/sparc-linux-* | sed -e "s%^/usr/bin/sparc-linux-%%g")`; do mv -v "$prg" x86/. ; done for prg in $(ls -1 sparc-linux-* | sed -e "s%^sparc-linux-%%g"); do ln -vs "sparc-linux-$prg" "$prg" ; done ... this moves the original compiler files away and links the sparc-cross-compiler ones in place. Check the result: ls -la | grep sparc resp. gcc --version ...should reveal "gcc (GCC) 3.3.5 (Infrant 3.3.5-1)" (You may undo this with: cd /usr/bin ; for prg in $(ls -1 sparc-linux-* | sed -e "s%^sparc-linux-%%g"); do rm -v "$prg" ; done) 4) get the ffmpeg sources and edit ./configure ---------------------------------------------- - You can't use wget to get the sources. Point your browser to http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=HEAD;sf=tgz and download the file. Transfer it inside your chroot folder debian-sarge-cross-chroot/usr/src - Get back into your terminal and change to that location: cd /usr/src - Unpack: tar -xvvzf ffmpeg-HEAD-dd3ca3ea.tar.gz (Your download might be newer and thus named differently.) - Enter the newly created directory: cd ffmpeg-HEAD-dd3ca3ea - Unfortunately the configure script compiles for ultrasparc instead of v8 if given the architecture sparc. I hacked the configure script to not do this. It is not the correct way I did it, but it works. Create the patch file: nano configure.diff Add the following lines (between *snip*): *snip*--------------------------------------*snip* --- configure.orig 2012-01-10 02:50:41.000000000 +0000 +++ configure 2012-01-10 13:41:38.519916764 +0000 @@ -2448,6 +2448,12 @@ sparc64) cpuflags="-mcpu=v9" ;; + v7) + cpuflags="-mcpu=v7" + ;; + v8) + cpuflags="-mcpu=v8" + ;; esac elif enabled arm; then @@ -2891,7 +2897,7 @@ elif enabled sparc; then enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc && - add_cflags -mcpu=ultrasparc -mtune=ultrasparc + add_cflags -mcpu=v8 -mtune=v8 elif enabled x86; then *snip*--------------------------------------*snip* (I'm not sure about --disable-vis switch and the above change, maybe this is unnecessary.) - Save and exit nano (CTRL-X). - Apply the patch: patch -p0 configure configure.diff 5) compile ---------- - Run the configure script: ./configure --logfile=./build.log --prefix=/usr/local/lib/ffmpeg --arch=sparc --cpu=v8 --disable-vis --target-os=linux --enable-cross-compile - Run make: make ...wait and then run: make install You will find your newly compiled ffmpeg in /usr/local/lib/ffmpeg. - Build an archive of your compilation: tar -cvvzf /usr/src/ffmpeg-HEAD-dd3ca3ea-sparcv8.tar.gz /usr/local/lib/ffmpeg cd .. 6) transfer and install ----------------------- - Tarnsfer your archive file to your ReadyNAS: scp ffmpeg-HEAD-dd3ca3ea-sparcv8.tar.gz myreadynas:/root - SSH into your ReadyNAS and install: cd / tar -xvvzf root/ffmpeg-HEAD-dd3ca3ea-sparcv8.tar.gz - Put a link in /usr/local/bin for all executables: cd /usr/local/bin ln -s ../lib/ffmpeg/bin/* That's it. *sigh* Good luck, Adrian Zaugg . You can download the binary from http://ente.limmat.ch/ftp/pub/readynas/ffmpeg/. v0.02 (2012-01-19)