Skip to content

Building XBian packages

Manfred Kreisl edited this page Jan 18, 2021 · 59 revisions

this workflows and tools delivered by XBian are still under testing/development. structures, commands, requirement may change anytime without prior notice. if inconsistence is found or bug within scripts it has to be reported as for any other XBian component at git's issue tracker. at this very moment not all XBian repositories have been converted to the new structure. as the toolchain matures, we are adding more repositories

if you hit into any troubles be sure you are running latest code / configs from git. that means enter your xbian dir and issue "git pull". of course do that for each repo/pkgconfig you have cloned under xbian directory. as this is still at early stages of development, although already doing what it should, scripts and also configurations are changing as we are adding new packages. if even then build/command is failing, don't hesitate and report bug at issues

XBian actually only contains a small set of applications and tools presented to the user under the form of deb packages, installable on top of a Debian-based GNU/Linux distribution:

All of the CuBox-i devices are supported: Solo, Dual Lite, Dual, Quad and even the HummingBoard.

Until decided otherwise, as you may have noticed the 2 platforms use different Debian versions.

Fortunately both ARM architectures, ARMv6 for the Raspberry Pi Model 1 and ARMv7 for CuBox-i (i.MX6) and Raspberry Pi Model 2, 3 and 4, are binary-compatible, so there's no need to compile each binary twice. It's only needed in case the target systems use different libraries so the binary would be linked wrong or there is benefit using special instruction set (neon) or other cpu optimizations which are breaking this arm compatibility (it is the case of XBMC for instance).

Repositories

All of XBian's packages have their own repository. Each repository contains all the necessary build configuration, patches and scripts to allow easy building and deployment. All packages follow the same structure and all can be processed automatically by XBian's build scripts located at xbianonpi/xbian.

I wanna be a developer or create my own package

If you want to participate in the development of XBian (we'd be more than happy!) or just want to build a package for your own private use, that's so easy:

  1. you need a build system: any GNU/Linux is fine. CPU architecture is not relevant: x86_64, Sparc or even ARM). Only initial requirement is a connection to the Internet, git client tools installed and other dependencies such as lzop. On Debian/Ubuntu and other deb-like distributions, these tools should be installable via:
sudo apt-get install schroot debootstrap git lzop qemu-user-static autoconf libtool build-essential autopoint swig pkg-config sudo fakeroot
  1. once installed, let's clone xbianonpi/xbian repository. it contains XBian scripts to deploy build environment, build single XBian components or even create ready to use XBian Images. Let's do
git clone --depth 5 https://github.com/xbianonpi/xbian 
  1. just for the very first time, we need to install few packages and initialise local configuration.
cd xbian; sudo -E ./run.me prepare

this command needs to be run with root privileges. most likely we were asked to re-login - so do logout and login back.

  1. before we can start building any particular package/component, we need to prepare build environment. mostly compilers, development libraries. this will be created automatically, we just need to specify what targets we wan't to build later - if we are interested in Raspberry Model 1 development, then platform will be armhfstretchv6, if Cubox-i or Raspberry Model 2 and 3 is desired, then armhfstretch or amd64stretch [1].

this applies generally for all XBian repositories but xbian-package-kernel. that is only package which is not dependent on buildroot and needs only arm-gnueabi cross-compiler installed.

[1] amd64stretch uses cross-compiling for building and is in comparism to the prior build method extremely faster, but only usable for SolidRun's CuBox-i and Raspberry Pi Model 2 and 3)

cd $XBIANROOT/xbian-prep-root; sudo -E $xbiangit --arch [platform] --action build

in case we have use for both, we can omit the the parameter and just $xbiangit --action build will prepare both. (each build environment will take approx 700M-1G of space). this command needs to be run with root privileges.

  1. now that we have build system ready, we can clone specific package recipes and start the build. let's return back into xbianonpi/xbian root directory and clone XBian repository of our interest (in this example XBMC).
cd ..; git clone https://github.com/xbianonpi/xbian-package-xbmc.git
  1. once finished, let's build the default (Isengard branch).
cd xbian-package-xbmc; $xbiangit --arch rpi-isengard --action build
  1. finished package, installable locally with dpkg is always moved into ./build/$arch directory. if we compiled for "rpi-isengard", all will look like this.
dpkg -i ./build/rpi-isengard/xbian-package-xbmc.deb

the behaviour of the scripts can be set in many ways through config files which are part of build package (nit the scripts), but by default they come preconfigured for following actions: a) original sources are cloned locally b) XBian patches and changes are applied c) sources are preconfigured & configured with XBian's settigs d) sources are build e) binaries are 'installed' into package template dir f) package is build and compressed into single .deb file

when building packages and ommiting --arch parameter, all preconfigured architectures and branches will be build. this varies from package to package, but in general minimum is "rpi" and "imx6". to list available configurations, we can use -l or --list (we need to be inside cloned repository). in case we just cloned lirc, we have to do:

cd xbian-package-lirc; $xbiangit --list

mk & anaconda 2014, updated by mkreisl 2016-2021