XBMC Confluence Skin I have just finished setting up a new XMBC HTPC for my living room; I will walk you through this step-by-step so that you can set one up for yourself.  At over 1,700 words, this is a fairly lengthy tutorial; I have separated the steps into the correct order and have made them as easy to follow as possible.

  1. Introduction
  2. Setup BIOS
  3. Setup DHCP Server
  4. Setup FreeBSD Server
  5. Install XBMC-Live (Linux)
  6. Copy XBMC to NFS Server
  7. Setup XBMC
  8. Caveats

This will be broken down into a number of smaller steps. First, we will setup the BIOS of the HTPC. Next, we will want to setup your DHCP server for PXE / Network booting and then setup your FreeBSD server. Once your 'backends' are setup, it is time to configure your HTPC (frontend). This will consist of installing XBMC-Live, copying XBMC to your NFS server (FreeBSD), and then configuring a small number of XBMC options. Finally, there are a number of caveats to address.

Introduction

I decided to go with XBMC instead of MythTV as I 1) do not have cable and thus have no need for live TV recording and 2) have only one frontend, so I do not need the master / slave setup that MthTV has.

After about a week of research, I decided to go with the following hardware:

  1. ASUS AT3IONT-I This is an amazing little board. I have always had good experiences with Asus. It should be noted that the heatskin gets very hot even when the system is idling. You may opt to place a 40mm fan on the heatsink, as I did.
  2. Kingston KVR1066D3N7K2/4G I have always had good experiences with Kingston RAM.
  3. IN WIN IW-BQ656 Black Mini-ITX If you are used to HTPCs the size of a Revo, than this box will seem huge. But for what you're packing, it is nicely sized. It should be noted that this case has an extra inch or so of height for a 2.5" HDD and slim CDROM. Since we'll be using neither, feel free to find a case that better suits your environment, if appropriate.

Setup BIOS of HTPC

  1. Advanced -> CPU Configuration -> Hyper Threading Technology: Disabled I decided to disable Hyper Threading to further reduce the power requirements and heat generation of the box.  Watching Avatar in 1080p, without Hyper Threading, my CPU load was at 0.01.  You neither need nor will miss this feature.
  2. Advanced -> Chipset -> MCP7A Configuration -> iGPU Frame Buffer Detect: Disabled
  3. Advanced -> Chipset -> MCP7A Configuration -> iGPU Frame buffer Size: 512MB
  4. Advanced -> Onboard Devices Configration -> Front Panel Select: HD Audio While I use HDMI for both audio and video, this feature may be useful to you.
  5. Advanced -> Onboard Devices Configration ->LAN Option ROM: Enabled
  6. Advanced -> PCIPnP -> Plug And Play O/S: Yes
  7. Power -> ACPI 2.0 Support: Enabled
  8. Power -> ACPI APIC support: Enabled
  9. Tools -> Express Gate: Disabled

You may notice that, with the above settings and 4GB installed RAM, POST will report "RAM:  3072 OK".  This is because the BIOS is allocating ~1GB RAM to the GPU.  Linux will also report 3072MB of RAM.  This is normal.

Configure DHCP for PXE / Network Booting

You will need to configure your DHCP server for PXE / Network booting.  This will allow your front end to obtain an IP address and load the appropriate files to allow the system to boot the operating system over your network.  While the instructions below are for PFSense, the setup should be very similar for other systems.

  1. Services -> DHCP Server
  2. Click "Advanced - Show Network Booting"
  3. Check "Enable Network Booting"
  4. Enter the IP address of your file server into the first box.
  5. Enter "PXEClient/pxelinux.0" into the second box.
  6. Click "Save"

Setup FreeBSD

I use FreeBSD for my home file / database / web / whatever server.  FreeBSD has an amazing technology called ZFS.  ZFS is a combined file system and logical volume manager which allows you to dynamically create filing systems, snapshots, rollbacks, and a whole slew of other neat things.  If you're generally a GNU/Linux guy and am used to using LVM  and / or MDADM, I recommend you try out FreeBSD with ZFS.

