[LINUX] HOW-TO get XBMC 10.0 (Dharma) to work with Ubuntu 10.04 (Lucid Lynx)
#1
HTPC with Lucid and Dharma

Get the Ubuntu 10.04 minimal CD. It's size is only around 15 MB; all the installation will be carried over the Internet, so you'll need a decent connection. Also, the installer expects a simple wired connection (no wireless, no PPP or other VPN). An advantage of such approach is that you'll get the latest versions of all packages, meaning you won't need to update anything once done.

Code:
https://help.ubuntu.com/community/Installation/MinimalCD

If you install on a hard disk and your system has a CD drive, it's probably simplest (and fastest) to burn the image on a CD, then boot it.

If you run your HTPC off a flash drive (like I do), you might consider different approach (which will give you more room for tests and trials). First, create two partitions on the flash drive: one small for the ISO (64 MB is enough), and one large with all the remaining space. Format the first as VFAT. Download and install UNetbootin and use it to create on the small partition a bootable drive from the minimal ISO.

Next, boot your HTPC system and install from the minimal CD. If you used a small partition on the flash drive, then install to the second, large partition. Chose "Custom" install. Format the XBMC partition as EXT2.

During installation, create a user named "xbmc".

When done, reboot to get into your new system. All the rest will be carried as superuser, so first log in as "xbmc" and then acquire root privileges:

Code:
sudo bash

Install SSH. Then you can get rid of the console and happily continue working over SSH:

Code:
apt-get install ssh

Install some handy tools will need later; namely, a text editor. If you're not comfortable with vi, substirute with whichever you like (pico, nano, joe etc.)

Code:
apt-get install vim

Install some basic software which we'll need later

Code:
apt-get install pkg-config python-software-properties

Add the XBMC PPA repository and keys, then fetch the repository data

Code:
add-apt-repository ppa:team-xbmc
apt-get update

Install XBMC together with the X server and required utilities

Code:
apt-get install xbmc xinit x11-xserver-utils

Install nVidia drivers. Virtually all HTPCs seem to run nVidia, so I'll stick to this path. Here we get the latest binary drivers from Ubuntu for our current kernel

Code:
apt-get install nvidia-current nvidia-settings

We need to generate a X.org config file. We'll skip the nVidial logo

Code:
nvidia-xconfig -s --no-logo --force-generate --output-xconfig=/etc/X11/xorg.conf

The "xbmc" user needs to be a member of few more groups in order to use all features of XBMC

Code:
usermod --append --group audio,video,fuse,cdrom,plugdev xbmc

Install the XBMC start-up script. It will handle all the configuration required to start the X server together with XBMC upon boot (no need for auto-login any more)

Code:
apt-get install xbmc-live

Install the ALSA (sound) utilities. Next, run the ALSA mixer and set up the desired volume levels (ESC to exit). Finally, save the configuration.

Code:
apt-get install linux-sound-base alsa-base alsa-utils
alsamixer
alsactl store 0

If using a remoe control, install LIRC.

Code:
apt-get install lirc

If your remote is a non-standard one (like mine), you'll need to prepare and upload your custom configuration files (in /etc/lirc), then tell XBMC how to handle the buttons (files under /usr/share/xbmc/system):

Code:
/etc/lirc/hardware.conf
/etc/lirc/lirc.conf
/usr/share/xbmc/system/Lircmap.xml
/usr/share/xbmc/system/keymaps/keyboard.xml

If you use NFS (like I do), install the utilities needed to mount a remote NFS volume

Code:
apt-get install nfs-common

Unlock the DVD/CD drive so that it could be ejected even while playing

Code:
bash -c "echo dev.cdrom.lock=0 >>/etc/sysctl.conf"

If you have MIDI-based karaoke file (.KAR files), install a soundfont (wavetable) to be able to play karaoke and make the requred links to it

Code:
apt-get install fluid-soundfont-gm fluid-soundfont-gs
mkdir -p /usr/share/xbmc/system/players/paplayer/timidity
cd /usr/share/xbmc/system/players/paplayer/timidity
ln -s /usr/share/sounds/sf2/FluidR3_GM.sf2 soundfont.sf2

Since Lucid uses kernel mode setting to provide graphical boot and since nVidia proprietary drivers do not (and probably never will) support KMS, you can have a slightly nicer boot than a purely black screen by using VESA framebuffer before X starts. First, install a simple graphics theme (more are available in the standard repositories)

Code:
apt-get install plymouth-theme-ubuntu-logo

Install two programs we'll need

Code:
apt-get install v86d hwinfo

Then, obtain the list of VESA modes that your card supports. Write down the highest one that has 24-bit colour (ideally, it will match your X resolution; if not will still be close to it)

Code:
hwinfo --framebuffer

