Compile xbmc with broadcom crystalhd support on linux

Broadcom CrystalHD is a Mini-PCIe expansioncard to make your box do hardware decoding of HD video material (h264, vc1++)
Got a old AppleTV which you dont use? Buy a CrystalHD chip on ebay for 30 dollars, and it will play 1080p for you :)

Install Ubuntu 8.04 Hardy on your box, if you are going to use an AppleTV you can follow the guide here:
http://dingleberry.me/2009/11/ubuntu-karmic-koala-on-appletv-with-broadcom-crystal-hd-decoder/

Download the xbmc crystalhd branch and the lib directory from the xdmx branch which has the necessary crystalhd include files:
svn co -r 22347 https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/xdmx/XBMC/xbmc/lib/
svn co -r 25101 https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/crystalhd

prepare the system for crystalhd support:
mkdir /usr/include/crystalhd
cp -a lib/crystalhd/include/* /usr/include/crystalhd
cp /usr/include/crystalhd/windows/bc_drv_if.h /usr/include/crystalhd/bc_ldil_if.h

Edit /usr/include/crystalhd/bc_dts_types.h and comment out line 59 so it looks like this:
//typedef void VOID;

Copy the crystalhd include files to the crystalhd branch source:
cp -a /usr/include/crystalhd crystalhd/xbmc/lib/

Download the bcm70012 source and build the module:
wget http://www.norco.net.cn/UpLoadFile/Driver/bcm70012_linux_01142009.rar
unrar e bcm70012_linux_01142009.rar
tar xf bcm70012_linux_01142009
dpkg -i bcm70012kmod-source_0.9.30_all.deb
apt-get -f install
dpkg -i bcm70012kmod-source_0.9.30_all.deb
cd /usr/src/
m-a -t a-i bcm70012kmod
cd -

Install the gstreamer plugin from the HP mini 110 distro (the file came with the driver download in the step above)
dpkg -i --force-all gst-broadcom-70012_0.9.30_lpia.deb

Now follow the steps from the README.ubuntu file inside the crystalhd source:
sudo aptitude install subversion make g++ gcc gawk pmount libtool nasm automake cmake gperf unzip bison libsdl-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libfribidi-dev liblzo2-dev libfreetype6-dev libsqlite3-dev libogg-dev libasound-dev python-sqlite libglew-dev libcurl3 libcurl4-openssl-dev x11proto-xinerama-dev libxinerama-dev libxrandr-dev libxrender-dev libmad0-dev libogg-dev libvorbis-dev libsmbclient-dev libmysqlclient-dev libpcre3-dev libdbus-1-dev libhal-dev libhal-storage-dev libjasper-dev libfontconfig-dev libbz2-dev libboost-dev libfaac-dev libenca-dev libxt-dev libxtst-dev libxmu-dev libpng-dev libjpeg-dev libpulse-dev mesa-utils libcdio-dev libsamplerate-dev libmms-dev libmpeg3-dev libfaad-dev libflac-dev libiso9660-dev libass-dev libssl-dev

On 8.04 and older versions, libmms is outdated and thus XBMC will not compile properly.
In this case you will have to manually compile the latest version.
wget "http://launchpad.net/libmms/trunk/0.4/+download/libmms-0.4.tar.gz"
tar zxvf libmms-0.4.tar.gz
cd libmms-0.4
./configure --prefix=/usr
make
sudo make install

After all deps has been installed and libmms has been compiled and installed you are ready to compile xbmc. cd to the crystalhd source and do:
./bootstrap
./configure
make
make install

Finito! :)

POST-install tweaks:
Enable Pixel Buffer Objects
Start xbmc without loading Gnome
And some more AppleTV specific stuff:
Set fixed cpu frequency
Various fixes for Ubuntu on ATV

Tags: , , , , , , , , , , , , , , ,

Ubuntu Karmic Koala on AppleTV with Broadcom Crystal HD decoder

UPDATE! – Karmic Koala uses a newer kernel which wont make the bcm driver work, use Ubuntu 8.04 Hardy in step 4, and your driver will work :) Confirmed 1080p playback on Apple TV with hardy! :D

1. build patchstick with http://code.google.com/p/atvusb-creator/
2. boot atv with patchstick
3. Partition sda as per instructions:

http://code.google.com/p/atv-bootloader/wiki/PartitioningLinux

4. Download netboot http://no.archive.ubuntu.com/ubuntu/dists/karmic/main/installer-i386/current/images/netboot/netboot.tar.gz
4. Run netboot as per instructions under Netboot Install:

http://code.google.com/p/atv-bootloader/wiki/BootingLiveCD

5. Install karmic with sda4 = / and sda5 = swap
5.1 Remember to select sda4 as root filesystem with ext3 NOT ext4
6. Modify boot_linux.sh with something like the following:

mount /dev/sda4 /tmp/
kexec --load /tmp/vmlinuz --initrd=/tmp/initrd.img --command-line="root=/dev/sda4 initrd=initrd.img vga=normal vesa video=vesafb"
umount /tmp/
kexec -e

7. WORKING UBUNTU WOOHOO

8. Download linux bcm70012 from:

http://www.norco.net.cn/DownNews_Show.asp?ID=215

Making system ready:
aptitude install build-essential unrar
unrar e bcm70012_linux_01142009.rar
cd bcm70012_linux_01142009
mv bcm70012_linux_01142009 bcm70012_linux_01142009.tar
tar xf bcm70012_linux_01142009.tar
dpkg -i bcm70012kmod-source_0.9.30_all.deb
apt-get -f install
dpkg -i bcm70012kmod-source_0.9.30_all.deb
cd /usr/src/
m-a -t a-i bcm70012kmod
cd -
dpkg -i --force-all gst-broadcom-70012_0.9.30_lpia.deb

22. WORKING bcm70012 !! WOHOO

Tags: , , , , , , , , , , ,

Play .rar files with mplayer v2.0: now with seeking

It really started bothering me that its impossible to seek in media files when using my previous playrar script:

Now im writing a bit more complex version which supports seeking!

I got a tips about using rarfs, a FUSE based filesystem mounter. What it does is making your .rar archives into a virtual filesystem. (like the .rar archive really isnt a archive, but real files on a filesystem)
This makes your media files seekable. (mkv,avi,iso(vob), younameit)

Firstly you need to install rarfs on your system. You need to install some deps:
sudo apt-get install automake1.9 libfuse-dev subversion
When you have done this, you are ready to checkout the svn tree on sourceforge:
svn co https://rarfs.svn.sourceforge.net/svnroot/rarfs rarfs
cd rarfs/trunk/rarfs/
./configure && make && sudo make install

(seems here i got a error with doc/Makefile.in, borked release in trunk)
FIX: touch doc/Makefile.in
./configure
make
sudo make install
ls -l /usr/local/bin/rarfs

If it returned your file in /usr/local/bin/rarfs we are good to go!

Now we can mount a .rar file with the following command: rarfs bladdiblah.rar /tmp/rar
This seems a bit hard to type everytime you want to play a file, so we make a shellscript to fix this:
#!/bin/bash
RARFILE=$1
TMPDIR="/tmp/playrar/"
RARFS="/usr/local/bin/rarfs"
if [ ! -d /tmp/playrar ]; then
mkdir -p /tmp/playrar
fi
$RARFS $RARFILE $TMPDIR
mplayer -fs $TMPDIR/`ls $TMPDIR`
fusermount -u $TMPDIR

What this script does, is to mount the file, play the files inside the rar file, and then unmount the .rar archive.
You can easily wget this script: playrar.sh
Place it in $PATH and give it chmod +x playrar.sh (and change your media player as suited)

This howto was intended to Ubuntu users, but should be done on other linux distributions as well (maybe OS X as well?)

One step closer to easier movie playback :-)

Tags: , , ,

Over 3,2 gb RAM with Ubuntu Desktop 32-bit

Ubuntu Desktop kernel (generic/desktop) doesnt support PAE (Physical Address Extension)

To get PAE support and usage of more than 3,2 gb ram in 32bits kernelspace you have to install the server kernel:
sudo apt-get install linux-headers-server linux-image-server

Reboot, and whoops you can use all your RAM :)

The alternative would be to install a 64-bit kernel, but you probably wouldnt want this on a desktop because of restricted drivers mostly only support 32-bit (and e.x. multimedia codecs/flash doesnt have good 64-bit support)

Tags: , ,

iPhone 3G 3.0 OS Tethering on Ubuntu Linux 9.04 via Bluetooth

I have struggeled some with this shit until i came over a script called uit.sh:

http://us.cooperlees.com/download.php?F=uit.sh.gz

Download it, and do this to setup deps and config:
gunzip uit.sh.gz && chmod +x uit.sh && sudo ./uit.sh -i

After that just connect to your iphone tethering with:
sudo ./uit.sh -c

Disconnect:
sudo ./uit.sh -d

I had some problems getting connection refused, this was because i had turned of 3g to save battery.
So keep that 3g ON if you want tethering!
You may also place the script in PATH to have it globally available, just remember to run the script as root/sudo.

You may also get this to work with some fancy GUI SHIT like blueman, but i like terminal more.

“We gotta create a GUI, so we can trace the ip”:
http://www.youtube.com/v/ygB0ZviqXac

Goddamn Visual Basic haxx0rz…

Tags: , , , ,

Firefox is slow and crashes… ALL THE TIME!

I’ve recently become more and more and more and more and more and more annoyed with firefox. It is slow, it crashes (several times a day) and it is using ALOT of memory. This is ofcourse because of various plugins I added, but damnit – I need them! So what can you do if the plugins you so desperately need renders the browser itself unusable??? :S

YOU CREATE SEPARATE PROFILES!!!

I dont know why on gods green earth noone told me about this sooner..
You simply just add -P profilename to the firefox cmd. On my ubuntu the firefox launcher button had the following cmd:

“firefox %u”, now it looks like this: “firefox %u -P firebug -no-remote”
In the above example I’m launching the profile I named “firebug”. In this profile I installed firebug, firecookie and the Yslow plugins. The “normal” launcher button has the “-P default” option to launch my “regular” firefox install.

Additional firefox about:config adjustments i made:
1) Adjust the browser pipelining
1a) network.http.pipelining = true
1b) network.http.pipelining.maxrequests = 10
1c) network.http.proxy.pipelining = true
2) Turn off ALL caching
2a) browser.cache.disk.enable = false
2b) browser.cache.memory.enable = false
2c) browser.cache.offline.enable = false
2d) network.http.use-cache = false

Be warned that with all caching turned off, sites that use for instance alot of tiny tiny “see-through” images to adjust their html layout AND using for instance mod-evasive in apache will block your ass for DOS attacking them. (as you will be requesting that little .gif ALOT of times over a very short period of time)

Tags: , , , , , , , , ,