ANYWAY, Here we will setup our tftp server (tftpd) and share out some folders with NFS.  While you do not need to use a FreeBSD backend, this tutorial assumes that you are, and that you have already created your filing systems.

Setup NFS shares

The home for our XBMC install will be /tank/xbmc.  tftpd will serve files from /tftpboot.  Our media will be stored in /tank/media.

  1. echo 'nfs_server_enable="YES"' >> /etc/rc.conf
  2. echo 'rpcbind_enable="YES"' >> /etc/rc.conf
  3. echo 'mountd_enable="YES"' >> /etc/rc.conf
  4. echo 'mountd_flags="-r"' >> /etc/rc.conf
  5. vi /etc/exports
    /tank/xbmc -maproot=root
    /tank/media -maproot=root
  6. /etc/rc.d/mountd start Protip: If you are using FreeBSD 7.3 or 8.1, you may use "service" in place of "/etc/rc.d", so the above command would look like "service nfsd start"
  7. /etc/rc.d/rpcbind start
  8. /etc/rc.d/nfsd start

Executing "showmount -e" should now display your NFS-exported folders.

Setup tftp server

If you recall in the previous step of setting up the PXE server, we had to enter a path to "PXEClient/pxelinux.0".  This file is served via tftp and is what instructs the PXE-booting (in this case, our HTPC) system to load the appropriate GNU/Linux files and correctly boot.

  1. Edit vi /etc/inetd.conf and uncomment the following line: tftp    dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -l -s /tftpboot
  2. echo 'ftpd_enable="YES"' >> /etc/rc.conf
  3. Start ftpd /etc/rc.d/ftpd start

You should now be able to test that your tftp server is running by executing "ftp localhost" from the command line.

Configure tftp files

When we are finished, the directory structure of our tftp server will look like this:

cosmos# ll -RF /tftpboot/
total 2
drwxr-xr-x  3 root  wheel  512 Aug  7 10:25 PXEClient/

/tftpboot/PXEClient:
total 11730
-rw-r--r--  1 root  wheel  8047310 Aug  7 10:25 initrd.img
-rw-r--r--  1 root  wheel    14776 Jan 22  2010 pxelinux.0
drwxr-xr-x  2 root  wheel      512 Jan  5  2002 pxelinux.cfg/
-rw-r--r--  1 root  wheel  3892032 Aug  7 10:25 vmlinuz

/tftpboot/PXEClient/pxelinux.cfg:
total 2
-rw-r--r--  1 root  wheel  139 Aug 13 23:31 default
  1. mkdir -p /tftpboot/PXEClient
  2. cd /tftpboot/PXEClient
  3. fetch http://archive.ubuntu.com/ubuntu/dists/karmic/main/installer-amd64/current/images/netboot/pxelinux.0
  4. mkdir pxelinux.cfg
  5. cd pxelinux.cfg
  6. vi default
    LABEL linux
    KERNEL vmlinuz
    APPEND xbmc=autostart root=/dev/nfs initrd=initrd.img vga=788 nfsroot=192
    .168.9.10:/tank/xbmc ip=dhcp ro

Be sure to replace 192.168.9.10 with the IP address of your FreeBSD Server!

Install XBMC-Live

A hard disk is required for this step.  After the system is installed, we'll be copying the files off to our NFS server, at which point you can remove the hard disk and disable the controller.  If you have ever installed Ubuntu, the XBMC-Live install will seem very familiar.  If you haven't, the install will seem very easy!

  1. Download and burn CD. I am using the xbmc-9.11-live-repack version for this tutorial, which is linked from the "Live" link at http://xbmc.org/download/
  2. Boot from CD
  3. From CD menu, choose "Install XBMCLive to Disk" We must first install to the hard disk.  Later we will move the system to a NFS share for diskless PXE booting.
  4. Follow the prompts to progress through setup...
  5. When you reach the partition disks part of the setup, choose "Guided - use entire disk" The disk layout does not matter as it is only temporary.
  6. Choose "Yes" to "Write the changes to disks?".
  7. Create your user account.  You'll be using this account if / when you need to SSH into your media center for remote (read: couch) administration.
  8. Remove CD and reboot