Next, edit /etc/default/grub, find the line that starts with GRUB_CMDLINE_LINUX_DEFAULT and add before its end these parameters (if using something other than 1024x768, replace 1024 and 768 with their respective values). "24" is the colour depth, if using other, change it here too.

Code:
nomodeset video=uvesafb:mode_option=1024x768-24,mtrr=3,scroll=ywrap

In the same file, uncomment the line that begins with "GRUB_GFXMODE" and set the same resolution that you just added. Save the file.

Code:
GRUB_GFXMODE=1024x768

Next, edit /etc/initramfs-tools/modules and add this line. Again, if not using 1024x768, replace with your own resolution. "24" is the colour depth, if using other, change it here too.

Code:
uvesafb mode_option=1024x768-24 mtrr=3 scroll=ywrap

Create a file named /etc/initramfs-tools/conf.d/splash and put inside this line:

Code:
FRAMEBUFFER=y

Finally, update GRUB and RAMfs

Code:
update-grub2
update-initramfs -u

Last but not least install two userspace utilities to handle power and volume management from userspace:

Code:
apt-get install udisks upower

You're now ready to reboot and enjoy XBMC.

PART TWO: KERNEL TWEAKING

If you are (or, rather, your hardware is) not quite happy with the default Lucid kernel, you may have no alternative but to tweak it manually. A simple example will be hardware, which dos not like the libata subsystem, which nowadays not only handles the SATA controllers, but also the PATA (IDE) ones - not very successfully, though (a particular example will be some, if not many, nForce chipsets). Here is how to fix such small problems, which can greatly improve your XBMC experience. Be advised that the process is likely to take at least several hours and around (or more than) 1 GB of your disk space; since I run XBMC on a dedicated HTPC with limited flash disk space, I simply build the kernel on another machine and you might go this way too.

First, take a note of which kernel you currently run. (If you have just updated your kernel, reboot it first.) The kernel version will be something in the form 2.6.XX-YY-generic where XX and YY are digits (if using PAE, it will be 2.6.XX-YY-generic-pae)

Code:
uname -a

Become root

Code:
sudo bash

Install some tools needed to build a new kernel; replace XX with proper digits

Code:
apt-get build-dep linux-source-2.6.XX fakeroot

Get the kernel source itself; replace XX and YY with proper digits; if running PAE, use "generic-pae" instead of "generic"

Code:
apt-get source linux-image-2.6.XX-YY-generic

Go to the source directory; replace XX with proper digits. If a patch to the kernel is needed, apply it now.

Code:
cd linux-source-2.6.XX

Copy the kernel configuration file and use it as a base for modifications; replace XX and YY with proper digits.

Code:
cp /boot/config-2.6.XX-YY-generic .config

Enter kernel configuratin mode and make the desired changes; save the configuration

Code:
make menuconfig

Edit the Makefile; in the beginning, find the line starting with "EXTRAVERION" and replace whatever value it has with "-YY", replacing YY with proper digits. This will build your new kernel with he same version as the running, allowing you to reuse all existing modules and initial RAM disk.

Code:
vim Makefile

Build the new kernel and modules

Code:
make-kpkg --rootcmd fakeroot --initrd --append-to-version=-generic kernel-image

Your kernel is arch/x86/boot/bzImage (or arc/x86_64/boot/bzImage). Copy it manually to the existing installation (/boot) and add a new boot entry into /etc/grub.d/40_custom, then rebuild the GRUB configuration

Code:
update-grub

If you built new modules, copy them to /lib/modules/2.6.XX-YY/kernel/... Next, you'll have to boot and run "depmod -a"; on next reboot the new module(s) will be loaded automatically.

If you need modules to be available before mounting the root filesystem, you need to add them to the initramfs. To create a modified copy of the initramfs, follow these steps:

1. Copy the initramfs to some other directory. Add a ".gz" suffix.
2. Run "gunzip" on the file
3. Create an empty directory and "cd" into it
4. Extract the initramfs, which is an cpio archive by running "cpio -i < ../initramfs-2.6.XX-YY"
5. Copy required modules and the depmod files
6. Create a new cpi archive one level up this way "find | cpio -o -H newc > ../initramfs-new"
7. "cd" one level up and "gzip" the new initramfs. Move it to "/boot" and adjust the GRUB menu if needed.
Reply
#2
This worked great for me thanks for this write up!!
Reply
#3
Big Thanks for all of this in one step.
Code:
GRANT ALL PRIVILEGES ON `xbmc_%`.* TO 'xbmc'@'%';
IF you have a mysql problem, find one of the 4 dozen threads already open.
Reply

Logout Mark Read Team Forum Stats Members Help
[LINUX] HOW-TO get XBMC 10.0 (Dharma) to work with Ubuntu 10.04 (Lucid Lynx)0