Creating a media pc with Gentoo and XBMC

I am using an old broken laptop I have (Samsung N130) to work as a media pc. Its hardware is fairly typical of laptops, and is fully supported by Linux. I like using System Rescue CD to install with, I’m presuming you already have a working knowledge of Gentoo.

  • Intel 915 Video
  • eth0 RTL8101E/RTL8102E
  • wlan0 RTL8192E/RTL8192SE
  • Intel HD Audio

Basic Setup

  1. Boot into System Rescue CD
  2. /etc/init.d/ntp-client start
  3. Follow the basic setup here, stop after the first reboot.
  4. Setup wpa_supplicant if you are using wireless
  5. emerge and setup ntp

Config Tweaks


USE="X gif jpeg png tiff opengl samba dbus gtk alsa aac mp3 wma 
     xvid win32codecs mpeg dvd ogg sdl vcd a52 flac gnutls"
VIDEO_CARDS="intel vesa vga"
INPUT_DEVICES="evdev keyboard mouse synaptics"
MAKEFLAGS="-j2 -l2"

media-tv/xbmc ~x86

dev-libs/libxml2 python
media-tv/xbmc alsa xrandr udev
sys-fs/udev extras
sys-auth/consolekit policykit
sys-auth/pambase consolekit

Install Packages

These 2 major packages pull in everything you need.

  1. emerge xorg-server
  2. emerge xbmc


  1. rc-update add alsasound default (make sure to unmute alsa)
  2. rc-update add consolekit default
  3. useradd -m -c “XBMC” xbmc
  4. usermod -G audio,cdrom,cdrw,video xbmc

Create ~xbmc/.xinitrc

exec /usr/bin/dbus-launch \
    --exit-with-session \

Create /etc/init.d/xbmc with the following, and add it to the default boot level

depend() {
        need dbus
        need consolekit
        need net
        after alsasound

start() {
        ebegin "Starting ${SVCNAME}"
        su -l xbmc -c startx > /tmp/xbmc.log 2>&1 &
        eend 0

stop() {
        ebegin "Stopping ${SVCNAME}"
        xbmc-send --host= --port=9777 --action="XBMC.Quit"
        eend 0

If you are using DRI, /usr/share/X11/xorg.conf.d/90-dri.conf
Section "DRI"
    Mode 0660

Create /etc/polkit-1/localauthority/50-local.d/custom-actions.pkla
[Actions for xbmc user]

Alternatively, for newer polkit versions, you’ll need to create a rules script /etc/polkit-1/rules.d/10-xbmc.rules
polkit.addRule( function( action, subject )
        if( subject.user == "xbmc" )
                if( "org.freedesktop.udisks." ) == 0
                        || "org.freedesktop.power." ) == 0
                        || "org.freedesktop.consolekit.system." ) == 0 )
                        return "yes";

That’s it! Reboot and your good to configure XBMC and watch movies!

This entry was posted in Gentoo. Bookmark the permalink.