HOW-TO:Install XBMC for Linux on Fedora using a Shuttle XS35GTv2

Current state of this guide
This guide has become outdated, i will be re-doing this guide with an updated instruction for Fedora 17 with XBMC 11/12.

I'll also be including instructions for getting pulseaudio working correctly with passthrough once i have done it, so if you are keen keep an eye on this for changes!

Hardware used
Shuttle XS35GTv2 - This guide should suit for any atom / ION2 based PC, though the HDMI audio may differ.

VGA monitor (for initial setup - It'll be easier due to some GUI issues like font size)

HDMI capable TV / receiver (receiver is optional, necessary for passthrough options and nothing else)

Keyboard and Mouse (USB or bluetooth, bluetooth recommended if you need it for the long term (if you dont have a remote device (android, etc) or an IR receiver and compatible remote)

Software used
Fedora 15 DVD x64 - Download from Fedora Project website

RAM
I used Corsair 4gb DDR3 SO-DIMM.

1. Open the case by removing the screw under the rubber cover and sliding off the cover.

2. Slot the memory into the slot at a 45 degree angle.

3. Press down to clip the RAM in

4. Install the HDD while your at it! See below

HDD
I used an OCZ 60gb Vertex 2 SSD. Make sure your drive is 2.5 inch!

1. Open the case as above

2. Screw the HDD bracket onto the hard drive. Make sure you do the screws up tight enough so the drive cant move

3. Plug the HDD onto the board

4. Screw the bracket down into the Shuttle itself.

Starting out
1. Burn the ISO to a blank DVD, or use a thumbdrive to create a bootable USB stick.

2. Boot to the device. If you have never checked the image, scan it now.

3. The installer will start up and should start a GUI.

4. Select your language and Keyboard type.

5. Select Basic Storage.

6. Type a hostname for your PC.

7. Select your timezone, and if the PC is not dual-booting another OS, tick System Clock uses UTC.

8. Type a root password. This should be a very secure password as it grants administrator permission for the PC.

Setting up the partitions
Here you can make a choice, go with what the installer thinks is best, or customise. I will run through the process of customising as i like a simple clean layout. If you choose to use what the installer wants, just resume reading where relevant.

1. Select Create Custom Layout

2. Delete any existing partitions (sdaX) by selecting and pressing Delete. Alternatively just select sda and press delete to clear them all.

3. Create a new partition for swap by selecting free, then pressing create. Choose Standard partition.

4. Leave Mount point blank, choose File system type SWAP, and set size to 2x your RAM (in MB) and press OK.

5. Create a new partition for the filesystem by selecting free again, and pressing create. Choose Standard again.

6. Set Mount Point to /, file system type to ext4, set to Fill to maximum allowable size, and tick force to be primary. Press ok.

7. Ensure your sda1 is the bulk of the drive, and that sda2 is swap. If not, repeat the process.

8. Press next, and confirm the changes to disk.

9. Leave the boot loader on /dev/sda, and just press next on teh boot loader options screen.

Package selection
This is where you choose what gets installed with Fedora. Most things can be installed afterwards (using yum) but some things are simpler if done here.

1. Set to Graphical Desktop, leave the repos as is (Installation repo) and press "Customise now"

2. Under Desktop environments, select GNOME, and KDE.

3. Under Languages, select what you need (i use English UK as I'm from Australia, and it must be chosen here to have it available)

4. Press Next, the installer will do some work to check everything is ok and will proceed installing.

First Boot
Once the installer finishes there are a few final items to attend to. I will be using KDE for the rest of this guide.

1. Once the installer completes, the disc will eject. Remove the disc / thumbdrive and press Reboot.

2. The PC will reboot out of the installer and boot into Fedora itself. This will take a little while the first time.

3. Fedora will display the firstboot configuration menu once booted. Press forward to proceed.

4. Press forward on the license page to begin user creation.

5. Create your user by filling in Full name, username and password. Tick Add to administrators Group, then press forward to continue.

6. Select sychronise date and time over the network if you want to use internet time (recommended). Otherwise set the clock. If your using NTP the default servers should be fine (unless you have a local one you want to specify)

7. Turn on Send Profile if you want to (there is an explanation at the top of what this does).

8. Press submit to finish firstboot and drop into GDM (login manager)

9. Click on your user, but DO NOT type your password.

10. Change GNOME to KDE Plasma Workspace, then type your password and press Log In.

Setting up KDE / KDM / AutoLogin
Once you have logged into KDE, there are some cleanup items to complete to ensure autologin etc happens without problems.

I recommend removing the plasma widget on the desktop (hover over it and a little menu pops up). Its just unnecessary clutter.

Setting KDM as the login manager
By default, Fedora using GDM (GNOME's login manager) to handle logins. KDE login configuration expects KDM to be used, so we need to set KDM to be the default.

1. Start a console session by right clicking on the background and choosing Konsole

2. Log in as root by typing su -, pressing Enter, and typing your root password.

3. type "cd /etc/sysconfig" to switch to the correct path (folder)

4. type "echo DISPLAYMANAGER=KDE > desktop" to create the file called desktop, and fill it with that line.

5. exit your terminal by typing exit (to get out of root login) and then exit again (to exit the terminal)

Setting up KDM
1. Go to Kickoff (the fedora logo at the bottom, and go into System settings.

2. At the bottom, select Login Screen.

3. On the convenience page, enable Password-Less login, and selet your user as well

4. Tick the "Automatically log in again after X server crash" to ensure auto-login will happen no matter what

5. Press OK, and type your user password to confirm authority to change.

6. Close the configuration window, and restart (Restart, shutdown etc are in kickoff as well)

Setting up Auto-Login
1. When the system restarts, you should be in KDM. It will have the same background as KDE did.

2. Type your username, then press Session Type.

3. Select KDE Plasma workspace, then type your password and press enter to log in.

4. Open the login screen configuration again by following steps 1 and 2 in KDM setup.

5. On the Convenience tab, select Enable Auto-Login, and choose your user in the drop-down.

6. Press apply, and type your password to confirm. 18. Reboot one more time, and ensure auto-login works correctly and into KDE.

Option 1 - Using NetworkManager
This will result in the network interface not starting until your GUI (KDE) has at least partially loaded. For XBMC though that will be fine, and its also easy and quick. You also get the benefit of easy wireless configuration etc.

This guide focuses on wired network connections, as thats what im using at the moment, however wireless connections are very easy, and similar to windows etc anyway.

1. In the system tray in the bottom right, you will see NetworkManager. It may look like a network plug, a network port, or a wireless logo.

2. Left click on it, then press "Manage Connections"

3. In the window that opens, ensure you are on the "Wired" tab, and press Add.

4. Give the connection a name at the top. Im setting it up for Automatic (DHCP), so I usually call it Auto Eth0.

5. Tick the "Connect automatically" box to ensure this will happen everytime KDE starts.

6. Tick the "System Connection" to ensure the network does not rely on your user permission to start.

7a. If you just want DHCP, you can press OK now. 7b. If you want to specify IP etc, you can do so below. Ensure you change the method to the appropriate option. Press OK once complete.

8. Press Apply, then OK on NetworkManager's main configuration window.

9. If you have the cable plugged in, your connection should now activate, and you should have network.

Option 2 - Manually
This option requires you to disable NetworkManager (with service NetworkManager stop and chkconfig NetworkManager off) and then set up your network interfaces manually. Its not completely practical for wireless connections, but for wired connections it is not hard, but its un-necessary work. Anybody who feels its worth it can fill this section in, otherwise i may do it later.

Setting up RPMFusion
RPMFusion has good instructions for setup available on their website at http://www.rpmfusion.org/Configuration

I wont duplicate their instructions, but i highly recommend using the command line, and running their Command line setup via YUM. The command given will require your root password to work.

Installing NVIDIA drivers (the easy / good way)
Note before installing - It is highly recommended to do a full system update before completing this step.

Its not guaranteed to fail without, but its not guaranteed to work either. The autoinstaller for the kernel module relies on the latest kernel being installed, which will not be the case if you have not updated.

Following the instructions at the bottom to complete the update before attempting this section is highly recommended!

1. Open a console.

2. Log in as root (or use sudo for the next step)

3. Type "yum install akmod-nvidia", and answer y or yes to any relevant questions

4. Once the install finishes the system will be ready to build and use the nvidia module. Restarting the PC will start that process.

Boot screen fix
This setting is for 1080p displays, and will present the fedora bootscreen in 1080p resolution, with an image that fills 80% of the screen. Other resolutions can be found by adding ask (i think) into this vga= and choosing the one that is appropriate to you.

1. On the command line, (terminal window or console) log in to root (su -)

2. Change directory to /boot/grub/

3. Inside your grub.conf file add the following to the end of any of the kernel lines: vga=0x34d

4. Save the file, and reboot

Next time you reboot you should get the Fedora graphical bootscreen (F logo filling up) rather than the 3 bars.

Font DPI (KDE GUI)
This issue seems to present itself on TV's and not monitors, even if the resolution matches. I recommend forcing it even if you are not having problems. The issue presented as very small fonts and normal images to me, whereas a friend had extra large font and small images. In both cases this fix made it normal again.

1. In Kickoff, go into System Settings.

2. At the top, open the second item (Application Appearance)

3. Go to the fonts item on the sidebar.

4. Change "Force fonts DPI" to 96 DPI.

5. Press Apply at the bottom. Items will be fixed as they are started / restarted. To resolve all problems restart the PC.

Font DPI (KDM / Xorg setting)
This issue will only be seen when in the login manager is used, which given the above setup should never happen. I believe you need to force the DPI within the xorg.conf file, but i have not done this on this PC (and dont intend do). Anybody wishing to do this should google "xorg.conf 96 DPI force nvidia", please update this wiki if you do :)

Installing XBMC (the easy / lazy way)
Now that you have set up your network and RPMFusion, you can install XBMC the easy way. RPMFusion provides pre-built packages for XBMC that work on 64bit installs, i have not tested 32bit but they should be available too.

Installing XBMC
1. Open a console (right click on the desktop and press Konsole)

2. Log in as root (or use sudo in front of the next command and use your password)

3. Run the following command "yum install xbmc", and press yes or y on any relevant questions

4. Once the install completes xbmc will be installed and available, but we still need to link it on your kickoff favourites and set it up for autostart.

Setting it as a favourite applcation
1. Open Kickoff.

2. Type XBMC media in the search box at the top.

3. Right click on xbmc, and press Add to Favourites.

4. XBMC will now appear on the first page of kickoff for ease of access.

Setting up XBMC to run on KDE startup
1. In Kickoff, click on system settings.

2. At the bottom right, click on Startup and Shutdown.

3. Under autostart, press "Add Program"

4. type xbmc, and press ok. Press OK again to confirm the label etc.

5. Close the system settings, the next time the PC boots it will autostart XBMC

Fixing the firewall for the XBMC remote
If you want to run an XBMC remote over the network (iOS, Android etc) you will need to make a hole in the firewall to allow this

By default the firewall blocks everything but SSH (port 22 TCP). This will show you how to add the required port 8080 (for uPnP control) and port 9777 (for remote controller functionality)

1. Open a console / terminal window.

2. Log in as root (or use sudo for the next command)

3. Open the firewall rules file at /etc/sysconfig/iptables and add the following three lines

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 9777 -j ACCEPT -A INPUT -m state --state NEW -m udp -p udp --dport 9777 -j ACCEPT Just under the line that looks like this

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 4. Restart iptables with service iptables restart (remember sudo if your not root)

5. Once iptables has restarted, you should be able to connect your remote. Dont forget to set the relevant options in XBMC to allow remote control!

Proper fix - with passthrough via pulseaudio
HDMI passthrough bitstreaming via Pulseaudio

Pulseaudio 1.0 has the required code in it for this to work. See the following Bug 167

Unfortunately Fedora 15/16 currently has v0.9.22/23. I am going to try to compile and install pulseaudio 1.0/1.1 myself, and will post instructions if successful

Workaround Option 1 - With passthrough bitstreaming but no OS / Menu sounds
Direct to HDMI audio source from xbmc

1. Unmute the HDMI channels using alsamixer (on the command line). You will see 4 channels under HDMI, press M to unmute them all

2. inside XBMC, set the audio device and passthrough device to custom, and enter plughw:1,7

3. Sound should now work within all media. No menu sounds or OS sound will be available (as this seems to inherit from the OS sound method, rather than the selected options)

Workaround Option 2 - With OS / Menu sounds, but no passthrough bitstreaming
Via the OS sound system (PulseAudio)

Workaround Option 3 - Remove PulseAudio for the OS and move back to ALSA
 Not recommended or tested, but if you have done this, document it here!

I recommend not trying this unless you have already done it, pulseaudio recently completed a bug report to patch this passthrough problem, and assuming packages make their way downstream soon enough, passthrough for bitstream should not be a problem any longer.

Activating 1080/24hz
Coming soon - This should need to be done in xorg.conf.

UPDATE - I have set this up in Xorg.conf, and it works (dont have the config on me right now, i'll update this again once I have it). However once i activate sync'ing on XBMC, some videos wont play, error on playback, or crash XBMC entirely. I suspect this is due to the older version of Dharma that is pre-compiled via RPMFusion, and I intend on testing a recompile using the latest stable.

Using an external IR receiver
The receiver this is written with is the HP IR receiver for Media Center. Your experience with others may vary.

I am using a Harmony remote, set to profile XBMC (which changes to Xbox Media remote automatically when i searched for XBMC in the Harmony software)

Things you will need 1. A supported IR remote

2. An IR receiver for your box (if it doesnt have one built in, the Shuttle doesnt)

3. Root access to your media PC

Installing and configuring Lirc 1. Start a terminal, log in as root

2. Install lirc with yum install lirc

3. Download the text file from here: http://lirc.sourceforge.net/remotes/microsoft/Xbox_MCE and copy it / move it to /etc/lirc/lircd.conf

4. Edit the file, and rename the remote from Xbox_MCE to mceusb ( a phillips remote that XBMC has a conf for that seems to be identical keymap wise)

4. Restart / start lirc with service lirc restart

5. Set lirc to run on startup with chkconfig lirc on

6. Test lirc is seeing your commands by running irw, and pressing some buttons - They should correspond to your remotes buttons.

NOTE - Dont worry if they appear multiple times, XBMC either ignores this or filters the extra key presses

7. Stay logged in as root on the command line for the next steps

Telling XBMC how to find Lirc 1. Run the following command to link the new Lirc socket to the old location that XBMC is compiled to look at   ln -s /var/run/lirc/lircd /dev/lircd 2. Restart XBMC, and test your remote

Doing a system update
To run a system update on the command line, do the following.

1. Open a console.

2. Log in as root (or use sudo on the next command)

3. type "yum update", and answer y or yes on any relevant questions

4. restart the system when convenient to apply any kernel updates.

Measuring and Improving boot time with bootchart
Bootchart is an application that can be used to benchmark your boot time, tell you about what processes are consuming resources and time, and give you an idea of what to stop to speed up boot.

1. Install bootchart / bootchart-daemon using yum (yum install bootchart bootchart-daemon)

2. Reboot the PC. Bootchart-daemon will automatically measure

3. When the system reboots, go into the command line again, and run bootchart. This will create a bootchart.png image you can view in the gui. If you stayed in your original directory in the console, it will be in your home directory.

4. Review the image to find processes that are causing delays. Some are unavoidable (kde4, plasma etc) but some can be disabled if not needed (setroubleshootd was wasting a lot of time on my system, disabling selinux shaved 7 seconds off my 35 second boot time...)

5. Once complete, you can remove bootchart / bootchart-daemon to stop it causing delays on boot (yum remove bootchart bootchart-daemon)