XBMC / Intel Atom NVIDIA/ION/ION2/GT520 / Gentoo Linux

Third revision. This article will guide you through the setup of XBMC using Gentoo Linux. Target group is now all machines using Intel Atom CPU’s coupled with a Nvidia GPU. I do believe that this guide will work on most machines as differences between manufactures are subtle and they will all use the exact same Nvidia driver. Even if not using an Intel Atom/Nvidia machine  there will be bit and pieces which can be used on other distributions as well. Hope someone will find this helpful. Please note that Gentoo Linux is not for the impatient, neither is this guide. If you just want to get XBMC up and running quickly i recommend trying Openelec which installs in minutes and runs great.

You will need a system with Gentoo installed. A good place to start is the general install instructions for Gentoo which can be found on the Gentoo homepage:


This may at first seem a bit hard but it really isn’t. Make a cup of coffee and give it a try. When your first Gentoo install successfully boots, you will smile. I promise. If doing a new install please read the next section first. This can save you a few hours compile time. If already running Gentoo (cheers) jump to the XBMC setup.

Gentoo Install:
I did spend some time configuring my Kernel. This can save you a lot of time when getting your system up and running without using gentoo genkernel which will compile modules for every thinkable combination of hardware. Note that the profile used on my machine is profile 1 (default/linux/amd64/10.0) which also is the default system profile. This is a minimal profile. When you have reached section: “7. Configuring the Kernel”  in the Gentoo handbook you can use these instructions to compile your first kernel. After this jump to Section “8. Configuring your System”

emerge vanilla-sources
cd /usr/src/linux
wget http://eth0.dk/files/atom-64bit-kernel-config-3.6.x
mv atom-64bit-kernel-config-3.6.x .config
make -j4
make modules_install
cp arch/x86_64/boot/bzImage /boot/kernel-3.6.11

Above commands will pull in latest Gentoo marked stable kernel sources without Gentoo Patches. Replace vanilla-sources with gentoo-sources to include Gentoo Patches. Unless you have specific needs I do recommend staying on Gentoo marked stable. Updates in kernels are very frequent (across all branches) and following stable kernels from www.kernel.org requires system reboot about every week. If you really want bleeding edge sources issue following command:

echo "sys-kernel/vanilla-sources" >> /etc/portage/package.keywords

More info about gentoo-sources can be found on packages.gentoo.org. When copying the bzImage you should of course change filename to reflect the downloaded kernel version. It may differ from the creation time of this guide. At the bottom of this guide are kernel configs for 3.6.x and 3.7.x Using these kernel configs an initrd image is not needed. When done, continue to section to Section “8. Configuring your System”

You now hopefully have Gentoo installed and ready to install and configure XBMC.

XBMC Setup
With this setup we will use slim as display manager. It is lightweight,fast and does nothing more than we need to, which is to start XBMC in a X server.

First we need to add a user to run XBMC. This is a security measure as nothing not strictly needed should be run as the root user. This is to prevent evil attackers from gaining root privileges should any service be compromised.

useradd -m -G audio,cdrom,video,cdrw,usb,users,uucp xbmc

You may want to add a password to xbmc user as well.

passwd xbmc

Next we need to enable the correct use flags. This is my entire /etc/portage/make.conf. The important use flags for XBMC is vdpau, opengl and alsa. Video card should be set to nvidia. We do include alsa,opengl and vdpau as global use flags as i assume that every package installed should make use of those features. Threads use flag is included for performance. Cups (Common Unix Printing System) and ipv6 has been disabled just for good measure.

CFLAGS="-march=native -O2 -pipe"
USE="alsa mmx opengl sse sse2 threads vdpau threads -ipv6 -cups"


Next we move over to /etc/portage/package.use. One of Gentoo’s most powerful features. Build exactly what you need and not a bit more!  If this is a new install you will need to create the file

# { use flags for xbmc
media-tv/xbmc airplay webserver avahi
media-libs/mesa g3dvl
media-libs/sdl-image gif jpeg png
media-libs/libsdl X
dev-libs/libxml2 python
net-dns/avahi dbus
x11-drivers/nvidia-drivers -tools acpi
# xbmc end }

Please notice that i did not enable the X flag globally but only for one package. This is simply done to not pull in non essential packages. The global X flag is NOT needed for Xbmc to run. This will save some space. Gotta love Gentoo 😉


emerge xbmc slim alsa-utils nvidia-drivers

