2016-05-02, 00:40
Finally got this done. I originally used the Kodi15.txt guide floating around, but found that some packages weren't in the new Xenial repos.. specifically, liblockdev1-dev. Looking at the dependency list in the readme's that come with the Kodi source, and it seems that package isn't even needed. Maybe in older versions, but not the newer releases. So... removed that from my apt list, and the build went fine.
I do my set up a little differently. I use an external usb ssd drive, as well as a usb stick formatted to swap. I monitored the system resources during a build once... 1gb of swap was used at the highest point. Definitely helpful. The way I set up the os on the external ssd... flash the image to both the microsd, and the external drive, then edit the /boot/cmndline.txt on the microsd to point root to the 2nd partition of the external drive. It's always /dev/sda2. Even if adding other usb drives, I've never had the os disk change dev id's. The swap usb.. that's another story. I use UUID=xxx in my fstab. Otherwise, I'd lose my swap if I plugged in another usb stick just to transfer files. Also, I've tried with the swap on the os's ssd itself, but it actually runs better with a separate drive for the swap.
edit: I use a powered usb hub for the ssd and usb swap drive, as well as my Hauppauge ATSC tv tuner. If you use external drives, use a powered hub. The Pi itself may not supply enough power for both the Pi, and the drives.
Here's my steps... modify as needed.
Flash Ubuntu Mate 16.04 image to microsd
- edit /boot/config.txt
arm_freq=900
gpu_mem=256
max_usb_current=1
** note.. I use gpu_mem=256mb right out of the box, and have never had a freeze during a compile using -j4 (all 4 cores). On Ubuntu that is... Raspbian would still freeze, unless dropped down to -j3 (3 cores). Popcornmix says you can drop down to 16mb for the build, then increase back up when you're done. It's up to you.
Flash same image to external drive, then open with gparted - expand root partition to use the entire disk.
Upon first boot...
That's it. Pretty easy, really. Should take about 4 hours in total... still quicker than cross-compiling from an Ubuntu pc.
Enjoy
edit: a manual fix for the black screen when exiting Kodi: [ctrl]+[alt]+[f8] followed by [ctrl]+[alt]+[f7]. There's scripts, but they didn't always work for me. This was just as quick.
I do my set up a little differently. I use an external usb ssd drive, as well as a usb stick formatted to swap. I monitored the system resources during a build once... 1gb of swap was used at the highest point. Definitely helpful. The way I set up the os on the external ssd... flash the image to both the microsd, and the external drive, then edit the /boot/cmndline.txt on the microsd to point root to the 2nd partition of the external drive. It's always /dev/sda2. Even if adding other usb drives, I've never had the os disk change dev id's. The swap usb.. that's another story. I use UUID=xxx in my fstab. Otherwise, I'd lose my swap if I plugged in another usb stick just to transfer files. Also, I've tried with the swap on the os's ssd itself, but it actually runs better with a separate drive for the swap.
edit: I use a powered usb hub for the ssd and usb swap drive, as well as my Hauppauge ATSC tv tuner. If you use external drives, use a powered hub. The Pi itself may not supply enough power for both the Pi, and the drives.
Here's my steps... modify as needed.
Flash Ubuntu Mate 16.04 image to microsd
- edit /boot/config.txt
arm_freq=900
gpu_mem=256
max_usb_current=1
** note.. I use gpu_mem=256mb right out of the box, and have never had a freeze during a compile using -j4 (all 4 cores). On Ubuntu that is... Raspbian would still freeze, unless dropped down to -j3 (3 cores). Popcornmix says you can drop down to 16mb for the build, then increase back up when you're done. It's up to you.
Flash same image to external drive, then open with gparted - expand root partition to use the entire disk.
Upon first boot...
Code:
$ sudo apt-get install cpufrequtils
$ sudo nano /etc/init.d/cpufrequtils
GOVERNOR="performance"
$ sudo update-rc.d ondemand disable
$ sudo reboot
$ cpufreq-info
ubuntu@mate:~$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to [email protected], please.
analyzing CPU 0:
driver: BCM2835 CPUFreq
CPUs which run at the same hardware frequency: 0 1 2 3
CPUs which need to have their frequency coordinated by software: 0 1 2 3
maximum transition latency: 355 us.
hardware limits: 600 MHz - 900 MHz
available frequency steps: 600 MHz, 900 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 600 MHz and 900 MHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 900 MHz.
cpufreq stats: 600 MHz:1.74%, 900 MHz:98.26% (1)
analyzing CPU 1:
driver: BCM2835 CPUFreq
CPUs which run at the same hardware frequency: 0 1 2 3
CPUs which need to have their frequency coordinated by software: 0 1 2 3
maximum transition latency: 355 us.
hardware limits: 600 MHz - 900 MHz
available frequency steps: 600 MHz, 900 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 600 MHz and 900 MHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 900 MHz.
cpufreq stats: 600 MHz:1.74%, 900 MHz:98.26% (1)
analyzing CPU 2:
driver: BCM2835 CPUFreq
CPUs which run at the same hardware frequency: 0 1 2 3
CPUs which need to have their frequency coordinated by software: 0 1 2 3
maximum transition latency: 355 us.
hardware limits: 600 MHz - 900 MHz
available frequency steps: 600 MHz, 900 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 600 MHz and 900 MHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 900 MHz.
cpufreq stats: 600 MHz:1.74%, 900 MHz:98.26% (1)
analyzing CPU 3:
driver: BCM2835 CPUFreq
CPUs which run at the same hardware frequency: 0 1 2 3
CPUs which need to have their frequency coordinated by software: 0 1 2 3
maximum transition latency: 355 us.
hardware limits: 600 MHz - 900 MHz
available frequency steps: 600 MHz, 900 MHz
available cpufreq governors: conservative, ondemand, userspace, powersave, performance
current policy: frequency should be within 600 MHz and 900 MHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 900 MHz.
cpufreq stats: 600 MHz:1.74%, 900 MHz:98.26% (1)
ubuntu@mate:~$
$ sudo apt-get install gparted synaptic
$ sudo synaptic
- select usb swap drive
- right click drive window
- select "Swapon"
- select "Information"
- copy UUID id
$ sudo nano /etc/fstab
UUID=597b4b5b-91e0-4c5e-b1c3-b1cbfea57790 none swap sw 0 0
$ sudo reboot
$ free mem
ubuntu@mate:~$ free mem
total used free shared buff/cache available
Mem: 948016 183272 395040 10708 369704 727464
Swap: 7576572 0 7576572
ubuntu@mate:~$
right-click taskbar, add:
- CPU Frequency Scaling Monitor
- System Monitor
open System - Control Center
- disable screen saver and power management
right-click Workspace on bottom panel
- reduce to 1 workspace
$ sudo synaptic
Settings - Repositories
- Ubuntu Software - enable all
- Other Software - enable all
- Updates - Important & Recommended only
close Synaptic
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo rpi-update
$ sudo reboot
$ sudo apt-get install build-essential make git-core checkinstall libboost1.58-all-dev swig curl libgnutls-dev libxml2-dev libxslt1-dev libfreetype6-dev libfontconfig1-dev libfribidi-dev libmpeg2-4-dev libmad0-dev libjpeg8-dev libsamplerate0-dev libogg-dev libvorbis-dev libflac-dev libtiff5-dev liblzo2-dev cmake zip unzip libsqlite3-dev libpng12-dev libpcre3-dev libjasper-dev libsdl1.2-dev libsdl-image1.2-dev libass-dev libmodplug-dev libcdio-dev libtinyxml2-dev libyajl-dev libgpg-error-dev libgcrypt11-dev libmicrohttpd-dev autoconf libtool autopoint libudev-dev python-dev python-imaging libmysqlclient-dev libcurl4-gnutls-dev libbz2-dev libtinyxml-dev libssh-dev libxrandr-dev libsmbclient-dev libcap-dev gawk gperf debhelper libiso9660-dev ccache default-jre doxygen librtmp-dev libnfs-dev libgif-dev libplist-dev libshairport-dev libbluray-dev libbluray1 libbluetooth-dev uuid-dev libtag1-dev libspeex-dev
$ git clone --recursive git://github.com/Pulse-Eight/libcec.git
$ cd libcec/src/platform && mkdir build && cd build && cmake ..
$ make -j4
$ sudo make install && cd
$ cd libcec && mkdir build && cd build && cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib ..
$ make -j4
$ sudo make install && cd
$ git clone -b master git://github.com/xbmc/xbmc.git kodi
$ sudo make -C kodi/tools/depends/target/crossguid PREFIX=/usr/local
$ cd kodi/project
$ git clone -b master https://github.com/kodi-pvr/pvr.hts.git
$ cmake -DADDONS_TO_BUILD=pvr.hts -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../kodi/addons -DPACKAGE_ZIP=1 ../../kodi/project/cmake/addons
$ make
$ cd ..
# git clean -xfd && git reset --hard
# make clean && ccache -cC
$ nano tools/depends/target/ffmpeg/autobuild.sh
add to the rest below "./configure --prefix=$FFMPEG_PREFIX \"
--enable-libspeex \
$ ./bootstrap
$ CFLAGS="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -mfloat-abi=hard -mcpu=cortex-a7 -mfpu=neon-vfpv4" CXXFLAGS="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -mfloat-abi=hard -mcpu=cortex-a7 -mfpu=neon-vfpv4" LDFLAGS="-L/opt/vc/lib" FFMPEG_OPTS="--cpu=cortex-a7" ./configure --disable-gl --enable-gles --with-platform=raspberry-pi2 --disable-x11 --disable-vaapi --disable-vdpau --disable-avahi --enable-libcec --disable-pulse --enable-optical-drive --enable-libusb --disable-vtbdecoder --enable-alsa --enable-player=omxplayer --enable-libbluray --with-ffmpeg=auto
$ make -j3
$ strip kodi.bin
$ sudo checkinstall
# fix keyboard privelages for user 'ubuntu'
$ sudo usermod -aG tty ubuntu
$ sudo su -c 'echo "KERNEL==\"tty[0-9]*\", GROUP=\"tty\", MODE=\"0660\"" >> /etc/udev/rules.d/99-input.rules'
------------------------
Kodi Configuration:
------------------------
Kodi Version: 17.0-ALPHA1
git Rev.: 20160501-0bae239
Debugging: Yes
Profiling: No
Optimization: Yes
SWIG Available: Yes
JRE Available: Yes
Doxygen Available: Yes
Crosscomp.: No
target ARCH: arm
target CPU: cortex-a7
OpenGLES: Yes
ALSA: Yes
DBUS: Yes
VDPAU: No
VAAPI: No
OpenMax: No
X11: No
Bluray: Yes
TexturePacker:Yes
MID Support: No
ccache: Yes
ALSA Support: Yes
PulseAudio: No
Google Test Framework Configured: Yes
Google Breakpad Configured: No
Avahi: No
mDNSEmbedded: No
Non-free: Yes
MySQL: Yes
Webserver: Yes
libssh support: Yes
libRTMP support: Yes
libsmbclient support: Yes
libnfs client support:Yes
AirPlay support: Yes
AirTunes support: No
UPnP support: Yes
Optical drive: Yes
libudev support: Yes
libusb support: No
libcec support: Yes
libbluetooth support: Yes
libcap support: Yes
additional players: Yes, omxplayer
additional codecs: No
prefix: /usr/local
------------------------
tvheadend backend server:
sudo apt-get install liburiparser-dev libavcodec-dev libavformat-dev libswscale-dev libavresample-dev libhdhomerun-dev dvb-apps libkqueue-dev fakeroot libavahi-client-dev
# for latest release
$ git clone https://github.com/tvheadend/tvheadend.git
# for 4.0.9 release
$ git clone -b release/4.0 https://github.com/tvheadend/tvheadend.git
# personally, I use 4.0.8
https://github.com/tvheadend/tvheadend/archive/v4.0.8.tar.gz
$ cd tvheadend (whatever the version)
$ ./Autobuild.sh && cd
# you'll have 2 packages in your home directory..
# tvheadend*.deb, and tvheadend-dbg*.deb
# Select the tvheadend*.deb
$ sudo dpkg -i tvheadend (whatever the version).deb
That's it. Pretty easy, really. Should take about 4 hours in total... still quicker than cross-compiling from an Ubuntu pc.
Enjoy
Code:
http://www.gadgetguy.com.au/cms/wp-content/uploads/2015/12/sandisk-extreme-500-portable-ssd-2015-review-04-450x253.jpg
Code:
https://www.adafruit.com/products/961
edit: a manual fix for the black screen when exiting Kodi: [ctrl]+[alt]+[f8] followed by [ctrl]+[alt]+[f7]. There's scripts, but they didn't always work for me. This was just as quick.