We know that buildroot enables the creation of a minimal rootfs environment. A huge number of packages are available and can be easily configured using make menuconfig
on the host dev machine.
There is another way to build a customized distribution by using the debootstrap
utility.
Here are the commands to do that (tested on RPi4, but can be achieved on any platform).
(The content is taken from bionic.md available on gitlab)
Generate the base rootfs in out/ subdirectory
(armhf stands for ARM-32 bit, or arm64 for ARM-64 bit)
(focal matches with Ubuntu 20.04)
sudo debootstrap --arch=armhf --verbose --foreign focal out
Edit a /init script as follows:
#!/bin/sh
/bin/mount -t devtmpfs devtmpfs /dev
if (exec 0</dev/console) 2>/dev/null; then
exec 0</dev/console
exec 1>/dev/console
exec 2>/dev/console
fiexec /bin/sh
Boot the target and start with the following command :
./debootstrap/debootstrap --second-stage
with the target connected to the network.
Set a password for root with passwd
– OR – passwd -d root
(to remove password)
Adapt the /init script to launch sbin/init application
To have autologin, it is necessary to adapt the file /lib/systemd/system/serial-getty@.service
and modify the line as follows:
ExecStart=-/sbin/agetty 115200 %I $TERM
Configure /etc/apt/source.list as follows:
deb
http://ports.ubuntu.com/ubuntu-ports/ bionic
main restricted universe
deb
http://ports.ubuntu.com/ubuntu-ports/ bionic-updates
main universe
Network activation:
ip address add 192.168.1.99 dev eth0
ip link set dev eth0 up
ip route add 192.168.1.1 dev eth0
Finally
service systemd-resolved start
dhclient