This will take a while. A long while. About 5 hours. When done start by getting X server to use the newly installed nvidia-driver:

eselect opengl set 1
Switching to nvidia OpenGL interface... done

Edit /etc/slim.conf. Locate the line (line 37)

login_cmd exec /bin/bash -login /usr/share/slim/Xsession %session

Uncomment the line by adding # in front, and add these lines below.

#login_cmd exec /bin/bash -login /usr/share/slim/Xsession %session
login_cmd exec ~/.xinitrc
default_user xbmc
auto_login yes

Create the file .xinitrc in the homedir of the user running xbmc  (user xbmc which we added ealier)

echo "exec xbmc-standalone" > /home/xbmc/.xinitrc
chown xbmc.xbmc /home/xbmc/.xinitrc

Make sure that system can actually run the file.

chmod +x ./home/xbmc/xinitrc

Next edit /etc/conf.d/xdm


Next we need to configure the X server. When newly installed X does not have any config. It is possible to make a xorg.conf by using the provided utility nvidia-xconfig.


WARNING: Unable to locate/open X configuration file.

New X configuration file written to '/etc/X11/xorg.conf'

As seen it will create a xorg.conf if none is found. This config is sufficient to get X server up and running and even xbmc started. To test if stuff is working start up xdm.
This is optional 😉

/etc/init.d/xdm start

If all is good slim will launch XBMC. If you wish to use 24p mode for playing you need to edit /etc/X11/xorg.conf. As suggested in several guides it is not needed to manually add modelines. Locate /etc/X11/xorg.conf. At the bottom locate Section “Device” and replace everything below with this:

Section "Device"
Identifier "nvidia"
Driver "nvidia"
Option "DynamicTwinView" "False"
Option "NoFlip" "false"
Option "NoLogo" "true"
Option "ConnectToAcpid" "0"
Option "FlatPanelProperties" "Scaling = Native"
Option "ModeValidation" "NoVesaModes, NoXServerModes"
Option "HWCursor" "false"
# To put Xorg in debug mode change "false" to "true" in the line below:
Option "ModeDebug" "false"

Section "Screen"
Identifier "screen0"
Device "nvidia"
DefaultDepth 24
Option "ColorRange" "Full"
# Option "ColorRange" "Limited"
# Option "ColorSpace" "RGB"
# Option "ColorSpace" "YCbCr444"
SubSection "Display"
Depth 24

Next we move on to the sound config. This has given me a few grey hairs. Please comment if you have a more elegant solution. Note that even though all Atom machines are basically the same, differences between manufactures can often be seen in sound hardware. Settings below will work for AT5IONT-I and Asrock 152D/152B. ZOTAC ZBOX ID80 which uses the newer Intel Atom Cpu D2700 coupled with a Nvidia GT520 does not need changes to modprobe and uses hw:1,7.

