Compile from source
| 20px | ▶ Compile from source |
First of all, you need to have a recent Linux distribution, Fedora 20/21, Ubuntu 14.04, ARCH Linux, SuSE Linux) and at least 12 GB of free space.
Contents
Cross Compiling and Build Systems
The heart of the OpenELEC project is our software build system. It supports a software building technique called cross-compiling; the process of creating executable code that runs on one hardware platform from something other than that platform. Cross compiling is a crucial function for the OpenELEC project for the following reasons:
- It allows us to build 32bit and 64bit packages and OpenELEC images. It does not matter whether the build-host itself is 32bit or 64bit.
- It allows us to build OpenELEC for a range of different CPU architectures like x86, ARM and PowerPC. This tutorial will help you cross compile an ARM compatible OpenELEC image from an x86 compatible build-host.
- There is no dependency on the particular versions of compiler, libc and Linux kernel headers installed on the build-host. We cross-compile our own versions to ensure we always produce consistent and properly built software packages.
- It allows you to run any Linux distribution as your build system. No matter what your personal preference the resulting OpenELEC image will always be the same.
- It allows us to use the full power of the build-host. Like most ARM devices the Raspberry Pi does not have super fast CPU’s or lots of memory and it uses low-cost but slow USB and flash-card memory for storage; making it unsuitable for native building of large and complex software. Other Linux distributions targetting Raspberry Pi plan to use emulator tools like QEMU that were designed to test and run small software projects to build a full Operating System and it scares us to think how slow and error prone this will be. Even a highly optimised “minimalist” OS like OpenELEC involves the creation of ~500,000 small files during compilation so it’s simple common sense to cross compile and leverage the significantly better resources of a fast local build-host.
Tools you'll need
Start by updating your system (on Ubuntu or other Debian-based distribution):
Note: Debian does not need "sudo" however the commands are identical once sudo is removed
Note: at least gcc-4.7 is required.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install make
Reconfigure to bash so we have best possible script compatibility
sudo dpkg-reconfigure dash
and select no, to install bash as the default
Then, install build tools
Ubuntu 14.04 +
you will need libxml-parser-perl
sudo apt-get install libxml-parser-perl
Fedora 21 Workstation
yum install autoconf automake binutils cpp cvs gcc gcc-c++ glibc-devel glibc-headers glibc-static kernel-devel kernel-headers \
libmpc libstdc++-devel libstdc++-static ncurses-devel perl-libintl perl-Test-Harness perl-Text-Unidecode \
perl-Thread-Queue texinfo
Download OpenELEC from Github
git clone https://github.com/OpenELEC/OpenELEC.tv.git
A new folder called OpenELEC.tv will be created.
Start compiling
Be sure to have lot of free space - at least 15 GB. Better more than less.
In a terminal go to the folder that was just created
cd OpenELEC.tv
Option 1: To build a bootable disk and update image for 64bit computer with AMD or modern Nvidia cards that are not listed here http://www.nvidia.com/object/IO_32667.html :
PROJECT=Generic ARCH=x86_64 make image
Option 2: To build a bootable disk and update image for 64bit computer with old Nvidia GPU that are listed under secion 304.xx and few newer ones here http://www.nvidia.com/object/IO_32667.html :
PROJECT=Nvidia_Legacy ARCH=x86_64 make image
Option 3: To build a bootable disk and update image for raspberry pi:
PROJECT=RPi ARCH=arm make image
Option 4: To build a bootable disk and update image for raspberry pi2:
PROJECT=RPi2 ARCH=arm make image
Option 5: To build a bootable disk and update image for WeTek Play:
PROJECT=WeTek_Play ARCH=arm make image
Option 6: To build a bootable disk and update image for Freescale iMX6:
PROJECT=imx6 ARCH=arm make image
Take a break after hitting return.
When the build completes, you will find the fresh build in the target directory of your build directory OpenELEC.tv/target/
If you need to clean and start over do the following
make clean
and then start the build process again.
Installing
See,