Building and booting
One command builds the image: the machine's file and the form's, joined by a colon, both named from
the directory the layers are in, and the build goes into KAS_BUILD_DIR (where the build
goes). kas checks the layers out if they are not, writes the configuration,
and runs BitBake; the first build of a machine takes hours, and one after it minutes.
- QEMU
- Raspberry Pi 5
QEMU emulates a machine on this one, and the build makes the QEMU it boots with. qemux86-64 is a
64-bit x86 machine, which a 64-bit x86 build machine runs at nearly its own speed with KVM; qemuarm64
is a 64-bit Arm machine, emulated instruction by instruction, whose boot takes minutes.
machine=qemux86-64
export KAS_BUILD_DIR="$HOME/yoke-yocto/build-$machine"
- Locally
- In a container
kas build meta-yoke/kas/$machine.yml:meta-yoke/kas/$form.yml
./kas-container build meta-yoke/kas/$machine.yml:meta-yoke/kas/$form.yml
The image is under $KAS_BUILD_DIR/tmp/deploy/images/$machine/, as $image-$machine.rootfs.ext4. Boot it
with runqemu, in the build's environment, which kas shell sets up; the console is this terminal:
- Locally
- In a container
kas shell meta-yoke/kas/$machine.yml:meta-yoke/kas/$form.yml -c "runqemu $machine $image ext4 nographic slirp kvm"
./kas-container --runtime-args "--device /dev/kvm" shell meta-yoke/kas/$machine.yml:meta-yoke/kas/$form.yml \
-c "runqemu $machine $image ext4 nographic slirp kvm"
kvm and the device are for qemux86-64 on a machine with KVM; for qemuarm64, or where
/dev/kvm does not exist, leave both out. The machine stops with poweroff at its prompt, or with
Ctrl-a x from outside it.
The board's file adds its support layer, meta-raspberrypi, at the commit the layer is tested with;
kas clones it beside the others. The build makes a whole card: a boot partition with the board's firmware
and kernel, and the root filesystem.
machine=raspberrypi5
export KAS_BUILD_DIR="$HOME/yoke-yocto/build-$machine"
- Locally
- In a container
kas build meta-yoke/kas/$machine.yml:meta-yoke/kas/$form.yml
./kas-container build meta-yoke/kas/$machine.yml:meta-yoke/kas/$form.yml
The card is under $KAS_BUILD_DIR/tmp/deploy/images/raspberrypi5/, as $image-raspberrypi5.rootfs.wic.bz2.
Put a microSD card in this machine and find its device with lsblk; a card shows as /dev/sdX through
a USB reader, /dev/mmcblk0 in a slot of its own. Everything on it is overwritten, so be sure of the
name before writing:
card=/dev/sdX
bzcat "$KAS_BUILD_DIR"/tmp/deploy/images/raspberrypi5/$image-raspberrypi5.rootfs.wic.bz2 \
| sudo dd of=$card bs=4M conv=fsync status=progress
The console is either of two: a screen on the HDMI port next to the power connector, with a USB
keyboard; or the serial port on the debug connector between the HDMI ports, at 115200 baud, through a
Raspberry Pi Debug Probe, which shows on this machine as /dev/ttyACM0:
picocom -b 115200 /dev/ttyACM0
Put the card in the board and power it. The serial console shows the firmware's lines first; from the kernel's first line to a login takes less than ten seconds:
OpenEmbedded nodistro.0 raspberrypi5 ttyAMA10
Type 'root' to login with superuser privileges (no password will be asked).
raspberrypi5 login:
The screen shows the same login, on tty1, and nothing more. An image of Yoke alone holds nothing that
draws, so a screen that stops at a login is a board that booted; what an application draws comes with the
application.
The serial console takes what you type at its own pace. A long line pasted at once loses characters, and the shell then reads a command you never gave: paste one short line at a time, or type it. In the first seconds the kernel's messages land among what you type; they are only printed there, and the command is whole.
The board stops with poweroff, and is unplugged once its green light has stopped flashing.
The board's Wi-Fi and Bluetooth are left out: their firmware is under a licence the build does not accept unless told to, and Yoke needs neither. Connect the board by its Ethernet port when it needs a network.
What the first boot shows
Sign in as root, with no password, on any console. The system is up when
systemctl is-system-running --wait says running. What follows reads the same under QEMU and on a
board.
- Application form
- Service form
The account lingers, and its guardian has run, with nobody signed in as it:
loginctl show-user apps -p Linger -p State
systemctl --user -M apps@ is-enabled yoke-guardian.service
systemctl --user -M apps@ show yoke-guardian.service -p Result --value
Linger=yes
State=lingering
enabled
success
The guardian is not running, and that is right: it brings up the instances whose record wants them running and stays to watch them, and with no instance it has nothing to watch, so it ends. It runs again at every boot.
It has no instance yet, and the service form's unit is not used:
su -s /bin/sh apps -c 'yoke instance list'
systemctl is-enabled yoke.service
disabled
The account is ready for an application: shipping it installs one and creates its instance.
The unit is installed and waits for a deployment: there is no composition in force yet, and the Core's configuration is in place.
systemctl is-enabled yoke.service
ls /etc/yoke/
disabled
core.yaml
A deployment adds its Plugins' files and links /etc/yoke/deployment.yaml to its composition, and the
image's recipe enables the unit (a deployment in the service
form).