Archive:HOW-TO:Install XBMC on Ubuntu/HOW-TO 1 and Archive:Building restricted drivers for XBMCbuntu: Difference between pages

From Official Kodi Wiki
(Difference between pages)
Jump to navigation Jump to search
>Olympia
 
>L.capriotti
No edit summary
 
Line 1: Line 1:
== Introduction ==
== Introduction ==


After my XBMC Live guide, I decided to put together a guide for installing XBMC on Ubuntu Intrepid Minimal CD version as well.
The simpler approach to build and install the restricted drivers is to run the driver installer on XBMCLive. The installer will take care of all installations and modify the config files accordingly.


Please note:
However, this requires that a full build environment has to be available on the system, while the default XBMCLive build does not have the required packages for sake of being as much compact as possible.
* I only tested this with nvidia, so I have no experience with ATI
* The guide is for using XBMC on a dedicated HTPC, so there is not any window manager installed
* You need minimum 4GB size flash drive or hard disk to go


This guide walks you through how to install every needed components and XBMC itself, but try to leave to footprint as small as it can.
As several users have experienced, a full build environment requires around 1 GB of space, and the XBMCLive permanent storage file can be filled up quite easily.


You will get:
The following procedures are intended to tackle this issue; it has side effects and limitations but once you have a fully working build environment it does not have major disadvantages (IMHO).
* A dedicated HTPC autoboot to XBMC
* Latest XBMC SVN version
* Upgraded ALSA driver
* Upgraded NVIDIA driver
* Lirc (I have MS MCE Remote which works out of the box, so everybody with other remotes and LCD displays are in his/ her own to solve the individual Lirc issues)
* Suspend/ resume (works perfectly on ASUS P5N7A-VM)


So, let’s start:


== Preparation ==
== Building NVIDIA video drivers ==


FIRST STEP
*Method 1: build drivers on XBMCLive
Download, burn and install Ubuntu Intrepid mini.iso from here:
https://help.ubuntu.com/community/In...tion/MinimalCD


Apparently there seems to be an issue with Intrepid installer. If you are using flash drive, it's not installing GRUB for some reason.
*Method 2: build drivers in MIC


You have to options:
Assuming you have created a target in MIC for the creation of the XBMCLive image, you need to create a new target having all the necessary development tools ON THE SAME PLATFORM, so that the build target has the same system components as the XBMCLive target.
Either install Hardy(Ubuntu 8.04) mini.iso first, which is install GRUB, then right after that, install Intrepid mini.iso over the same flash drive. It will reformat the drive, but GRUB will stay alive on the drive.


Second option is that right after Intrepid mini installation, boot up Intrepid mini.iso from the CD again, choose rescue mode, and there you will find an "install GRUB" option.
Once done, copy the driver installer script onto the target and perform the following steps in a chrooted terminal on the build target:


sh ./NVIDIA-Linux-x86-180.29-pkg1.run --extract-only
cd NVIDIA-Linux-x86-180.29-pkg1
mv * usr/bin
Now a few symlinks need to be created in a few library directories:


During the installation, please set „xbmc” as username and password at the account creation.
cd usr/lib


At the end, when you have to choose from the optional components, check only „OpenSSH” to be able to access your HTPC remotely via SSH.
create the following:


After you’re done, boot it up, then use an SSH application (e.g. putty) to log in remotely from your desktop, using the above created username and password. This way, you will be able to copy/ paste all the steps below. Alternatively you can use your console, but then you will have a hard time type in everything.
lrwxrwxrwx libcuda.so.1 -> libcuda.so.180.29                                       
lrwxrwxrwx libGLcore.so.1 -> libGLcore.so.180.29                                   
lrwxrwxrwx libGL.so -> libGL.so.1                                                   
lrwxrwxrwx libGL.so.1 -> libGL.so.180.29                                           
lrwxrwxrwx 1 libnvidia-cfg.so -> libnvidia-cfg.so.1                                   
lrwxrwxrwx libnvidia-cfg.so.1 -> libnvidia-cfg.so.180.29                           
lrwxrwxrwx libnvidia-tls.so -> libnvidia-tls.so.1                                   
lrwxrwxrwx libnvidia-tls.so.1 -> libnvidia-tls.so.180.29                           
lrwxrwxrwx libvdpau_nvidia.so -> libvdpau_nvidia.so.1                               
lrwxrwxrwx libvdpau_nvidia.so.1 -> libvdpau_nvidia.so.180.29
lrwxrwxrwx libvdpau.so -> libvdpau.so.1
lrwxrwxrwx libvdpau.so.1 -> libvdpau.so.180.29
lrwxrwxrwx libvdpau_trace.so -> libvdpau_trace.so.1
lrwxrwxrwx libvdpau_trace.so.1 -> libvdpau_trace.so.180.29