pcm.!default {
type plug
slave {
pcm "hw:1,3"
options snd-hda-intel enable_msi=0 probe_mask=0xffff,0xfff2

You want to reboot here so that kernel can pick up the changes. When back run alsamixer and unmute your card.


Press F6 and select “HDA Nvidia” There should be only one entry: < S/PDIF > If it says MM your card is muted and you need to unmute it using key m. The MM should change to 00 and your card is unmuted. Next run /etc/init.d/alsasound start which will save the new mixer level. Oddly enough you do not need to add alsasound to startup.

/etc/init.d/alsasound start

Then we are all set. If you ever need to use passthrough in XBMC (av recievers etc) set it to custom and input hw:1,3 or whatever is appropiate for your machine. This works 🙂

To start xbmc (slim) type

/etc/init.d/xdm start

To have XBMC launched when system is booted you need to add xdm to the default runlevel

rc-update add xdm default

You want to have avahi to start at boot to allow airplay content to be recieved:

rc-update add avahi-daemon default

Congratulations you are all done. Enjoy.

Optional lirc support
The included kernel config has support for the built in ir reciever featured on the Asrock 152b. Also compatible is HFX Vista GP Remote Control Cheap and somewhat stronger than the built in receiver in Asrock 152D/152B. A small note. The ir receiver used on the Asrock 152D/152B is a Nuvoton w836x7hg Infrared Remote Transceiver.

emerge lirc

When done create /etc/lirc/lircd.conf and put in the following content:

include "/usr/share/lirc/remotes/mceusb/lircd.conf.mceusb"

Optional Lm_sensors support
Most systems have some sensors support for reading out temperature from the running systems. Ie. The Asus AT5IONT-I have two readings which in Bios are called GPU and CPU.
The Asrock 152D/152B also have two which in Bios are called CPU and Motherboard temperature. Asus AT5IONT-I uses asus_atk0110 modules chip to monitor and Asrock 152B uses w83627ehf. Both are enabled in my kernel config.

emerge lm_sensors
rc-update add lm_sensors default

Optional install XBMC from source
There could be several reasons you would wish to do this. One could be that you wish to use another repository than the official XBMC git repo. In my case i bought the USB Cec Adapter from Pulse Eight. This example does make use of the Pulse Eight XBMC build with full cec support.

As you already have installed XBMC from Gentoo ebuild most dependencies are taken care of. Remember the use flags for XBMC decides which options will be available for the XBMC source to use.

Pull in the git source. I like to put it in /opt/src for just a bit structure.

emerge git
mkdir /opt/src
git clone https://github.com/Pulse-Eight/xbmc.git /opt/src/xbmc

Then we need to configure, compile and install XBMC. With this source we need to pull in a few missing dependencies.

emerge libcec mysql
cd xbmc
./configure --prefix=/opt/xbmc --disable-debug PYTHON_VERSION=2
make -j4
make install

Replace -j4 with number of cpu’s. eg. make -j1 for a single core cpu. This is simply to speed things up. The Atom has 2 cores + hyperthreading so 4 threads is available so i use -j4.

When done we have installed XBMC from source in a separate location. This is to prevent the two builds from being mixed up. To run the newly installed version edit /home/xbmc/.xinitrc to reflect the new XBMC binary location.

exec /opt/xbmc/bin/xbmc-standalone

If using libcec you want to make /var/lock writable by the user running xbmc.
create /etc/conf.d/local with the following content:

chmod 775 /var/lock

Optional Extra software
Both systems are perfectly capable of running Samba/CIFS effectively making a perfect Network attached storage (NAS) machine. I use mine for XBMC, Torrenting, Newsbin, DLNA server and Irc Bouncer. Only your imagination sets the limit.  Ebuilds for newsbin applications (couchpotato, sickbeard, sabnzbd, headphones, maraschino and moviegrabber), can be found on my github page with instructions how to add a local overlay to Gentoo. More info can be found here.

Recommended hardware
USB – CEC Adapter from pulse-eight. Everyone should have one. The Pulse Eight USB CEC adapter is a small adapter you attach to the USB port of the server and connect a cec compliant device using HDMI. This allows you to control XBMC using your tv remote. I can not stress out how powerful this adapter is. Since i bought it i have never used another remote besides the one to my Samsung TV. Pulse Eight has great support and i do recommend everyone using XBMC to buy an adapter. This is a life changer

Sundtek MediaTV Pro USB tuner. This allows you to transform your XBMC installation into a PVR using Tvheadend (I have only tested with tvheadend but others should work as well) Works perfectly with the XBMC PVR build from Pulse Eight. Does not require any additional configuring of kernel as Sundtek has made their own media stack. Installation is simple and support is good. Tvheadend has supporting phone apps which allows you to start recordings from outside your home.

Optional Extra software
Both systems are perfectly capable of running Samba/CIFS effectively making a perfect Network attached storage (NAS) machine. I use mine for XBMC, Torrenting, Newsbin, DLNA server and Irc Bouncer. Only your imagination sets the limit.  Ebuilds for newsbin applications (couchpotato, sickbeard, sabnzbd, headphones and maraschino), can be found on my github page with instructions how to add a local overlay to Gentoo

Now you hopefully have XBMC up and running.  I am using the AT5IONT-I motherboard from Asus. And even if this is a aging piece of hardware it still is a valid solution in 2012. There are alternatives but ION based boards are well supported in XBMC and you will not run into problems getting hardware playback to work.

Machines/motherboards tested: (please add comment if you have a machine not listed and this guide worked for you)

Asrock 152B/152D
AT5IONT-I (complete build can be seen on my hardware page)
Zotac ID80

Files used in this guide

Intel Atom 64 bit Kernel 3.6.x config
Intel Atom 64 bit Kernel 3.7.x config


Kernel configs originally made  for Asus AT5IONT-I. Should work on similar hardware. Most options not necessary have been removed. Not using initrd so be sure to select the proper hardware settings. Will work with any recent hard drive formatted using ext3/ext4.

About soehest