At this point, XBMC should boot and you should have a fully-functional HTPC.  The next step is to copy the operating system to a remote server so that we can remove the local hard drive and network boot.

Copy XBMC to Server

This part of this how-to is based off of the guide at http://hype-o-thetic.com/2009/09/20/diskless-htpc-using-dd-wrt-pxe-xbmc-and-freenas-tftp-nfs/, with some modifications.

Copy the files to the server

Perform this step on the HTPC.

  1. sudo -s
  2. apt-get update
  3. apt-get install nfs-common portmap
  4. mkdir /mnt/tmp
  5. mkdir /mnt/nfs
  6. mount /dev/sda1 /mnt/tmp
  7. mount 192.168.9.10:/tank/xbmc /mnt/nfs Make sure to change the IP address!
  8. cp -a /mnt/tmp/* /mnt/nfs/ This will take up to 10 or so minutes, so be patient.

Change root directory

Perform this step on the HTPC.

  1. chroot /mnt/nfs
  2. mount -t proc proc proc This command may cause your SSH / terminal session to 'hang'.  That is OK - just open a new SSH or terminal connection to the box and proceed.

Edit some files

Perform this step on the HTPC

  1. chroot /mnt/nfs
  2. Change BOOT=local to BOOT=nfs vi etc/initramfs-tools/initramfs.conf
  3. Updated initrd.img update-initramfs -u
  4. Edit etc/fstab to point to the new NFS root.
    1. vi /etc/fstab Replace the "/" line with this one:
    2. /dev/nfs    /    nfs    defaults    0    0

Copy the new kernel image files to the tftp server

Perform this step on the FreeBSD server

  1. cp /tank/xbmc/vmlinuz /tftpboot/PXEClient/
  2. cp /tank/xbmc/initram.img /tftpboot/PXEClient/

Now go ahead and turn off your frontend, remove the hard disk, and set your network card to be the first boot device.  With any luck, XBMC should boot right up, over the network!

Configure XBMC

The first thing that I recommend you do is to snapshot your system so that you can easily revert back in the future.  I have had bad experiences in upgrading xbmc and the underlying OS and have been fortunate enough to have snapshots to roll back to.

Snapshot your OS

Perform this step on the FreeBSD server

  1. snapshot -r tank/xbmc@postinstall

Mount NFS Shares

We have already setup our NFS shares on the FreeBSD box - now we will mount them on our frontend so that we can access our media content.  This step can be performed either by SSH to the frontend, or by opening a terminal (after XBMC boots up, press CTRL+ALT+F2).

  1. sudo -s
  2. mkdir /media/movies
  3. vi /etc/fstab
    192.168.9.10:/tank/media        /media/movies   nfs     default 0       0
  4. mount -a

Caveats

While the majority of this setup goes without issue, there are a couple things to address.

smbus error

While booting, or in dmesg, you will see a message similar to "nForce2_smbus conflicts with ACPI region."  The proposed fix for this is to add "acpi_enforce_resources=lax" as a kernel boot parameter.  While this will change the error message, it will not fix the problem.  I am working on a fix for this.

Fan

Even with Hyper Threading disabled, the passively-cooled CPU still runs very hot.  You may or may not require a fan.  I screwed a 40mm fan to the heat sink, which did the job.

In closing,

This tutorial was written in the hope that it will help others, as the information for such a setup is spread around many places, and also requires a lot of trial-and-error.  If you find that I have overlooked something, or if you have any ideas for improvement, feel free to leave some feedback!