So once you logged in:
cd usr/lib/tls


First of all, update the repos, and install all prerequisites:
create the following:


NEXT STEP
lrwxrwxrwx libnvidia-tls.so.1 -> libnvidia-tls.so.180.29
Code:


#sudo apt-get update
Some files need to be moved to their appropriate place for Ubuntu:


NEXT STEP
mkdir usr/lib/xorg
Code:
mv X11R6/* usr/lib/xorg


#sudo apt-get install –y subversion make g++ gcc gawk pmount libtool nasm automake cmake gperf unzip bison libsdl1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-sound1.2-dev libsdl-stretch-dev libfribidi-dev liblzo-dev libfreetype6-dev libsqlite3-dev libogg-dev libasound-dev python-sqlite libglew-dev libcurl4-gnutls-dev x11proto-xinerama-dev libxinerama-dev libxrandr-dev libxrender-dev libmad0-dev libtre-dev libogg-dev libvorbis-dev libmysqlclient-dev libpcre3-dev libdbus-1-dev libhal-dev libhal-storage-dev libjasper-dev libfontconfig-dev libbz2-dev libboost-dev libfaac-dev libenca-dev libxt-dev libxmu-dev libpng-dev libjpeg-dev wget build-essential linux-headers-`uname -r` xorg pm-utils mingetty
and again some symlinks are to be created:


Please note, that as this is a guide for dedicated HTPC and in this case we mostly need passthrough, I choose NOT to install the libs for Pulseaudio and compile XBMC later without Pulseaudio support. As far I understand, only ALSA is needed in this case.
cd usr/lib/xorg


== To upgrade ALSA ==
lrwxrwxrwx libXvMCNVIDIA.so -> libXvMCNVIDIA.so.1
lrwxrwxrwx libXvMCNVIDIA.so.1 -> libXvMCNVIDIA.so.180.29


I have modified the ALSA upgrade script (available at Ubuntuforums), and now it is working with only “-di” option in our case here (Also on ASUS P5N7A-VM).
cd usr/lib/xorg/modules
lrwxrwxrwx libnvidia-wfb.so -> libnvidia-wfb.so.1
lrwxrwxrwx libnvidia-wfb.so.1 -> libnvidia-wfb.so.180.29


To download and use:
cd usr/lib/xorg/modules/extensions


NEXT STEP
lrwxrwxrwx libglx.so -> libglx.so.1
Code:
lrwxrwxrwx libglx.so.1 -> libglx.so.180.29


#wget http://217.20.138.65/AlsaUpgrade-1.0.x-rev-1.15-Ben.sh


NEXT STEP
Then, the kernel module needs to be compiled and placed in an appropriate location:
Code:


#chmod 777 AlsaUpgrade-1.0.x-rev-1.15-Ben.sh
cd usr/src/nv
make module
mkdir ../../../lib
mkdir ../../../lib/modules
mkdir ../../../lib/modules/2.6.2x-yy-generic
mkdir ../../../lib/modules/2.6.2x-yy-generic/updates
mkdir ../../../lib/modules/2.6.2x-yy-generic/dkms
cp nvidia.ko ../../../lib/modules/2.6.2x-yy-generic/dkms


NEXT STEP
You can now create a new loopfile of a reasonable size (80 MB should work) with:
Code:


#sudo ./AlsaUpgrade-1.0.x-rev-1.15-Ben.sh -di
dd if=/dev/zero of=restrictedDrivers.nvidia.img bs=1M count=80
mkfs.ext3 restrictedDrivers.nvidia.img -F


This mini version of Intrepid has a bug (or maybe a feature), that the user created at installation is not added to the „audio” group. We need the correct this:
and populate it by mounting the image file and copying all the files above:


NEXT STEP
mkdir Image
Code:
mount -o loop restrictedDrivers.nvidia.img Image
cp -RP NVIDIA-Linux-x86-180.29-pkg1/* Image
umount Image


#sudo usermod -a -G audio xbmc


or replace „xbmc” with username you installed with
There is however a final step, ie. having the new module automatically loaded. For this we need to have an updated modules.dep inside the restrictedDrivers.nvidia.img. My way of doing it is to boot XBMCLive with NVIDIA drivers in safe mode, run a "sudo depmod -a" and copy the resulting /lib/modules/2.6.2X-yy-generic/modules.dep over to the same location in build environment again, and reiterate the population of the .img file.


reboot the computer:


NEXT STEP
== Building ATI/AMD video drivers ==
Code:


#sudo reboot
*Method 1: build drivers on XBMCLive


For some reason, the driver snapshot for ALSA 1.0.19 is not always downloading properly; in this case you have to run the script again. To check whether the driver upgraded or not:
*Method 2: build drivers in MIC


NEXT STEP
Assuming you have created a target in MIC for the creation of the XBMCLive image, you need to create a new target having all the necessary development tools ON THE SAME PLATFORM, so that the build target has the same system components as the XBMCLive target.
Code:


#more /proc/asound/version
Once done, copy the driver installer script onto the target and perform the following steps in a chrooted terminal on the build target:


If you see driver version 1.0.19 here, you can continue, but if there is 1.0.17 as driver version, then you have to repeat the last 3 step (upgrade, reboot, check).
mkdir Files
sh ./ati-driver-installer-9-1-x86.x86_64.run --buildpkg Ubuntu/intrepid                                                                                       
dpkg-deb -x fglrx-amdcccle_8.573-0ubuntu1_i386.deb Files                                                                                                           
dpkg-deb -x fglrx-kernel-source_8.573-0ubuntu1_i386.deb Files                                                                                                     
dpkg-deb -x fglrx-modaliases_8.573-0ubuntu1_i386.deb Files                                                                                                         
dpkg-deb -x libamdxvba1_8.573-0ubuntu1_i386.deb Files                                                                                                             
dpkg-deb -x xorg-driver-fglrx_8.573-0ubuntu1_i386.deb Files                                                                                                       
dpkg-deb -x xorg-driver-fglrx-dev_8.573-0ubuntu1_i386.deb Files


If it’s OK, then you can delete the just downloaded ALSA source to free up some disk space:
You have now all the files needed in the "Files" directory, minus the kernel module. In order to create the kernel module we are going to build it manually:


NEXT STEP
cd ./Files                                                                                                                                                           
Code:
pushd .
cd usr/src/fglrx-8.573/
make
popd
mkdir lib
mkdir modules
mkdir 2.6.27-11-generic
mkdir updates
mkdir dkms
mv usr/src/fglrx-8.573/2.6.x/fglrx.ko lib/modules/2.6.27-11-generic/updates/dkms


#sudo rm -r /usr/src/Alsa-1.0.19/
You can now create a new loopfile of a reasonable size (80 MB should work) with:


Now run alsamixer:
dd if=/dev/zero of=restrictedDrivers.amd.img bs=1M count=80
NEXT STEP
mkfs.ext3 restrictedDrivers.amd.img -F
Code:


#alsamixer
and populate it by mounting the image file and copying all the files above:


Navigate right with cursor keys until IEC958 and unmute all three of them (IEC958) with „M” key. You should see in case of all three IEC958 a „00” in green background. Press „ESC” to quit from alsamixer.
mkdir Image
mount -o loop restrictedDrivers.amd.img Image
cp -RP Files/* Image
umount Image


Now, you have to edit the following file, using nano for example:
There is however a final step, ie. having the new module automatically loaded. For this we need to have an updated modules.dep inside the restrictedDrivers.amd.img. My way of doing it is to boot XBMCLive with AMD drivers in safe mode, run a "sudo depmod -a" and copy the resulting /lib/modules/2.6.2X-yy-generic/modules.dep over to the same location in build environment again, and reiterate the population of the .img file.
 
NEXT STEP
Code:
 
#sudo nano /etc/modprobe.d/alsa-base
 
and add this line to the end:
 
Code:
 
options snd-hda-intel model=6stack-dig
 
== To update NVIDIA driver ==
 
NEXT STEP
Code:
 
#wget http://us.download.nvidia.com/XFree86/Linux-x86/180.22/NVIDIA-Linux-x86-180.22-pkg1.run
 
NEXT STEP
Code:
 
#sudo sh NVIDIA-Linux-x86-180.22-pkg1.run
 
In the nvidia installer: accept the License agreement, choose „YES” for „No precompiled kernel interface...”, choose „OK” for „No matching precompiled kernel interface...”, than choose „YES” to update X configuration file, than finally „OK” again at the end.
 
Now you can delete NVIDIA installer
 
NEXT STEP
Code:
 
#rm NVIDIA-Linux-x86-180.22-pkg1.run
 
== To install XBMC (latest SVN) ==
 
NEXT STEP
Code:
 
#svn checkout https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC
 
Wait for downloading XBMC source files, might takes long time, depend on your Internet connection. After it downloaded:
 
NEXT STEP
Code:
 
#cd XBMC
 
OPTIONAL STEP
If you experience problems with Intrepid ffmpeg performance (most probably you will) which is under discussion here: http://forum.xbmc.org/showthread.php?t=43075, you may want to try aron's patch (thank you aron, for this).
 
Please be aware, that this is not supported and not recommended by team-XBMC. If you don't want to install this patch, just skip all the optional steps and jump to the closest "NEXT STEP".
 
OPTIONAL STEP2
Code:
 
#wget http://trac.xbmc.org/raw-attachment/ticket/5680/xbmc_ffmpeg_mt.patch
 
OPTIONAL STEP3
Code:
 
#patch -p0 < xbmc_ffmpeg_mt.patch
 
Then configure/compile/install XBMC:
 
NEXT STEP
Code:
 
#./configure --prefix=/usr --disable-pulse
 
NEXT STEP
Code:
 
#make -j2
 
(NOTE: use only „make”, if you don’t have a dualcore CPU)
This is again, can take a a while, depend on your CPU speed.
 
NEXT STEP
Code:
 
#sudo make install
 
== To autoboot and autostart XBMC ==
 
NEXT STEP
Code:
 
#cd ..
 
Or "cd $home"
 
NEXT STEP
Code:
 
#wget http://217.20.138.65/.xsession
 
NEXT STEP
Code:
 
#sudo nano /etc/event.d/tty2
 
In here comment out the last line (with #) and add the following line. The end of the file should look like this:
 
Code:
 
respawn
#exec /sbin/getty 38400 tty2
exec /sbin/mingetty --autologin xbmc tty2
 
Or replace "xbmc" with the username you installed Ubuntu Mini.
 
NEXT STEP
Code:
 
#sudo nano .bash_profile
 
Copy the following text, then save the file:
 
Code:
 
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty2 ]; then
 
startx -- -br
 
fi
 
== To install Lirc ==
 
NEXT STEP
Code:
 
#sudo apt-get install –y lirc
 
And follow the wizard.
 
== Power Management ==
 
To be able to control power management (suspend, shutdown, reboot) from within XBMC, you have to change PolicyKit.conf
 
NEXT STEP
Code:
 
#sudo wget -P/etc/PolicyKit http://217.20.138.65/PolicyKit.conf
 
If you wish to enable CPU scaling feature:
 
First of all, don’t forget to enable it in the BIOS.
 
Code:
 
#sudo apt-get powernowd
 
== Configure xorg.conf for proper modes to benefit from auto refresh ==
 
This is not an easy part and can differ from display to display.
For myself, I include 3 custom modelines to my xorg.conf for my FullHD plazma screen.
 
If you have a FullHD display, and want to play with my xorg.conf you can replace your xorg.conf with mine:
 
NEXT STEP
Code:
 
#sudo cp /etc/X11.xorg.conf /etc/X11.xorg.conf.backup
 
NEXT STEP
Code:
 
#sudo wget -P/etc/X11 http://217.20.138.65/xorg.conf
 
== Sound configuration in XBMC ==
 
After booted into XBMC switch to „digital” audio output, than choose the AC3 and DTS capabilities according to your receiver.
For SPDIF: leave audio output device: default and passthrough on IEC958
For HDMI: change both audio output device and passthrough to hdmi (you will loose analog sound eg. navigation sound in case of hdmi)

Revision as of 11:40, 20 February 2009

Introduction

The simpler approach to build and install the restricted drivers is to run the driver installer on XBMCLive. The installer will take care of all installations and modify the config files accordingly.

However, this requires that a full build environment has to be available on the system, while the default XBMCLive build does not have the required packages for sake of being as much compact as possible.

As several users have experienced, a full build environment requires around 1 GB of space, and the XBMCLive permanent storage file can be filled up quite easily.

The following procedures are intended to tackle this issue; it has side effects and limitations but once you have a fully working build environment it does not have major disadvantages (IMHO).


Building NVIDIA video drivers

  • Method 1: build drivers on XBMCLive
  • Method 2: build drivers in MIC

Assuming you have created a target in MIC for the creation of the XBMCLive image, you need to create a new target having all the necessary development tools ON THE SAME PLATFORM, so that the build target has the same system components as the XBMCLive target.

Once done, copy the driver installer script onto the target and perform the following steps in a chrooted terminal on the build target:

sh ./NVIDIA-Linux-x86-180.29-pkg1.run --extract-only
cd NVIDIA-Linux-x86-180.29-pkg1
mv * usr/bin

Now a few symlinks need to be created in a few library directories:

cd usr/lib

create the following:

lrwxrwxrwx libcuda.so.1 -> libcuda.so.180.29                                         
lrwxrwxrwx libGLcore.so.1 -> libGLcore.so.180.29                                     
lrwxrwxrwx libGL.so -> libGL.so.1                                                    
lrwxrwxrwx libGL.so.1 -> libGL.so.180.29                                             
lrwxrwxrwx 1 libnvidia-cfg.so -> libnvidia-cfg.so.1                                    
lrwxrwxrwx libnvidia-cfg.so.1 -> libnvidia-cfg.so.180.29                             
lrwxrwxrwx libnvidia-tls.so -> libnvidia-tls.so.1                                    
lrwxrwxrwx libnvidia-tls.so.1 -> libnvidia-tls.so.180.29                             
lrwxrwxrwx libvdpau_nvidia.so -> libvdpau_nvidia.so.1                                
lrwxrwxrwx libvdpau_nvidia.so.1 -> libvdpau_nvidia.so.180.29
lrwxrwxrwx libvdpau.so -> libvdpau.so.1
lrwxrwxrwx libvdpau.so.1 -> libvdpau.so.180.29
lrwxrwxrwx libvdpau_trace.so -> libvdpau_trace.so.1
lrwxrwxrwx libvdpau_trace.so.1 -> libvdpau_trace.so.180.29
cd usr/lib/tls

create the following:

lrwxrwxrwx libnvidia-tls.so.1 -> libnvidia-tls.so.180.29

Some files need to be moved to their appropriate place for Ubuntu:

mkdir usr/lib/xorg
mv X11R6/* usr/lib/xorg

and again some symlinks are to be created:

cd usr/lib/xorg
lrwxrwxrwx libXvMCNVIDIA.so -> libXvMCNVIDIA.so.1
lrwxrwxrwx libXvMCNVIDIA.so.1 -> libXvMCNVIDIA.so.180.29
cd usr/lib/xorg/modules

lrwxrwxrwx libnvidia-wfb.so -> libnvidia-wfb.so.1
lrwxrwxrwx libnvidia-wfb.so.1 -> libnvidia-wfb.so.180.29
cd usr/lib/xorg/modules/extensions
lrwxrwxrwx libglx.so -> libglx.so.1
lrwxrwxrwx libglx.so.1 -> libglx.so.180.29


Then, the kernel module needs to be compiled and placed in an appropriate location:

cd usr/src/nv
make module
mkdir ../../../lib
mkdir ../../../lib/modules
mkdir ../../../lib/modules/2.6.2x-yy-generic
mkdir ../../../lib/modules/2.6.2x-yy-generic/updates
mkdir ../../../lib/modules/2.6.2x-yy-generic/dkms
cp nvidia.ko ../../../lib/modules/2.6.2x-yy-generic/dkms

You can now create a new loopfile of a reasonable size (80 MB should work) with:

dd if=/dev/zero of=restrictedDrivers.nvidia.img bs=1M count=80
mkfs.ext3 restrictedDrivers.nvidia.img -F

and populate it by mounting the image file and copying all the files above:

mkdir Image
mount -o loop restrictedDrivers.nvidia.img Image
cp -RP NVIDIA-Linux-x86-180.29-pkg1/* Image
umount Image


There is however a final step, ie. having the new module automatically loaded. For this we need to have an updated modules.dep inside the restrictedDrivers.nvidia.img. My way of doing it is to boot XBMCLive with NVIDIA drivers in safe mode, run a "sudo depmod -a" and copy the resulting /lib/modules/2.6.2X-yy-generic/modules.dep over to the same location in build environment again, and reiterate the population of the .img file.


Building ATI/AMD video drivers

  • Method 1: build drivers on XBMCLive
  • Method 2: build drivers in MIC

Assuming you have created a target in MIC for the creation of the XBMCLive image, you need to create a new target having all the necessary development tools ON THE SAME PLATFORM, so that the build target has the same system components as the XBMCLive target.

Once done, copy the driver installer script onto the target and perform the following steps in a chrooted terminal on the build target:

mkdir Files
sh ./ati-driver-installer-9-1-x86.x86_64.run --buildpkg Ubuntu/intrepid                                                                                        
dpkg-deb -x fglrx-amdcccle_8.573-0ubuntu1_i386.deb Files                                                                                                            
dpkg-deb -x fglrx-kernel-source_8.573-0ubuntu1_i386.deb Files                                                                                                       
dpkg-deb -x fglrx-modaliases_8.573-0ubuntu1_i386.deb Files                                                                                                          
dpkg-deb -x libamdxvba1_8.573-0ubuntu1_i386.deb Files                                                                                                               
dpkg-deb -x xorg-driver-fglrx_8.573-0ubuntu1_i386.deb Files                                                                                                         
dpkg-deb -x xorg-driver-fglrx-dev_8.573-0ubuntu1_i386.deb Files 

You have now all the files needed in the "Files" directory, minus the kernel module. In order to create the kernel module we are going to build it manually:

cd ./Files                                                                                                                                                            
pushd .
cd usr/src/fglrx-8.573/
make
popd
mkdir lib
mkdir modules
mkdir 2.6.27-11-generic
mkdir updates
mkdir dkms
mv usr/src/fglrx-8.573/2.6.x/fglrx.ko lib/modules/2.6.27-11-generic/updates/dkms

You can now create a new loopfile of a reasonable size (80 MB should work) with:

dd if=/dev/zero of=restrictedDrivers.amd.img bs=1M count=80
mkfs.ext3 restrictedDrivers.amd.img -F

and populate it by mounting the image file and copying all the files above:

mkdir Image
mount -o loop restrictedDrivers.amd.img Image
cp -RP Files/* Image
umount Image

There is however a final step, ie. having the new module automatically loaded. For this we need to have an updated modules.dep inside the restrictedDrivers.amd.img. My way of doing it is to boot XBMCLive with AMD drivers in safe mode, run a "sudo depmod -a" and copy the resulting /lib/modules/2.6.2X-yy-generic/modules.dep over to the same location in build environment again, and reiterate the population of the .img file.