When development is just starting, it is often still not clear which packages will go into the target rootfs.
In other words, it's too early to grab onto LFS, buildroot or yocto (or something else), but you already need to start. For the rich (I have 4GB eMMC on pilot samples), there is a way to distribute a distribution kit to developers that will allow them to quickly deliver something that is missing at the moment, and then we can always collect package lists and form a list for the target rootfs.
This article is not new and is a simple copy-paste instruction.
The purpose of the article is to build Ubuntu rootfs for ARM boards (in my case based on Colibri imx7d).
Building an image
We collect the target rootfs for replication.
Unpack Ubuntu Base
We choose the release ourselves based on the need and our own preferences. Here I have given 20.
$ mkdir ubuntu20
$ cd ubuntu20
$ mkdir rootfs
$ wget http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04-base-armhf.tar.gz
$ tar xf ubuntu-base-20.04-base-armhf.tar.gz -C rootfs
Verifying BINFMT support in the kernel
If you have a common distribution, then there is BINFMT_MISC support and everything is configured, if not, then I'm sure you know how to enable BINFMT support in the kernel.
Kernel header files, modules, this is a separate conversation. Of course, we will not install the bootloader, kernel, modules, device tree through Ubuntu. They will come to us from outside, or we will assemble them ourselves, or they will be given to us by the board manufacturer, in any case, this is beyond the scope of this instruction.
To some extent, version discrepancies are acceptable, but it is better to take them from the kernel build.
# apt install --yes linux-headers-generic
Let's see what happened and a lot happened:
# apt clean
# du -d 0 -h / 2>/dev/null
770M /
Don't forget to set a password.
Packing the image
$ sudo tar -C rootfs --transform "s|^./||" --numeric-owner --owner=0 --group=0 -c ./ | tar --delete ./ | gzip > rootfs.tar.gz
Additionally, we can install etckeeper with the autopush setting
Well, let's say we distributed our assembly, the work went on, how best to assemble then various versions of our system.