Jessie systemd container

These instructions will give you a container capable of building the jethro based OpenXT repo that was merged on February 4, 2016.    If you wish to reuse an old container you must at least update GCC to 4.9.2 and binutils to 2.25.

1) Install debootstrap on your host.  Below is an example of doing so in ArchLinux from AUR (Arch specific step). The Arch method will vary on if you use yaourt or have added the repo for use with pacman.

yaourt debootstrap

2) Download the Debian Jessie rootfs.

sudo debootstrap --arch=i386 jessie ./jessie-i386-01

3) Start the container.

sudo systemd-nspawn --personality=x86 -D ./jessie-i386-01/

4) Update apt.

apt-get update

5) Install OE dependencies.

apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm

6) Install additional OpenXT dependencies.

apt-get install vim sed wget cvs subversion coreutils texi2html docbook-utils python-pysqlite2 help2man desktop-file-utils cpio sudo rpm curl guilt iasl quilt bin86 bcc liburi-perl genisoimage policycoreutils libncurses5-dev

7) The version of GHC in Jessie is not capable of building the GHC 6.12.1 we use for OpenXT. Therefore we need to install the last version of GHC 6 (6.12.3) into the container. GHC uses GHC to compile GHC! Download the three prerequisite packages for GHC 6.12.3 and install them.

dpkg -i libgmpxx4ldbl_4.3.2+dfsg-1_i386.deb libgmp3c2_4.3.2+dfsg-1_i386.deb libgmp3-dev_4.3.2+dfsg-1_i386.deb

8) Download and install GHC 6.12.3.

cd /tmp
wget http://www.haskell.org/ghc/dist/6.12.3/ghc-6.12.3-i386-unknown-linux-n.tar.bz2  
tar jxf ghc-6.12.3-i386-unknown-linux-n.tar.bz2  
cd ghc-6.12.3  
./configure --prefix=/usr  
make install

9) Create a build user.

adduser build

10) Set the default shell to bash. (Answer no to letting dash be the shell)

dpkg-reconfigure dash

11) If /etc/mtab does not exist, create it. Rootfs steps will fail if it is missing.

ln -s /proc/mounts /etc/mtab

12) Skip to step 12 if not sharing any directories from outside the container or if you bound them already in step 3. If you intend to bind the directories within the build user's home directory, you need to wait until it was created in step 7 to bind. The directory will be bound to the exact same path. Exit the container and restart it, binding any existing directories to use within the container, i.e. OE download cache. Hit CTRL-[ three times to exit container and then restart it, binding the directories.

sudo systemd-nspawn --bind=/<path-to-oe-download-cache> --personality=x86 -D ./jessie-i386-01/

13) Become the build user.

su build
cd ~

14) Clone the OpenXT repo.

git clone https://github.com/OpenXT/openxt.git

15) Create your .config file. Change any settings needed now.

cp example-config .config

16) Generate your signing certs per https://github.com/OpenXT/openxt/wiki/Building-OpenEmbedded. Remember, you can use the bind parameter for systemd-nspawn to reuse an existing set of certs that are outside the container. Make sure to add the certificate locations to .config.

17) Run the setupoe step.

do_build.sh -s setupoe

18) If you are sharing an OE download cache directory, make sure to set it in build/conf/local.conf.

DL_DIR = "/<path-to-OE-download-cache>"

19) Build OpenXT.

Build Notes

When running do_build.sh, either change the list of steps at the beginning of the script to what you need or specify them manually via -s. An example is below.

./do_build.sh -s initramfs,stubinitramfs,dom0

To build or clean individual recipes you can use the bb wrapper script. An example is below.

cd build
DISTRO="openxt-main" MACHINE="<machine type>" ./bb -c cleansstate <recipe-name>

If you build a recipe, such as dom0, in this way you will need to run that recipe's copy step in the do_build.sh script before rerunning the ship step (generates iso). Look at the do_build.sh script to see which steps also have a copy step.

DISTRO="openxt-main" MACHINE="xenclient-dom0" ./bb xenclient-dom0-image
cd ..  
./do_build.sh -s dom0cp,ship