Investigating smallest possible Debian Rootfs for RockPi-S

There are few suggestions that I can give. First of a good attempt. Maybe suggestion 5 is the best one as it uses openwrt which is essentially made for router-os and for low contrained env.

Suggestion 1:

Use the minimal image and add only the necessary packages using IMAGE_INSTALL_append = “”. Also remove x11 from distro features which will reduce some pacakage sizes. Your local.conf would look something like this:

DISTRO_FEATURES_append = " pam systemd" 
VIRTUAL-RUNTIME_init_manager = “systemd” 
PACKAGECONFIG_append_pn-systemd = " resolved networkd"
DISTRO_FEATURES_remove = “wayland x11 sysvinit” 
IMAGE_INSTALL_append = "nmtui docker-ce"

You can also remove rtl-tools, bluetooth-rockpi-s, rkwifibt-firmware which are required for bluetooth. Also maybe you can remove the packages used by resize-helper after first boot.

Suggestion 2:

The packages for the console image come from: (https://github.com/nishantpoorswani/meta-radxa/blob/zeus/recipes-core/packagegroups/packagegroup-radxa-console.bb) and (https://github.com/nishantpoorswani/meta-radxa/blob/zeus/recipes-core/images/radxa-console-image.bb)

You can remove the things you don’t require from here and build your image. Ideally method 1 is better.

Suggestion 3:

As the current system uses systemd, python3 becomes a dependency. Hence, it is difficult to further reduce. What you can try is that replace systemd by busybox. This will remove python3 as it won’t be a runtime dependency. You can see that the distro understands to use systemd from 2 places:

1st is given here: https://github.com/nishantpoorswani/meta-radxa/blob/zeus/recipes-core/images/radxa-minimal-image.bb. You will need to remove systemd from here.

2nd in the local.conf in the DISTRO_FEATURE_append. So remove it from there and place it in the DISTO_FEATURE_REMOVE. Also you would need to change the init manager. Your local.conf would look like this:

DISTRO_FEATURES_append = " pam"
DISTRO_FEATURES_remove = "wayland systemd sysvinit x11"
VIRTUAL-RUNTIME_login_manager = "busybox"
VIRTUAL-RUNTIME_init_manager = "busybox"
IMAGE_INSTALL_append = “docker-ce networkmanager”

Suggestion 4:

By default in the local.conf you can see that the distro selected is poky which is a default distro you yocto as give in the local.conf using the variable: DISTRO ?= “poky”. poky uses glibc and systemd and other things by default. Yocto also provides another distro if you want to reduce the size called poky-tiny. This will serverly reduce the size as it uses musl and busybox. python3 and unnecessary stuff is reduced. Your local.conf would look like this:

MACHINE ?= “rockpi-s-rk3308”
DISTRO ?= “poky-tiny”

We default to ipk:

PACKAGE_CLASSES ?= “package_ipk”
EXTRA_IMAGE_FEATURES ?= “debug-tweaks”
USER_CLASSES ?= “buildstats image-mklibs image-prelink”
PATCHRESOLVE = “noop”

BB_DISKMON_DIRS ??= "
STOPTASKS,${TMPDIR},1G,100K
STOPTASKS,${DL_DIR},1G,100K
STOPTASKS,${SSTATE_DIR},1G,100K
STOPTASKS,/tmp,100M,100K
ABORT,${TMPDIR},100M,1K
ABORT,${DL_DIR},100M,1K
ABORT,${SSTATE_DIR},100M,1K
ABORT,/tmp,10M,1K"

CONF_VERSION = “1”
IMAGE_INSTALL_append = “docker-ce networkmanager”

I’m not sure that you can compiler docker or no using this but I found links which suggest you can: https://linuxfr.org/users/xberger/journaux/yocto-docker-continuons-l-experience
Also remove all unnecessary packages like the ones for bluetooth and all systemd one’s like resizehelper. You will have to maybe write your own script for resize.

Also you will need to remove systemd as stated above from the layer in the minimal-image. Also maybe you use the minimal-image given by yocto instead of radxa-minimal-image. You can use the command: bitbake -k core-image-minimal inplace of radxa-minimal-image

Ref link: https://wiki.yoctoproject.org/wiki/Poky-Tiny

Suggestion 5:

Well now that all options inside yocto are exhausted you can try openwrt. Here is the link to the post: OpenWrt for ROCK Pi S [testing]

Helpful link: 1) https://www.reddit.com/r/pihole/comments/apquar/dockerpihole_openwrt/

This might be easier than the yocto way.

I hope all this info helps :smile:

1 Like

Considered checking out OpenWrt with docker?

I notice that buildroot has docker packages. Have you considered trying buildroot with the docker packages ?

Buildroot provides these packages for installation :
docker

docker-proxy

docker-engine

docker-containerd

docker-compose

docker-cli