Skip to content

Preparing Getting BuildKit

Mingcong Bai edited this page Jan 1, 2017 · 4 revisions

Getting BuildKit

BuildKit is provided/shipped in two ways.

Tarballs

BuildKit was only provided in tarballs (.tar.xz) containing a system root filesystem ready for Chroot or systemd-nspawn (native architecture only). Tarballs can be fetched here.

Always grab the newest one available, by looking at the dates in the filenames.

Docker

BuildKit for AMD64 is available as a Docker Image, they are available at DockerHub as the newest tarballs are released. Simply grab it with the following command.

docker pull aosc/aosc-os-buildkit

And you are ready to roll, ignore the "Deploying" section below.

Deploying

As discussed in What is BuildKit?, BuildKit is available in different architectures, therefore it is available to be deployed on machines/devices of their respective architectures. However, thanks to the infamous power of Qemu user-mode emulation, it is also possible to run BuildKit from a foreign architecture on AOSC OS AMD64.

Here below discusses various different ways to deploy BuildKit.

Chroot

A chroot on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children. A program that is run in such a modified environment cannot name (and therefore normally cannot access) files outside the designated directory tree. The term "chroot" may refer to the chroot(2) system call or the chroot(8) wrapper program. The modified environment is called a "chroot jail".

-- Chroot at Wikipedia

To chroot into BuildKit, you will need to find a directory, say, /buildkit (the procedures described below assume that you are using this directory). And unpack the BuildKit tarball.

mkdir /buildkit
cd /buildkit
tar xf /path/to/downloaded/tarball/${buildkit-tarball}
# Use the "v" parameter for a much more exciting experience.

And mount necessary virtual filesystems.

cd /buildkit
mount --rbind /dev dev # Necessary for programs that requires terminal access,
                       # like make and screen.
mount --bind /proc proc # Mono and Node.js/NPM, etc.

And you are ready to chroot.

chroot /buildkit

Foreign architectures

For AOSC OS, you will need to install qemu-user-static before you chroot.

systemd-nspawn

As controversial as it is, systemd-nspawn is probably a much easier way to enter BuildKit. Simply enter the command below if the distribution you are using supports systemd and comes with systemd-nspawn.

systemd-nspawn -b -D /buildkit
#  -D --directory=PATH       Root directory for the container
#  -b --boot                 Boot up full system (i.e. invoke init)

And you are good to go.

Limitation

The systemd-nspawn method is not available if the BuildKit is of foreign architectures.

All green, Cadet

Grab the tools, and Cadet, your training will be officially started.