Yocto is a Linux “distribution” builder project that aims to provide a flexible framework for creating custom Linux-based systems. At the moment, I am utterly fascinated with it, as it offers the ability to tailor a system to specific requirements. One of the intriguing components of this project is Poky Tiny, which is essentially a stripped-down version of Yocto’s Poky example build, designed to provide a minimal yet functional Linux environment.
However, for some reason, I have taken to calling it my “tiny horse,” perhaps due to the playful connotation of the name and the lightweight nature of the build. In this post, I will take you through the setup process I am undertaking to build Poky Tiny, or as I affectionately refer to it, tiny horse. I will cover each step in detail, from initial configuration to final deployment, so that you, too, may explore the wonders of this tiny horse Linux distribution.

Setup
I really like using Nix, so the setup starts with a flake, though that detail may not be critical for everyone. The core of this project revolves around utilizing kas to effectively manage the Yocto build system. The overall flow of the setup can be simplified into the following structure: Nix flake leads into kas, which then interfaces with Yocto to generate the desired image.
This approach streamlines the build process and allows for a more organized and reproducible environment. The beauty of kas lies in its ability to handle complex multi-repository setups efficiently, ensuring that all components of the Yocto project work together.
Getting kas up and running is quite straightforward, especially since it can be installed directly from the source. In my setup, I’m integrating kas into my development environment, which allows me to include it seamlessly into my workflow. This means that this essential tool is added to my package list, ensuring that it is readily available whenever I need it.
Overall, this combination of Nix flakes, kas, and Yocto creates a powerful ecosystem for building and managing software images, making the process not only efficient but also enjoyable for developers who appreciate a well-structured and manageable environment.
kas = pkgs.python3.pkgs.buildPythonApplication {
pname = "kas";
version = "unstable-0555188";
pyproject = true;
src = pkgs.fetchFromGitHub {
owner = "siemens";
repo = "kas";
rev = "055518846c3963114efbd0107bf3f2e59b4b3ba5";
hash = "sha256-2a8LqOaCOXiINqtjU5DN2Z5AEA2+GmzXlrGvVJ9FhIA=";
};
# kas drops PATH from the environment it passes to subprocesses
# (context.py only whitelists a few vars), so `git` cannot be found
# on NixOS where there is no /usr/bin/git. Carry PATH over.
postPatch = ''
substituteInPlace kas/context.py \
--replace-fail "'SSH_AUTH_SOCK'," "'SSH_AUTH_SOCK', 'PATH',"
'';
build-system = [ pkgs.python3.pkgs.setuptools ];
dependencies = with pkgs.python3.pkgs; [
setuptools # pkg_resources is imported at runtime
kconfiglib
jsonschema
distro
pyyaml
gitpython
colorlog
];
# Tests clone repos and need network
doCheck = false;
# kas shells out to git at runtime
makeWrapperArgs = [
"--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.git ]}"
];
pythonImportsCheck = [ "kas" ];
meta = {
homepage = "https://github.com/siemens/kas";
description = "Setup tool for bitbake based projects";
license = pkgs.lib.licenses.mit;
mainProgram = "kas";
};
};
If you aren’t working in nix use pipx https://github.com/pypa/pipx
install expression should be something similar to
pipx install git+<repository-url>
KAS
(kas means cheese in german https://en.wiktionary.org/wiki/K%C3%A4s)
This website provides a nice explanation for why KAS should be used instead of raw BitBake configurations. Transitioning from traditional configurations to KAS can greatly simplify the management of complex builds, especially in environments that require multiple layers and dependencies. The article highlights how KAS streamlines the process of setting up Yocto projects by efficiently managing git submodules compared to the conventional BitBake methods.
BitBake builds often require meticulous git submodule management to handle the various layers that contribute to the overall build environment. This task can quickly become intricate for developers, who must navigate unconventional configuration files like build/layers.conf and build/local.conf. These files are vital as they define the interactions between layers and specify how configurations are applied, but managing them can be cumbersome without the right tools.
Using KAS, developers can benefit from a more organized approach to building Yocto images. KAS simplifies layer handling, reducing the potential for errors that can arise from manual edits to configuration files. This allows developers to concentrate more on development rather than configuration, ultimately leading to more efficient workflows and smoother builds.
For those seeking to enhance their development practices and reduce the complexities associated with BitBake configurations, exploring KAS presents a valuable opportunity. The various advantages and efficiencies it offers make it an appealing choice for modern Yocto project development. For more details, you can visit the following link: https://www.smallstepsystems.com/setting-up-yocto-projects-with-kas/.
Project Configuration
kas-project.yml: is the full kit needed from bitbake configuration to layer management, serving as a comprehensive guide for developers working with the Yocto Project. The ‘header’ section takes care of the configuration, basically the build/local.conf, where developers can specify various settings and preferences crucial for the build process. This section is essential as it defines the environmental variables and options that dictate how the builds should behave. Meanwhile, the ‘repos’ section is responsible for managing the layers, effectively functioning as the build/layers.conf file. This functionality not only organizes the layers but also facilitates the retrieval of the necessary components directly from version control systems. Kas does more than just describe them; it also automates the process of cloning these layers, ensuring that developers have the latest code without the need for manual intervention. This streamlined process enhances productivity and reduces the likelihood of errors, making it a vital tool for anyone looking to optimize their development workflow.
header: version: 14machine: qemux86-64distro: tiny-horsetarget: tiny-horse-imagerepos: poky: url: https://git.yoctoproject.org/poky branch: scarthgap path: layers/poky layers: meta: meta-poky: meta-yocto-bsp: meta-tiny-horse: path: meta-tiny-horselocal_conf_header: tiny-horse: | # `nix develop` exports TMPDIR pointing at a volatile per-shell temp dir, # and kas forwards it to bitbake (it is in BB_ENV_PASSTHROUGH_ADDITIONS). # That overrides OE's default TMPDIR, so the whole build (and its logs) # lands in a directory that is deleted when the shell exits. Pin it back # to the build tree. local.conf is parsed after the environment is # imported, so a strong assignment here wins over the leaked value. TMPDIR = "${TOPDIR}/tmp" # Keep the rootfs small; drop the default extra image types. IMAGE_FSTYPES = "ext4"
This simplicity is worth the trade off of adding yet anther tool.
Meta-tiny-horse
this is the meat of tiny horse. Basically we are giving it definitions setting clib as musl C, removing packages, and adding ipk packages.
require conf/distro/poky.confDISTRO = "tiny-horse"DISTRO_NAME = "Tiny Horse"DISTRO_VERSION = "1.0"DISTRO_CODENAME = "tinyhorse"DISTROOVERRIDES = "poky:poky-tiny"TCLIBC = "musl"FULL_OPTIMIZATION="-Os -pipe ${DEBUG_FLAGS}"MAINTAINER = "tiny-horse <tiny-horse@example.com>"# Trim the feature set for a smaller, console-only system.DISTRO_FEATURES:remove = "x11 wayland opengl vulkan ptest"# Smaller package format than rpm.PACKAGE_CLASSES = "package_ipk"
Building
This is the only command needed to build the image.
kas-container kas-project.yml
How Tiny is this Horse
What will run is two parts: 1. kernel 2. root file system. Those two summed together shows how tiny is tiny horse.
the Kernel is 12M
du -h /home/jacob/yocto/build/tmp/deploy/images/qemux86-64/bzImage--6.6.151+git0+dd201eb6ec_5ae544e131-r0-qemux86-64-20261016004038.bin 12M /home/jacob/yocto/build/tmp/deploy/images/qemux86-64/bzImage--6.6.151+git0+dd201eb6ec_5ae544e131-r0-qemux86-64-20261016004038.bin
The Root File System is 32M
du -h build/tmp/deploy/images/qemux86-64/tiny-horse-image-qemux86-64.rootfs-20261021013133.ext4 23M build/tmp/deploy/images/qemux86-64/tiny-horse-image-qemux86-64.rootfs-20261021013133.ext4
The Grand Total 35M
That is under 50M that is smaller than a 20th of a Gigabyte. That puts Tiny Horse in between SliTaz and TinyCore Linux in wikipedia’s list of lightweight linux distros. There are 4 distros between Tiny Horse and being the smallest distro.
- Nanolinux 19M
- Tiny Core Linux 11M, 16M, 106M
- OpenWrt 6M
- Tiny SliTaz 800K (1.44M floppy)
Apline Linux shows up in the list but takes 8M when in a container not on disk (130M), so tiny horse is smaller.
Running The Image
kas-container shell kas-project.yml -c "runqemu nographic slirp"
Prompts the following
Starting syslogd/klogd: doneTiny Horse 1.0 qemux86-64 /dev/ttyS0qemux86-64 login: rootroot@qemux86-64:~#
that gives you a shell. I like to test connectivity when setting up devices or images, as it ensures that everything is functioning correctly before moving forward. Utilizing the user space network stack can complicate this process, as it prevents effective connectivity testing. Without proper connectivity diagnostics, one can face unexpected issues during deployment. It’s important to remember that ping operates using ICMP rather than utilizing TCP or UDP protocols. This distinction can affect the way we approach network testing, and permissions.
Issue
Following the prompt above, I tried pinging the QEMU instance but was unable to due to QEMU running inside a container, which complicates network communication significantly, especially when the container does not have any forwarding setup. The Kas container is fairly generic, and I would prefer to run the image with just vanilla QEMU to have more control over the network settings and options available. QEMU has a couple of options for network back-ends, such as slirp, tap, and others. Slirp is a user-land networking back-end designed for ease of use, as it only allows for TCP/UDP networking, which is how I am currently running QEMU in the container. While this suffices for basic boot, it imposes certain limitations on the instance. On the other hand, the tap back-end can provide more advanced networking features since it allows the creation of a network tap device that can bridge to the host’s network. However, this method requires root privileges, as it sets up a network tap device that facilitates direct communication between the guest and the host. Consequently, configuring QEMU to connect to this tap device can open up a broader range of networking possibilities, but the additional permissions and configuration steps can present obstacles for users unfamiliar with container settings.
Setting up a tap
This is done on the host machine
sudo ip tuntap add dev vm0 mode tapsudo ip link add br0 type bridgesudo ip link set br0 upsudo ip link set vm0 master br0
Qemu command
This is the command that now runs the tiny horse QEMU instance.
/home/jacob/yocto/build/tmp/work/x86_64-linux/qemu-helper-native/1.0/recipe-sysroot-native/usr/bin/qemu-system-x86_64-L /home/jacob/yocto/build/tmp/work/x86_64-linux/qemu-helper-native/1.0/recipe-sysroot-native/usr/share/qemu -cpu IvyBridge-machine q35,i8042=off -smp 4 -m 256-object rng-random,filename=/dev/urandom,id=rng0-device virtio-rng-pci,rng=rng0-netdev tap,id=net0,ifname=tap0,script=no,downscript=no-device virtio-net-pci,netdev=net0,mac=52:54:00:55:4d:1d-drive file=/home/jacob/yocto/build/tmp/deploy/images/qemux86-64/tiny-horse-image-qemux86-64.rootfs.ext4,if=virtio,format=raw-device AC97-serial mon:stdio-serial null-display none-usb -device usb-tablet-usb -device usb-kbd-kernel /home/jacob/yocto/build/tmp/deploy/images/qemux86-64/bzImage-append 'root=/dev/vda rw console=ttyS0,115200 console=ttyS1,115200 ip=192.168.7.2::192.168.7.1:255.255.255.0::eth0:off:8.8.8.8 net.ifnames=0 oprofile.timer=1 tsc=reliable no_timer_check rcupdate.rcu_expedited=1 swiotlb=0'
We can PING!!!
Pinging on Host
[jacob@IdahoDuncan:~/yocto]$ ping 192.168.7.2
PING 192.168.7.2 (192.168.7.2) 56(84) bytes of data.
64 bytes from 192.168.7.2: icmp_seq=1 ttl=64 time=12.9 ms
64 bytes from 192.168.7.2: icmp_seq=2 ttl=64 time=1.95 ms
64 bytes from 192.168.7.2: icmp_seq=3 ttl=64 time=1.57 ms
64 bytes from 192.168.7.2: icmp_seq=4 ttl=64 time=0.806 ms
^[[3~64 bytes from 192.168.7.2: icmp_seq=5 ttl=64 time=0.818 ms
64 bytes from 192.168.7.2: icmp_seq=6 ttl=64 time=1.92 ms
64 bytes from 192.168.7.2: icmp_seq=7 ttl=64 time=1.72 ms
64 bytes from 192.168.7.2: icmp_seq=8 ttl=64 time=1.78 ms
64 bytes from 192.168.7.2: icmp_seq=9 ttl=64 time=0.660 ms
64 bytes from 192.168.7.2: icmp_seq=10 ttl=64 time=0.782 ms
64 bytes from 192.168.7.2: icmp_seq=11 ttl=64 time=1.53 ms
^C
--- 192.168.7.2 ping statistics ---
11 packets transmitted, 11 received, 0% packet loss, time 10096ms
rtt min/avg/max/mdev = 0.660/2.406/12.943/3.365 ms
Pinging on Tiny Horse
Tiny Horse 1.0 qemux86-64 /dev/ttyS0qemux86-64 login: rootroot@qemux86-64:~# ip a1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 52:54:00:d1:9c:2a brd ff:ff:ff:ff:ff:ff inet 192.168.7.2/24 brd 192.168.7.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fed1:9c2a/64 scope link valid_lft forever preferred_lft forever3: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0root@qemux86-64:~# ping 192.168.7.10PING 192.168.7.10 (192.168.7.10): 56 data bytes64 bytes from 192.168.7.10: seq=0 ttl=64 time=4.965 ms64 bytes from 192.168.7.10: seq=1 ttl=64 time=2.457 ms64 bytes from 192.168.7.10: seq=2 ttl=64 time=2.291 ms64 bytes from 192.168.7.10: seq=3 ttl=64 time=2.268 ms64 bytes from 192.168.7.10: seq=4 ttl=64 time=1.234 ms64 bytes from 192.168.7.10: seq=5 ttl=64 time=2.409 msc^C--- 192.168.7.10 ping statistics ---6 packets transmitted, 6 packets received, 0% packet lossround-trip min/avg/max = 1.234/2.604/4.965 msroot@qemux86-64:~#
Tiny horse trots forth.
Leave a Reply