Gentoo XBMC Installation

In Gentoo, XBMC on 18/04/2011 by pier0w

With the Gentoo Installation and Gentoo XBMC Pre-Setup complete it should just be able to be emerged with our any hassle.

#> emerge -av xbmc

When that completes XBMC should be able to be started by simply running the command xbmc from an xterm within an X environment.

#> startx

Now from inside one of the xterms.
#> xbmc

XBMC should now be running.

To get XBMC to display on the TV we need to do create a couple X11 configuration files within the /usr/share/X11/xorg.conf.d/.

The first configuration file will tell X11 to always use the intel driver and also provide labels for the TV and laptop monitor.

Section "Device"
    Identifier "Intel Graphics Card"
    Driver "intel"
    Option "Monitor-LVDS1" "LCD screen"
    Option "Monitor-VGA1" "VGA screen"
Section "dri"
    Mode 0666

The files name starts with 11 so that it will be executed after the original config file which starts with 10. Any additional config files can have their execution order set in this way.

The "Device" section is where the driver and monitor labels are set, the first name in the Option lines is the actual name that X11 gives the physical devices. X11 gives all video outputs a name that starts with “Monitor-” it then appends that device name on to that, to find the device name of a monitor you can use the xrandr -q command.

Screen 0: minimum 320 x 200, current 3200 x 1080, maximum 4096 x 4096
LVDS1 connected 1280x800+1920+0 (normal left inverted right x axis y axis) 331mm x 207mm
   1280x800       61.0*+
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 886mm x 498mm
   1920x1080      60.0 +
   1600x1200      60.0  
   1680x1050      60.0  
   1280x1024      75.0     60.0  
   1440x900       75.0     59.9  
   1280x960       60.0  
   1360x768       60.0  
   1280x800       59.8* 
   1152x864       75.0  
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3  
   640x480        72.8     75.0     66.7     60.0  
   720x400        70.1  
TV1 unknown connection (normal left inverted right x axis y axis)
   848x480        30.0 +
   640x480        30.0 +
   1024x768       30.0  
   800x600        30.0

From the output of this you can see that the laptop screen is called LVD1 and the vga plug is called VGA1 so the X11 names will be Monitor-LVD1 and Monitor-VGA1 respectively.

The "dri" turns on the hardware acceleration.

Now that the monitors have been labelled we need to tell X11 what configuration they are in, this I have done in another config file.

Section "Monitor"
    Identifier "LCD screen"

Section "Monitor"
    Identifier "VGA screen"
    Option "LeftOf" "LCD screen"
    Option "PreferredMode" "1920x1080"

This tells X11 that there are two monitors associated to the two output devices, it also tells X11 that the "VGA screen" (the TV) should be set to the resolution 1920×1080 and that it is to the left of the "LCD screen".

Now this should work fine with XBMC… and it sort of does. If you start up the X11 server then start up XBMC inside of it you will see that the resolution will be set to the 1280×800, the laptops resolution, but if you then close XBMC but NOT the X11 server then start XBMC again it will be at the right resolution. I have no idea why this is but there you go. Because of this I have created a hack in the next section.

But, if you want to have XBMC start in the correct resolution in a more correct way there are two things you can do.

The first is tell X11 to turn off the laptop monitor, this is good because it saves power and won’t burn out the monitor, but it means when X11 shuts down the monitor won’t turn back on so you are stuck with having to use the TV as the only monitor. In reality this isn’t that bad because you’ll surely be using ssh to do anything with the command line on the laptop any way. So to turn of the laptop monitor use this configuration.

Section "Monitor"
    Identifier "LCD screen"
    Option "Disable" "True"

Section "Monitor"
    Identifier "VGA screen"
    Option "PreferredMode" "1920x1080"

Though, if for some reason you want the laptop monitor to stay on but still want XBMC to start correctly you can set X11 to ignore the laptop monitor. This is good because it stays on, but bad because it ALWAYS stays on even with the lid close so may burn out the monitor.

Section "Monitor"
    Identifier "LCD screen"
    Option "Ignore" "True"

Section "Monitor"
    Identifier "VGA screen"
    Option "PreferredMode" "1920x1080"

So now that X11 is configured XBMC should start up and run perfectly on your TV.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: