2011-11-11, 00:33
I wrote this guide for having a minimal xbmc system based on Ubuntu minimal. Please note that I really recommend and support with donations the OpenELEC project which provides a clean, simple minimal system with blazing fast boot-times. This guide is for people who want to have more control over their system and want an Ubuntu based minimal system with the advantage of the Ubuntu package system.
Since my last guide a lot of great improvements were made in the Linux Kernel and Ubuntu which result an almost perfect htpc experience on Intel Platforms (tested on Sandy Bridge, but probably works on first gen Core i3, i5 and the upcoming Ivy Bridge)
Warning: Please don't combine my guides because it could cause problems and confusion. Use this guide only on a clean system. THIS will be the guide, what I'll always update with the new stuff if they will be available. Also note that I am NOT using the xorg edgers ppa here. The reason is that mesa 7.12 has some glsl problems which cause color distortions in xbmc.
Let me thank the Intel developers who are really devoted to have perfect open source support for their hardware.
What works:
Smooth VAAPI acceleration for mpeg2, h264, vc1
Auto refresh rate and smoothvideo function out of the box
ProjectM with > 60fps
Shader based HQ upscalers
Multichannel LPCM sound (with a workaround)
Incredibly fast Suspend - resume
VAAPI Deinterlacing (experimental)
What is not working yet:
Nothing which does not have a solution
So let's get to the steps:
1. Install OS
Get the netboot image for Ubuntu Oneiric 11.11 from here.
Burn, choose Command-line-install and use xbmc for username.
2. Install basic packages
After reboot, install ssh so you can continue work with Putty (for win) or with the "ssh -l xbmc your.IP.address" from a linux terminal. Also we install py-properties to easy add ppas. But before you ca do it remotely you need to install these packages. So get a terminal with crtl+alt+f1, than
Let's install some basic packages:
Let's add xbmc user to important groups than reboot
Now we will set the system that we can run Xorg without root privilages.
Note that Intel EDID parsing for CEA Short Video Descriptors is still not ready, although a patch is available here, but this is not in mainline kernel yet. So we need to manually add the standard HDTV modes if they were in the CEA section of the EDID data.
Let's get a working xorg.conf now. Note that this file is for a specific display system and includes custom modelines which only work on full 1080p HDTV-s. If you have a lower resolution TV, you have to adjust the settings with "sudo nano /etc/X11/xorg.conf" or just leave out this step (this will result a default resolution for your TV, but you will loose the ability to have the adjust refresh rate function working)
Luckily we don't have to compile anything now as Ubuntu Oneiric has support for libbluray and libva out of the box. We just have to install these packages and xbmc. Let's add xbmc ppa:
Now we can install xbmc and other needed packages.
After this you can check if libva installed ok. with a command "vainfo" you should see something like this after you start the X server with "startx" and use vainfo there:
Note that when you run startx on a minimal system only an xterm terminal shows on your top-left corner of screen. You have to make it active with a mouse click. If you can't see it, you can try to adjust your TV's overscan settings.
Please verify that your output is HDMI2 (like at my case) because i created the xorg.conf file for that. To check, run the X server and than run:
If it is not HDMI2 at your system, you have to edit the downloaded xorg.conf with
3. Various settings, autostart xbmc
For autostart xbmc we create an upstart init script:
In alsamixer unmute the spdif devices. Than we store this setting.
Let's install lirc. After that we need to create an udev rule to enable remotes to wakeup the machine. I created an udev rule that contains most of the remotes' Vendor ID and Product ID. I used the kernel driver database and some info from OpenELEC's udev rule. If your remote is not listed you can check the Ids with lsusb. After that add the Ids to the udev rule file. I'd be glad if you can write me the ones which are not included in my rules file so i can add them later.
Also we need to enable the USB hubs to wake up the machine. I made this in the init script xbmc.conf where we enable all USBx, EUSB, CIRx ports. You can check your remote ID with lsusb. You get something like this:
Note that for MCE remote you have to choose "Windows Media Center Transceivers" after choose none, when install lirc.
To grant permission for user xbmc to do suspend, reboot, mount, eject etc:
After reboot you should be able to use xbmc.
4. Some remarks and experiences
For suspend to work you might need a BIOS upgrade. I had problems with some boards, some worked out of the box.
You can always start (and stop) xbmc even remotely with
Multichannel lpcm only works with a workaround. There is already a mainline kernel patch that enables ELD parsing from EDID data which automatically checks your av receiver capabilities. Here is the patch that implements this functionality. It will be included in the 3.2 Kernel release and in Ubuntu 12.04 LTS.
There is a workaround until automatic eld parsing works, that triggers the available soundmodes manually. Just insert this into the /etc/init/xbmc.conf upstart script at the end of the "pre-start script" section (you might have to tune the values to your available configuration):
vc1 decoding only works in Oneiric. If you partially testing this guide with Natty installed, you won't be able to decode vc1 files properly.
The guide was tested on a H67 motherboard and a core i5-2500K CPU.
5. VAAPI DEINTERLACING
This is experimental. We need to install libva and intel vaapi driver from the vaapi-ext branch for that.
Also you need to install xbmc > git 10.01.2011. Eden beta2 will already have it.
After you installed/compiled the needed xbmc version do the following:
That is it. The last line should show the version 1.0.17-pre1
Restart xbmc. Play a file with vaapi, choose deinterlacing on, deinterlacer: bob.
Since my last guide a lot of great improvements were made in the Linux Kernel and Ubuntu which result an almost perfect htpc experience on Intel Platforms (tested on Sandy Bridge, but probably works on first gen Core i3, i5 and the upcoming Ivy Bridge)
Warning: Please don't combine my guides because it could cause problems and confusion. Use this guide only on a clean system. THIS will be the guide, what I'll always update with the new stuff if they will be available. Also note that I am NOT using the xorg edgers ppa here. The reason is that mesa 7.12 has some glsl problems which cause color distortions in xbmc.
Let me thank the Intel developers who are really devoted to have perfect open source support for their hardware.
What works:
Smooth VAAPI acceleration for mpeg2, h264, vc1
Auto refresh rate and smoothvideo function out of the box
ProjectM with > 60fps
Shader based HQ upscalers
Multichannel LPCM sound (with a workaround)
Incredibly fast Suspend - resume
VAAPI Deinterlacing (experimental)
What is not working yet:
Nothing which does not have a solution
So let's get to the steps:
1. Install OS
Get the netboot image for Ubuntu Oneiric 11.11 from here.
Burn, choose Command-line-install and use xbmc for username.
2. Install basic packages
After reboot, install ssh so you can continue work with Putty (for win) or with the "ssh -l xbmc your.IP.address" from a linux terminal. Also we install py-properties to easy add ppas. But before you ca do it remotely you need to install these packages. So get a terminal with crtl+alt+f1, than
Code:
sudo apt-get update
sudo apt-get upgrade
sudo reboot
sudo apt-get install ssh python-software-properties
Let's install some basic packages:
Code:
sudo apt-get install udisks upower xorg alsa-utils mesa-utils
Let's add xbmc user to important groups than reboot
Code:
sudo adduser xbmc video
sudo adduser xbmc audio
sudo reboot
Now we will set the system that we can run Xorg without root privilages.
Code:
sudo dpkg-reconfigure x11-common
Note that Intel EDID parsing for CEA Short Video Descriptors is still not ready, although a patch is available here, but this is not in mainline kernel yet. So we need to manually add the standard HDTV modes if they were in the CEA section of the EDID data.
Let's get a working xorg.conf now. Note that this file is for a specific display system and includes custom modelines which only work on full 1080p HDTV-s. If you have a lower resolution TV, you have to adjust the settings with "sudo nano /etc/X11/xorg.conf" or just leave out this step (this will result a default resolution for your TV, but you will loose the ability to have the adjust refresh rate function working)
Code:
sudo wget http://paste.kde.org/6966/raw/ -O /etc/X11/xorg.conf
Luckily we don't have to compile anything now as Ubuntu Oneiric has support for libbluray and libva out of the box. We just have to install these packages and xbmc. Let's add xbmc ppa:
Code:
sudo add-apt-repository ppa:team-xbmc/unstable
sudo add-apt-repository ppa:pulse-eight/libcec
Now we can install xbmc and other needed packages.
Code:
sudo apt-get update
sudo apt-get install libcec xbmc libbluray1 i965-va-driver vainfo libmad0 gtk2-engines-pixbuf
After this you can check if libva installed ok. with a command "vainfo" you should see something like this after you start the X server with "startx" and use vainfo there:
Code:
vainfo: VA API version: 0.32
vainfo: Driver version: i965 Driver 0.1
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Baseline : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
Note that when you run startx on a minimal system only an xterm terminal shows on your top-left corner of screen. You have to make it active with a mouse click. If you can't see it, you can try to adjust your TV's overscan settings.
Please verify that your output is HDMI2 (like at my case) because i created the xorg.conf file for that. To check, run the X server and than run:
Code:
export DISPLAY=:0 # if you are doing this using ssh
xrandr -q
If it is not HDMI2 at your system, you have to edit the downloaded xorg.conf with
Code:
sudo nano /etc/X11/xorg.conf
3. Various settings, autostart xbmc
For autostart xbmc we create an upstart init script:
Code:
sudo wget http://pastebin.com/raw.php?i=z2Ya7sAh -O /etc/init/xbmc.conf
sudo ln -s /lib/init/upstart-job /etc/init.d/xbmc
sudo wget http://paste.kde.org/7022/raw/ -O /usr/bin/runXBMC
sudo chmod a+x /usr/bin/runXBMC
In alsamixer unmute the spdif devices. Than we store this setting.
Code:
alsamixer
sudo alsactl store
Let's install lirc. After that we need to create an udev rule to enable remotes to wakeup the machine. I created an udev rule that contains most of the remotes' Vendor ID and Product ID. I used the kernel driver database and some info from OpenELEC's udev rule. If your remote is not listed you can check the Ids with lsusb. After that add the Ids to the udev rule file. I'd be glad if you can write me the ones which are not included in my rules file so i can add them later.
Also we need to enable the USB hubs to wake up the machine. I made this in the init script xbmc.conf where we enable all USBx, EUSB, CIRx ports. You can check your remote ID with lsusb. You get something like this:
Code:
Bus 001 Device 003: ID 1784:0008 TopSeed Technology Corp. eHome Infrared Transceiver
Code:
sudo apt-get install lirc
sudo wget http://pastebin.com/raw.php?i=A7aCKkMa -O /etc/udev/rules.d/90-enable-remote-wakeup.rules
sudo reboot
Note that for MCE remote you have to choose "Windows Media Center Transceivers" after choose none, when install lirc.
To grant permission for user xbmc to do suspend, reboot, mount, eject etc:
Code:
sudo wget http://paste.kde.org/200066/raw/ -O /etc/polkit-1/localauthority/50-local.d/xbmc_rule.pkla
After reboot you should be able to use xbmc.
4. Some remarks and experiences
For suspend to work you might need a BIOS upgrade. I had problems with some boards, some worked out of the box.
You can always start (and stop) xbmc even remotely with
Code:
sudo start xbmc
sudo stop xbmc
Multichannel lpcm only works with a workaround. There is already a mainline kernel patch that enables ELD parsing from EDID data which automatically checks your av receiver capabilities. Here is the patch that implements this functionality. It will be included in the 3.2 Kernel release and in Ubuntu 12.04 LTS.
There is a workaround until automatic eld parsing works, that triggers the available soundmodes manually. Just insert this into the /etc/init/xbmc.conf upstart script at the end of the "pre-start script" section (you might have to tune the values to your available configuration):
Code:
echo sad0_rates 0x1ee0 > /proc/asound/card0/eld#3.0
echo speakers 0x4f > /proc/asound/card0/eld#3.0
echo sad0_channels 8 > /proc/asound/card0/eld#3.0
echo sad0_bits 0xe0000 > /proc/asound/card0/eld#3.0
vc1 decoding only works in Oneiric. If you partially testing this guide with Natty installed, you won't be able to decode vc1 files properly.
The guide was tested on a H67 motherboard and a core i5-2500K CPU.
5. VAAPI DEINTERLACING
This is experimental. We need to install libva and intel vaapi driver from the vaapi-ext branch for that.
Also you need to install xbmc > git 10.01.2011. Eden beta2 will already have it.
After you installed/compiled the needed xbmc version do the following:
Code:
cd ~
mkdir Builds
cd Builds
sudo apt-get build-dep libva1 i965-va-driver
git clone git://anongit.freedesktop.org/vaapi/libva
cd libva
git checkout vaapi-ext
./autogen.sh --prefix=/usr
make
sudo make install
cd..
git clone git://anongit.freedesktop.org/vaapi/intel-driver
cd intel-driver
git checkout vaapi-ext
wget http://paste.kde.org/184874/raw/ -O ./increase_micro_version.patch
autoreconf -v --install
patch -p1 < ./increase_micro_version.patch
./configure --prefix=/usr
make
sudo make install
vainfo |grep i965
That is it. The last line should show the version 1.0.17-pre1
Restart xbmc. Play a file with vaapi, choose deinterlacing on, deinterlacer: bob.