YBD

If you want to build Baserock definitions on other Linux systems or in the cloud, take a look at ybd.

ybd is a re-implementation of the core build and deploy functionality from morph, designed to run with minimal dependencies on other operating systems. Although it is relatively new, ybd can build and deploy most of the baserock definitions, and it is faster than morph for some use-cases.

Note that first time through ybd needs to clone a lot of git repos, which can take quite a long time. And building a whole system can take a lot of time too. If you use current definitions there is an artifact cache which can speed up the initial build dramatically.

The recommended 'version' of ybd at any given time is the latest release tag at http://gitlab.com/baserock/ybd

Getting Started with ybd and Vagrant

After installing vagrant from http://www.vagrantup.com/downloads

git clone https://gitlab.com/baserock/ybd.git
cd ybd
vagrant up
vagrant ssh

# and in the vagrant box
sudo -i
cd /src/definitions
/src/ybd/ybd.py systems/build-system-x86_64.morph x86_64

Getting Started with ybd on AWS

# Get dependencies
yum install make automake gcc gcc-c++ kernel-devel git gawk python-pip
pip install fs pyyaml sandboxlib jsonschema requests

# Get ybd
git clone https://gitlab.com/baserock/ybd.git    
# edit ybd/ybd.conf and set base: '/src'
# if your machine is big enough, ybd can be configured to run parallel instances,
# by setting instances: to int(cores/8)

# Get definitions
git clone git://git.baserock.org/baserock/baserock/definitions
cd definitions

# run ybd
../ybd/ybd.py systems/build-system-x86_64.morph x86_64

Getting Started with ybd on Scaleway

# Choose a Fedora image (we could not get stock Ubuntu to work)
# then after ssh root@your.ip.address
dnf install which make automake gcc gcc-c++ gawk git m4
# add extra volume for /src
mkfs -t ext4 /dev/nbd1
mkdir /src
mount /dev/nbd1 /src

# optionally add swap
# mkswap /dev/nbd2
# swapon /dev/nbd2

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py    
pip install fs pyyaml sandboxlib jsonschema requests bottle

cd /src
git clone https://gitlab.com/baserock/ybd.git
git clone git://git.baserock.org/baserock/baserock/definitions
echo "base: /src" > ybd/ybd.conf

cd definitions
../ybd/ybd.py systems/genivi-baseline-system-armv7lhf-jetson armv7lhf


# Debian, Ubuntu - unfortunately this doesn't work for Baserock definitions.
# some thumb compiler bug
# apt-get update; apt-get install build-essential gawk git m4

Getting Started with ybd on DataCentred ARM Cloud (ARMv8)

# Ubuntu
apt-get update; apt-get install build-essential gawk git m4

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py    
pip install fs pyyaml sandboxlib jsonschema requests bottle

mkdir /src
cd /src
git clone https://gitlab.com/baserock/ybd.git
git clone git://git.baserock.org/baserock/baserock/definitions
echo "base: /src" > ybd/ybd.conf

cd definitions
/src/ybd/ybd.py systems/devel-system-armv8l64.morph armv8l64

Getting Started with ybd on DataCentred ARM Cloud (ARMv7)

These instructions are based on James Thomas' original instructions to create a chroot.

# as root...
wget http://download.baserock.org/baserock/baserock-current-build-system-armv7lhf-jetson.img.gz
gunzip baserock-current-build-system-armv7lhf-jetson.img.gz
mkdir -p /src/armv7chroot
mount ./baserock-current-build-system-armv7lhf-jetson.img /mnt
cp -r /mnt/systems/default/run/* /src/armv7chroot
# linux-user-chroot mounts don't seem to work here, so let's use chroot....
mv /src/armv7chroot/usr/bin/linux-user-chroot /src/armv7chroot/usr/bin/linux-user-chroot.gone
#

Put the following into a new file /src/armv7chroot/launch.sh

#!/bin/bash
cd /src/armv7chroot
cp /etc/resolv.conf etc/
mount -o bind /dev dev/
mount -o bind /proc proc/
mount --bind . . && chroot . /bin/sh

Now launch it with linux32

chmod +x /src/armv7chroot/launch.sh
/usr/bin/linux32 -B /src/armv7chroot/launch.sh

Then in the chroot you can do 'normal' ybd setup...

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py    
pip install ps pyyaml sandboxlib jsonschema requests bottle
#

mkdir /src
cd /src
git clone https://gitlab.com/baserock/ybd.git
git clone git://git.baserock.org/baserock/baserock/definitions
echo "base: /src" > ybd/ybd.conf
/src/ybd/ybd.py systems/build-system-armv7lhf-jetson.morph
#

Artifact cache

There is a cache of ybd built artifacts for x86_64 and ARMv7 systems at http://artifacts1.baserock.org:8000/*

Downloading artifacts can be much faster than building them for some situations so if you want to use the artifact cache, do the following:

echo "kbas-url: http://artifacts1.baserock.org:8000/" >> /src/ybd/ybd.conf