Posted by Utumno on Tue 21 Feb 2006 at 09:54
So you switched to the AMD64 architecture, installed the ‘pure64′ flavour of Debian on it? Well, get prepared for some problems: no flashplugin for Firefox, no win32 codecs for MPlayer, no OpenOffice.
I couldn't care less for the flashplugin, OpenOffice I've got on my laptop and I hardly use it, but a complete, custom-compiled MPlayer is a must. Here's a way to install it along with the win32 and RealPlayer codecs, LIVE.com streaming support, and more.
One way - they say - is to install the ia32-libs, but I wanted to be all clean about it and use the arguably harder ‘chroot' method. This way, one can achiev a modular, easily upgradeble system. Both 64- and 32- bit apps and separated from each other, and all users can - compeletly transparently - call the 32-bit apps from within their 64-bit text consoles and DEs.
Minimal Debian system, although I ended up with about 400 MB of stuff in it.
1.1) Create a new empty directory:
$ mkdir /var/sid-386-chroot
1.2) Install Debian sid, i386 version, base system into it:
$ debootstrap -arch i386 sid /var/sid-386-chroot http://ftp.debian.org/debian/
That will pull quite a few packages. ~ 15 minutes on my system.
1.3) Add the library path of your chroot into your /etc/ld.so.conf: ( I mean your original /etc/ld.so.conf, not the one from the chroot )
/usr/X11R6/lib
# chroot i386 system libs
/var/sid-386-chroot/lib
/var/sid-386-chroot/usr/lib
/var/sid-386-chroot/usr/X11R6/lib
/var/sid-386-chroot/usr/local/lib
1.4) You also need a link to your 32bit linker in the /lib path:
$ cd /lib
$ ln -s /var/sid-386-chroot/lib/ld-linux.so.2 ld-linux.so.2
1.5) Now run ldconfig to update your linker's cache:
$ ldconfig
1.6) To run an application inside the chroot you will need some parts of your 64bit system tree inside the chroot. This can be achieved with a bind mount. In this example we will bind /tmp to the chroot for the X11 sockets which are in /tmp, and bind /home to access the home directories from within the chroot. You may also want to mount the /proc and /sys filesystems within the chroot. Edit your fstab and add the required paths:
# ia32 chroot
/home /var/sid-386-chroot/home none bind 0 0
/tmp /var/sid-386-chroot/tmp none bind 0 0
proc /var/sid-386-chroot/proc proc defaults 0 0
1.7) Then mount them:
$ mount /var/sid-386-chroot/home
$ mount /var/sid-386-chroot/tmp
$ mount /var/sid-386-chroot/proc
1.8) You will also need to set up the relevant users in the chroot. Copy your /etc/passwd, /etc/shadow and /etc/group files to the chroot.
1.9) At this point you should be able to run applications within the chroot. Change to your chroot (you must be root to do this):
$ chroot /var/sid-386-chroot
1.10) Run something:
$ cat /etc/apt/sources.list
2.1) ‘chroot' to your chroot as root and install quite a few packages we're gonna need:
$ apt-get install libogg0 libogg-dev libvorbis0a libvorbis-dev vorbis-tools libpng12-0 libpng12-dev liblogfile-rotate-perl libconfhelper-perl debhelper fakeroot gcc g++ libgtk1.2 libgtk1.2-dev svgalibg1 svgalibg1-dev libsdl1.2-dev libaa1 libaa1-dev libxv1 libxv-dev
2.2) Also, while at it, install some other packages that I always find useful:
$ apt-get install vim bzip2
2.3) Perl is going to spit out with errors about locale being unset. Shut it up with adding export LC_ALL=C line to /root/.bashrc and source the file:
$ . ~/.bashrc
2.4) Now, get out of the chroot (exit) and download MPlayer
's sources:
$ cd /home/leszek/
$ mkdir mplayer; cd mplayer
$ cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer login
Password: [hit enter]
cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer co -P main
2.5) download FFMPEG's sources:
$ cvs -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg login
Password: [hit enter]
$ cvs -z3 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg
A directory named ‘ffmpeg' with subdirectories named ‘libavcodec' and ‘libavutil' inside will be created. Copy (symbolic linking does NOT suffice) these 2 subdirectories into the MPlayer source tree.
2.6) Create a directory where we're gonna keep our binary codecs:
$ mkdir /usr/local/lib/codecs
2.6) Get Win32 codecs: essential-YYYYMMDD.tar.bz2 - Grab the latest version "essential codecs package" from Mplayer HQ Download
2.7) Unpack and move the codecs to the right directory:
$ mv essential-YYYYMMDD.tar.bz2 /usr/local/lib
$ cd /usr/local/lib
$ tar xjvf essential-YYYYMMDD.tar.bz2
$ mv essential-YYYYMMDD/* codecs
$ rm -rf essential-YYYYMMDD*
2.8) Same story with the LIVE streaming codecs: get them from here
2.9) Unpack and install:
$ cd /usr/local/lib
$ tar -xvzf live.2005.06.16.tar.gz
$ cd live/
$ ./genMakefiles linux
$ make
2.10) QuickTime codecs: download QuickTime DLL pack from http://www.mplayerhq.hu/MPlayer/releases/codecs/
Unpack and copy them to /usr/local/lib/codecs.
2.11) Download Real codecs from http://www.mplayerhq.hu/MPlayer/releases/codecs/ and extract them to the /usr/local/lib/codecs directory.
2.12) Get MPlayer's UserConf from here, become your user, copy it to your home directory and unpack:
$ tar -xvvf mplayer-user-conf.tar
This will create the ~/.mplayer directory including a skin (neutron), arial size 18 font, and config files.
In line 27 of the ~/.mplayer/gui.conf file, change: font_name = "/home/lyz/.mplayer/font/font.desc" to reflect your username.
2.13) Move MPlayer's sources to a usual place:
$ mv /home/leszek/mplayer/ /usr/src/
$ cd /usr/src/mplayer/main/
2.14) Compile:
$ DEB_BUILD_OPTIONS="-disable-runtime-cpudetection -enable-gui -enable-menu -disable-rtc -enable-live -with-livelibdir=/usr/local/lib/live" fakeroot debian/rules binary
2.15) After some 8 minutes ( on my Sempron 3000+ with 512 DDR400 and a SATA HD ) a package mplayer_1.0cvs_i386.deb will appear in /usr/src/mplayer. Install it:
$ dpkg -i mplayer_1.0cvs_i386.deb
Voilla! You can now run your mplayer from within your 32-bit chroot. Dont forget to set Video Output and Audio Output to good values ( Xv and ESD in my case ).
3.1) Get out of the chroot and install the dchroot package:
$ apt-get install dchroot
3.2) Edit /etc/dchroot.conf:
# sid386 chroot
sid386 /var/sid-386-chroot
3.3) Now you should be able to run commands inside the chroot as normal user:
$ dchroot -c sid386 -d gmplayer
3.4) Add a wrapper script to ease things and be able to call ‘mplayer' and ‘gmplayer' transparently from the command line: in /usr/local/bin create the following script, name it ‘do_chroot' and chmod it to 755:
#!/bin/sh
ARGS=""
for i in "$@" ; do
ARGS="$ARGS ‘$i'"
done
exec dchroot -c sid386 -d -q "`basename $0`" "$ARGS"
3.5) Last step : symbolic links to our script:
$ cd /usr/local/bin
$ ln -s do_dchroot mplayer
$ ln -s do_dchroot gmplayer
$ ln -s do_dchroot mencoder
a) MPlayer compilation and setup:
b) chroot setup:
This article can be found online at the Debian Administration website at the following bookmarkable URL:
This article is copyright 2006 Utumno - please ask for permission to republish or translate.