Skip to contentSkip to conversation

Container - Guest

PATCH New Francois Perrad 4 participants 18 messages Jun 21, 2020 – Jul 27, 2020

lore
Share & tools
lore
#0 lore raw

v3 cover Container - Guest

Buildroot supports some OS-level virtualization tools: Docker, LXC, systemd-nspawn. These tools are built on an host image.

This series introduces a set of defconfig in order to create a guest image.

After some experiments, packages docker & systemd need some tweaks.

v2 -> v3:
- more examples in readme.txt (including Dockerfile from SkiffOS)
- select BR2_PACKAGE_CGROUPFS_MOUNT conditional

RFC -> v2:
- refactor with FOO_LINUX_CONFIG_FIXUPS (new in 2020.05)
- add option BR2_PACKAGE_SYSTEMD_GUEST

Francois Perrad (7):
configs/guest_*: some new defconfig board/guest: documentation and sample files package/docker-engine: needs some kernel options package/docker-engine: needs more runtime dependencies package/systemd: needs kernel options package/systemd: add an option BR2_PACKAGE_SYSTEMD_GUEST configs/guest_*: use BR2_PACKAGE_SYSTEMD_GUEST

 DEVELOPERS                             |   2 +
 board/guest/Dockerfile                 |   2 +
 board/guest/readme.txt                 | 143 +++++++++++++++++++++++++
 configs/guest_arm_a7_defconfig         |  29 +++++
 configs/guest_arm_a9_defconfig         |  31 ++++++
 configs/guest_x86_64_defconfig         |  28 +++++
 package/docker-engine/Config.in        |   1 +
 package/docker-engine/docker-engine.mk |  67 ++++++++++++
 package/systemd/Config.in              |  14 ++-
 package/systemd/systemd.mk             |  17 ++-
 10 files changed, 328 insertions(+), 6 deletions(-)
 create mode 100644 board/guest/Dockerfile
 create mode 100644 board/guest/readme.txt
 create mode 100644 configs/guest_arm_a7_defconfig
 create mode 100644 configs/guest_arm_a9_defconfig
 create mode 100644 configs/guest_x86_64_defconfig
Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 1/7 configs/guest_*: some new defconfig

---
 DEVELOPERS                     |  1 +
 configs/guest_arm_a7_defconfig | 16 ++++++++++++++++
 configs/guest_arm_a9_defconfig | 18 ++++++++++++++++++
 configs/guest_x86_64_defconfig | 15 +++++++++++++++
 4 files changed, 50 insertions(+)
 create mode 100644 configs/guest_arm_a7_defconfig
 create mode 100644 configs/guest_arm_a9_defconfig
 create mode 100644 configs/guest_x86_64_defconfig
DEVELOPERS +1 -0
index efb97c739..035a75358 100644
@@ -906,6 +906,7 @@ F:	package/ser2net/
 N:	Francois Perrad <[email protected]>
 F:	board/olimex/a20_olinuxino
 F:	board/olimex/imx233_olinuxino/
+F:	configs/guest_*
 F:	configs/olimex_a20_olinuxino_*
 F:	configs/olimex_imx233_olinuxino_defconfig
 F:	package/4th/
configs/guest_arm_a7_defconfig new file +16 -0
new file mode 100644
index 000000000..efe9a1369
@@ -0,0 +1,16 @@
+# Architecture
+BR2_arm=y
+BR2_cortex_a7=y
+
+# Toolchain
+BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="4.15"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
+
+# System
+BR2_INIT_SYSTEMD=y
+# BR2_TARGET_GENERIC_GETTY is not set
+
+# Filesystem
+BR2_TARGET_ROOTFS_TAR=y
configs/guest_arm_a9_defconfig new file +18 -0
new file mode 100644
index 000000000..02c3d302d
@@ -0,0 +1,18 @@
+# Architecture
+BR2_arm=y
+BR2_cortex_a9=y
+BR2_ARM_ENABLE_NEON=y
+BR2_ARM_ENABLE_VFP=y
+
+# Toolchain
+BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="4.15"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
+
+# System
+BR2_INIT_SYSTEMD=y
+# BR2_TARGET_GENERIC_GETTY is not set
+
+# Filesystem
+BR2_TARGET_ROOTFS_TAR=y
configs/guest_x86_64_defconfig new file +15 -0
new file mode 100644
index 000000000..42d1d659a
@@ -0,0 +1,15 @@
+# Architecture
+BR2_x86_64=y
+
+# Toolchain
+BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="4.15"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
+
+# System
+BR2_INIT_SYSTEMD=y
+# BR2_TARGET_GENERIC_GETTY is not set
+
+# Filesystem
+BR2_TARGET_ROOTFS_TAR=y
Signature · 1 line
2.25.1
#2 lore raw

PATCH v3 1/7 configs/guest_*: some new defconfig

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

---
 DEVELOPERS                     |  1 +
 configs/guest_arm_a7_defconfig | 16 ++++++++++++++++
 configs/guest_arm_a9_defconfig | 18 ++++++++++++++++++
 configs/guest_x86_64_defconfig | 15 +++++++++++++++

Like Christian, I am not really convinced these defconfigs add any real value.

You have decided to use glibc / 4.15 headers / systemd, which seems pretty random to me.

If anything, the should build with the oldest kernel headers version we support, so you can use the final docker image on older distributions without getting the dreaded:

FATAL: kernel too old

From glibc.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v3 1/7 configs/guest_*: some new defconfig

Le lun. 27 juil. 2020 ? 11:49, Peter Korsgaard <[email protected]> a ?crit :

Quoted 9 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

---
 DEVELOPERS                     |  1 +
 configs/guest_arm_a7_defconfig | 16 ++++++++++++++++
 configs/guest_arm_a9_defconfig | 18 ++++++++++++++++++
 configs/guest_x86_64_defconfig | 15 +++++++++++++++
Quoted 4 lines

Like Christian, I am not really convinced these defconfigs add any real value.

The documentation is the 2nd patch is the most valuable part. Can we add board/guest/readme.txt without introducing some configs/guest_*_defconfig ?

Fran?ois

Quoted 9 lines

You have decided to use glibc / 4.15 headers / systemd, which seems pretty random to me.

If anything, the should build with the oldest kernel headers version we support, so you can use the final docker image on older distributions without getting the dreaded:

FATAL: kernel too old

Quoted 9 lines

From glibc.

--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200727/a1ecc0d6/attachment.html>

#4 lore raw

PATCH v3 1/7 configs/guest_*: some new defconfig

Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fran?ois" == Fran?ois Perrad <[email protected]> writes:

Le lun. 27 juil. 2020 ? 11:49, Peter Korsgaard <[email protected]> a ?crit :

Quoted 9 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

---
 DEVELOPERS                     |  1 +
 configs/guest_arm_a7_defconfig | 16 ++++++++++++++++
 configs/guest_arm_a9_defconfig | 18 ++++++++++++++++++
 configs/guest_x86_64_defconfig | 15 +++++++++++++++
Quoted 7 lines
Quoted 4 lines

Like Christian, I am not really convinced these defconfigs add any real value.

The documentation is the 2nd patch is the most valuable part. Can we add board/guest/readme.txt without introducing some configs/guest_*_defconfig ?

Sure, but it might be a bit hard to find. Would it not fit better in the manual?

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH v3 2/7 board/guest: documentation and sample files

In reply to Francois Perrad
---
 DEVELOPERS             |   1 +
 board/guest/Dockerfile |   2 +
 board/guest/readme.txt | 143 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 board/guest/Dockerfile
 create mode 100644 board/guest/readme.txt
DEVELOPERS +1 -0
index 035a75358..2ec84e611 100644
@@ -904,6 +904,7 @@ N:	Francisco Gonzalez <[email protected]>
 F:	package/ser2net/
 
 N:	Francois Perrad <[email protected]>
+F:	board/guest/
 F:	board/olimex/a20_olinuxino
 F:	board/olimex/imx233_olinuxino/
 F:	configs/guest_*
board/guest/Dockerfile new file +2 -0
new file mode 100644
index 000000000..d218acad1
@@ -0,0 +1,2 @@
+FROM scratch
+ADD rootfs.tar /
board/guest/readme.txt new file +143 -0

143 lines not on this page · raw message

Signature · 1 line
2.25.1
#6 lore raw

PATCH v3 2/7 board/guest: documentation and sample files

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

---
 DEVELOPERS             |   1 +
 board/guest/Dockerfile |   2 +
 board/guest/readme.txt | 143 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 board/guest/Dockerfile
 create mode 100644 board/guest/readme.txt

..

Quoted 4 lines
board/guest/readme.txt new file +4 -0
+How to with Docker
+==================
+
+A Docker image could created with a Dockerfile and few commands are needed:

board/guest/readme.txt line 32

Quoted 10 lines
board/guest/readme.txt new file +10 -0
+
+    # dockerd &
+
+    $ cat Dockerfile
+    FROM scratch
+    ADD rootfs.tar /
+    $ docker build --tag br:guest .
+    $ docker images
+    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
+    br                  guest               0c54c85a3452        42 seconds ago      1.75MB

NIT: Why not just use docker import rootfs.tar br:test?

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH v3 2/7 board/guest: documentation and sample files

Le lun. 27 juil. 2020 ? 11:46, Peter Korsgaard <[email protected]> a ?crit :

Quoted 28 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

---
 DEVELOPERS             |   1 +
 board/guest/Dockerfile |   2 +
 board/guest/readme.txt | 143 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 board/guest/Dockerfile
 create mode 100644 board/guest/readme.txt

..

board/guest/readme.txt

Quoted 4 lines
board/guest/readme.txt new file +4 -0
+How to with Docker
+==================
+
+A Docker image could created with a Dockerfile and few commands are

needed:

board/guest/readme.txt

Quoted 9 lines
board/guest/readme.txt new file +9 -0
+
+    # dockerd &
+
+    $ cat Dockerfile
+    FROM scratch
+    ADD rootfs.tar /
+    $ docker build --tag br:guest .
+    $ docker images
+    REPOSITORY          TAG                 IMAGE ID

CREATED SIZE

Quoted 5 lines
Quoted 1 line

+ br guest 0c54c85a3452 42

seconds ago 1.75MB

NIT: Why not just use docker import rootfs.tar br:test?

Good point.

Fran?ois

Quoted 8 lines

--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200727/55df6638/attachment.html>

#8 lore raw

PATCH v3 2/7 board/guest: documentation and sample files

In reply to Peter Korsgaard

Peter,

Quoted 6 lines · Peter Korsgaard

board/guest/readme.txt line 32

Quoted 4 lines
board/guest/readme.txt new file +4 -0
+    $ docker build --tag br:guest .
+    $ docker images
+    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
+    br                  guest               0c54c85a3452        42 seconds ago      1.75MB

NIT: Why not just use docker import rootfs.tar br:test?

This works too, but I tend to add some adjustments to the image in the Dockerfile. Of course, these could be added in the build process, and probably would be better suited there.

Dockerfile:

FROM scratch

ENV container docker
ENV init /lib/systemd/systemd
ENV LC_ALL C

ADD rootfs.tar /

USER root

RUN find /etc/systemd/system \
         /usr/lib/systemd/system \
         \( -path '*.wants/*' \
         -name '*swapon*' \
         -or -name '*ntpd*' \
         -or -name '*resolved*' \
         -or -name '*udev*' \
         -or -name '*rdisc*' \
         -or -name '*freedesktop*' \
         -or -name '*persist-resize*' \
         -or -name '*NetworkManager*' \
         -or -name '*remount-fs*' \
         -or -name '*getty*' \
         -or -name '*.mount' \
         -or -name '*remote-fs*' \) \
         -exec echo \{} \; \
         -exec rm \{} \;
RUN systemctl set-default multi-user.target && \
    systemctl mask tmp.mount && \
    touch /etc/skip-skiff-mounts && \
    touch /etc/skip-skiff-journal-mounts

COPY fstab /etc/fstab

VOLUME [ "/sys/fs/cgroup", "/mnt/persist", "/mnt/rootfs" ] ENTRYPOINT ["/usr/lib/systemd/systemd"]

Best,
Christian Stewart

#9 lore raw

PATCH v3 3/7 package/docker-engine: needs some kernel options

In reply to Francois Perrad

according to https://wiki.gentoo.org/wiki/Docker#Kernel

---
 package/docker-engine/docker-engine.mk | 67 ++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
package/docker-engine/docker-engine.mk +67 -0
index 78f6c1261..41600486c 100644
@@ -79,4 +79,71 @@ define DOCKER_ENGINE_USERS
 	- - docker -1 * - - - Docker Application Container Framework
 endef
 
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS),y)
+define DOCKER_ENGINE_DRIVER_BTRFS_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BTRFS_FS)
+endef
+endif
+
+define DOCKER_ENGINE_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_POSIX_MQUEUE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG_SWAP)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_CGROUP)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_SCHED)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_FAIR_GROUP_SCHED)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CFS_BANDWIDTH)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_RT_GROUP_SCHED)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_PIDS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_FREEZER)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CPUSETS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PROC_PID_CPUSET)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_DEVICE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_CPUACCT)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_PERF)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NAMESPACES)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_UTS_NS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IPC_NS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_USER_NS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PID_NS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_NS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BLOCK)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_THROTTLING)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_ADVANCED)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BRIDGE_NETFILTER)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NF_CONNTRACK)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XTABLES)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_ADDRTYPE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_CONNTRACK)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_IPTABLES)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_FILTER)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_NAT)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_TARGET_MASQUERADE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_TARGET_NETMAP)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_TARGET_REDIRECT)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BRIDGE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_SCHED)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_CLS_CGROUP)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_L3_MASTER_DEV)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_NET_PRIO)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_NETCLASSID)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MD)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_DM)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MD_THIN_PROVISIONING)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_CORE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_DUMMY)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MACVLAN)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IPVLAN)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_VXLAN)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_VETH)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_OVERLAY_FS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_KEYS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PERSISTENT_KEYRINGS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_ENCRYPTED_KEYS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_KEY_DH_OPERATIONS)
+	$(DOCKER_ENGINE_DRIVER_BTRFS_LINUX_CONFIG_FIXUPS)
+endef
+
 $(eval $(golang-package))
Signature · 1 line
2.25.1
#10 lore raw

PATCH v3 3/7 package/docker-engine: needs some kernel options

Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

according to https://wiki.gentoo.org/wiki/Docker#Kernel

A better source is docker-engine/contrib/check-config.sh. See below for the suggestions from it.

Quoted 10 lines
---
 package/docker-engine/docker-engine.mk | 67 ++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
package/docker-engine/docker-engine.mk +0 -0
index 78f6c1261..41600486c 100644

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 84

Quoted 6 lines
package/docker-engine/docker-engine.mk +3 -0
@@ -79,4 +79,71 @@ define DOCKER_ENGINE_USERS
 	- - docker -1 * - - - Docker Application Container Framework
 endef
 
+ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS),y)
+define DOCKER_ENGINE_DRIVER_BTRFS_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BTRFS_FS)

check-config.sh also mentions xattr support for btrfs, so I've added:

  $(call KCONFIG_ENABLE_OPT,CONFIG_BTRFS_FS_POSIX_ACL)

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 93

Quoted 9 lines
package/docker-engine/docker-engine.mk +9 -0
+endef
+endif
+
+define DOCKER_ENGINE_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_POSIX_MQUEUE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG_SWAP)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_CGROUP)

MEMCG_SWAP and BLK_CGROUP are optional (E.G. you may be running from an initramfs or without swap). I've dropped them.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 98

Quoted 4 lines
package/docker-engine/docker-engine.mk +4 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_FAIR_GROUP_SCHED)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CFS_BANDWIDTH)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_RT_GROUP_SCHED)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_PIDS)

Same for these.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 101

Quoted 1 line
package/docker-engine/docker-engine.mk +1 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PROC_PID_CPUSET)

And this.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 104

Quoted 1 line
package/docker-engine/docker-engine.mk +1 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_PERF)

This is afaik not used by docker.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 108

Quoted 1 line
package/docker-engine/docker-engine.mk +1 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_USER_NS)

User namespace is optional.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 112

Quoted 2 lines
package/docker-engine/docker-engine.mk +2 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BLOCK)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_THROTTLING)

Same for BLK_CGROUP.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 119

Quoted 2 lines
package/docker-engine/docker-engine.mk +2 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_ADDRTYPE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_CONNTRACK)

check-config.sh also mentions CONFIG_NETFILTER_XT_MATCH_IPVS. This depends on IPVS support in the kernel to get used. I've added _XT_MATCH_IPVS so it gets enabled if IPVS support is turned on.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 125

Quoted 2 lines
package/docker-engine/docker-engine.mk +2 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_TARGET_NETMAP)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_TARGET_REDIRECT)

These are (afaik) not needed.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 128

Quoted 2 lines
package/docker-engine/docker-engine.mk +2 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_SCHED)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_CLS_CGROUP)

Optional.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 129

Quoted 1 line
package/docker-engine/docker-engine.mk +1 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_L3_MASTER_DEV)

(afaik) not used.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 131

Quoted 2 lines
package/docker-engine/docker-engine.mk +2 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_NET_PRIO)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_NETCLASSID)

Optional.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 134

Quoted 3 lines
package/docker-engine/docker-engine.mk +3 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MD)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_DM)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MD_THIN_PROVISIONING)

These are only needed for the non-default devicemapper support, so I moved them to a DOCKER_ENGINE_DRIVER_DM_LINUX_CONFIG_FIXUPS conditional.

package/docker-engine/docker-engine.mk define DOCKER_ENGINE_USERS · line 145

Quoted 3 lines
package/docker-engine/docker-engine.mk +3 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PERSISTENT_KEYRINGS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_ENCRYPTED_KEYS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_KEY_DH_OPERATIONS)

These are (afaik) not used, so dropped.

Committed with these fixes, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#11 lore raw

PATCH v3 4/7 package/docker-engine: needs more runtime dependencies

In reply to Francois Perrad

fix error:
failed to start daemon: Devices cgroup isn't mounted

---
 package/docker-engine/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/docker-engine/Config.in +1 -0
index 1fd229fcb..4fe6956ab 100644
@@ -5,6 +5,7 @@ config BR2_PACKAGE_DOCKER_ENGINE
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_TOOLCHAIN_USES_UCLIBC # docker-containerd -> runc
 	depends on BR2_USE_MMU # docker-containerd
+	select BR2_PACKAGE_CGROUPFS_MOUNT if !BR2_PACKAGE_SYSTEMD # runtime dependency
 	select BR2_PACKAGE_DOCKER_CONTAINERD # runtime dependency
 	select BR2_PACKAGE_DOCKER_PROXY # runtime dependency
 	select BR2_PACKAGE_IPTABLES # runtime dependency
Signature · 1 line
2.25.1
#12 lore raw

PATCH v3 4/7 package/docker-engine: needs more runtime dependencies

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

fix error:
failed to start daemon: Devices cgroup isn't mounted

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#13 lore raw

PATCH v3 5/7 package/systemd: needs kernel options

In reply to Francois Perrad

according to https://wiki.gentoo.org/wiki/Systemd#Kernel

---
 package/systemd/systemd.mk | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
package/systemd/systemd.mk +10 -1
index 8e01a0db5..b7213dd12 100644
@@ -565,9 +565,18 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
 SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
 
 define SYSTEMD_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_POSIX_MQUEUE)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
-	$(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_BPF)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_FHANDLE)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_EPOLL)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_SIGNALFD)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_TIMERFD)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BPF_SYSCALL)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PROC_FS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_SYSFS)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_AUTOFS4_FS)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_POSIX_ACL)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_XATTR)
Signature · 1 line
2.25.1
#14 lore raw

PATCH v3 5/7 package/systemd: needs kernel options

Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

according to https://wiki.gentoo.org/wiki/Systemd#Kernel

---
 package/systemd/systemd.mk | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
package/systemd/systemd.mk +0 -0
index 8e01a0db5..b7213dd12 100644

package/systemd/systemd.mk SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) · line 568

Quoted 4 lines
package/systemd/systemd.mk +1 -0
@@ -565,9 +565,18 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
 SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
 
 define SYSTEMD_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_POSIX_MQUEUE)

I don't see any reference to this anywhere in the systemd code or README, so I've dropped this.

package/systemd/systemd.mk SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) · line 570

Quoted 3 lines
package/systemd/systemd.mk +1 -1
 	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
-	$(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_BPF)

According to the README this is only required for IPAddressDeny= and IPAddressAllow= in resource control unit settings, which I don't think is used by anuy of the "standard" services - Dropped.

package/systemd/systemd.mk SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) · line 575

Quoted 1 line
package/systemd/systemd.mk +1 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BPF_SYSCALL)

Same for this one.

package/systemd/systemd.mk SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) · line 576

Quoted 1 line
package/systemd/systemd.mk +1 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS)

This is already taken care of by linux/linux.mk, dropped.

Committed with these changes, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#15 lore raw

PATCH v3 6/7 package/systemd: add an option BR2_PACKAGE_SYSTEMD_GUEST

In reply to Francois Perrad

this option allows a systemd tailored for a guest/container

---
 package/systemd/Config.in  | 14 ++++++++++----
 package/systemd/systemd.mk |  6 +++++-
 2 files changed, 15 insertions(+), 5 deletions(-)
package/systemd/Config.in +10 -4
index dd3b8c534..a8595dce8 100644
@@ -35,10 +35,10 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	select BR2_PACKAGE_UTIL_LINUX_MOUNT
 	select BR2_PACKAGE_UTIL_LINUX_NOLOGIN
 	select BR2_PACKAGE_UTIL_LINUX_FSCK
-	select BR2_PACKAGE_KMOD
-	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # kmod-tools
-	select BR2_PACKAGE_KMOD_TOOLS
-	select BR2_TARGET_TZ_INFO
+	select BR2_PACKAGE_KMOD if !BR2_PACKAGE_SYSTEMD_GUEST
+	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS if !BR2_PACKAGE_SYSTEMD_GUEST # kmod-tools
+	select BR2_PACKAGE_KMOD_TOOLS if !BR2_PACKAGE_SYSTEMD_GUEST
+	select BR2_TARGET_TZ_INFO if !BR2_PACKAGE_SYSTEMD_GUEST
 	select BR2_NEEDS_HOST_UTF8_LOCALE
 	select BR2_PACKAGE_HOST_SYSTEMD # for systemctl preset-all, during target-finalize
 	help
@@ -90,6 +90,12 @@ if BR2_PACKAGE_SYSTEMD
 config BR2_PACKAGE_PROVIDES_UDEV
 	default "systemd"
 
+config BR2_PACKAGE_SYSTEMD_GUEST
+	bool "systemd-guest"
+	default n
+	help
+	  this option allows a systemd tailored for a guest/container.
+
 config BR2_PACKAGE_SYSTEMD_BOOT
 	bool "systemd-boot"
 	depends on BR2_i386 || BR2_x86_64
package/systemd/systemd.mk +5 -1
index b7213dd12..c5572c369 100644
@@ -13,11 +13,15 @@ SYSTEMD_DEPENDENCIES = \
 	$(BR2_COREUTILS_HOST_DEPENDENCY) \
 	$(if $(BR2_PACKAGE_BASH_COMPLETION),bash-completion) \
 	host-gperf \
-	kmod \
 	libcap \
 	util-linux \
 	$(TARGET_NLS_DEPENDENCIES)
 
+ifneq ($(BR2_PACKAGE_SYSTEMD_GUEST),y)
+	SYSTEMD_DEPENDENCIES += kmod
+endif
+
+
 SYSTEMD_PROVIDES = udev
 
 SYSTEMD_CONF_OPTS += \
Signature · 1 line
2.25.1
#16 lore raw

PATCH v3 6/7 package/systemd: add an option BR2_PACKAGE_SYSTEMD_GUEST

Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

this option allows a systemd tailored for a guest/container

---
 package/systemd/Config.in  | 14 ++++++++++----
 package/systemd/systemd.mk |  6 +++++-
 2 files changed, 15 insertions(+), 5 deletions(-)
package/systemd/Config.in +0 -0
index dd3b8c534..a8595dce8 100644

package/systemd/Config.in menuconfig BR2_PACKAGE_SYSTEMD · line 40

Quoted 10 lines
package/systemd/Config.in +3 -4
@@ -35,10 +35,10 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	select BR2_PACKAGE_UTIL_LINUX_MOUNT
 	select BR2_PACKAGE_UTIL_LINUX_NOLOGIN
 	select BR2_PACKAGE_UTIL_LINUX_FSCK
-	select BR2_PACKAGE_KMOD
-	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # kmod-tools
-	select BR2_PACKAGE_KMOD_TOOLS
-	select BR2_TARGET_TZ_INFO
+	select BR2_PACKAGE_KMOD if !BR2_PACKAGE_SYSTEMD_GUEST
+	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS if !BR2_PACKAGE_SYSTEMD_GUEST # kmod-tools
+	select BR2_PACKAGE_KMOD_TOOLS if !BR2_PACKAGE_SYSTEMD_GUEST

If kmod isn't REQUIRED, then I am fine with only pulling it in depending on BR2_PACKAGE_KMOD, E.G. for a non-modular kernel.

package/systemd/Config.in menuconfig BR2_PACKAGE_SYSTEMD · line 41

Quoted 1 line
package/systemd/Config.in +1 -0
+	select BR2_TARGET_TZ_INFO if !BR2_PACKAGE_SYSTEMD_GUEST

This I don't get. Why would the timezone info not be needed in a guest?

Docker at least afaik doesn't do anything special to expose timezone to guests:

date
Mon Jul 27 11:57:54 CEST 2020

docker run --rm -it debian:latest date
Mon Jul 27 09:57:56 UTC 2020

Care to send a patch to just make kmod optional instead of this _GUEST option?

Signature · 1 line
Bye, Peter Korsgaard
#17 lore raw

PATCH v3 7/7 configs/guest_*: use BR2_PACKAGE_SYSTEMD_GUEST

In reply to Francois Perrad
---
 configs/guest_arm_a7_defconfig | 13 +++++++++++++
 configs/guest_arm_a9_defconfig | 13 +++++++++++++
 configs/guest_x86_64_defconfig | 13 +++++++++++++
 3 files changed, 39 insertions(+)
configs/guest_arm_a7_defconfig +13 -0
index efe9a1369..2a9081edf 100644
@@ -11,6 +11,19 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
 # System
 BR2_INIT_SYSTEMD=y
 # BR2_TARGET_GENERIC_GETTY is not set
+# BR2_TARGET_TZ_INFO is not set
 
 # Filesystem
 BR2_TARGET_ROOTFS_TAR=y
+
+# Packages
+# BR2_PACKAGE_BUSYBOX_SHOW_OTHERS is not set
+# BR2_PACKAGE_KMOD is not set
+BR2_PACKAGE_SYSTEMD_GUEST=y
+# BR2_PACKAGE_SYSTEMD_PSTORE is not set
+# BR2_PACKAGE_SYSTEMD_HOSTNAMED is not set
+# BR2_PACKAGE_SYSTEMD_HWDB is not set
+# BR2_PACKAGE_SYSTEMD_MYHOSTNAME is not set
+# BR2_PACKAGE_SYSTEMD_NETWORKD is not set
+# BR2_PACKAGE_SYSTEMD_TIMEDATED is not set
+# BR2_PACKAGE_SYSTEMD_TIMESYNCD is not set
configs/guest_arm_a9_defconfig +13 -0
index 02c3d302d..2d19a31cd 100644
@@ -13,6 +13,19 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
 # System
 BR2_INIT_SYSTEMD=y
 # BR2_TARGET_GENERIC_GETTY is not set
+# BR2_TARGET_TZ_INFO is not set
 
 # Filesystem
 BR2_TARGET_ROOTFS_TAR=y
+
+# Packages
+# BR2_PACKAGE_BUSYBOX_SHOW_OTHERS is not set
+# BR2_PACKAGE_KMOD is not set
+BR2_PACKAGE_SYSTEMD_GUEST=y
+# BR2_PACKAGE_SYSTEMD_PSTORE is not set
+# BR2_PACKAGE_SYSTEMD_HOSTNAMED is not set
+# BR2_PACKAGE_SYSTEMD_HWDB is not set
+# BR2_PACKAGE_SYSTEMD_MYHOSTNAME is not set
+# BR2_PACKAGE_SYSTEMD_NETWORKD is not set
+# BR2_PACKAGE_SYSTEMD_TIMEDATED is not set
+# BR2_PACKAGE_SYSTEMD_TIMESYNCD is not set
configs/guest_x86_64_defconfig +13 -0
index 42d1d659a..4e19d23e5 100644
@@ -10,6 +10,19 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
 # System
 BR2_INIT_SYSTEMD=y
 # BR2_TARGET_GENERIC_GETTY is not set
+# BR2_TARGET_TZ_INFO is not set
 
 # Filesystem
 BR2_TARGET_ROOTFS_TAR=y
+
+# Packages
+# BR2_PACKAGE_BUSYBOX_SHOW_OTHERS is not set
+# BR2_PACKAGE_KMOD is not set
+BR2_PACKAGE_SYSTEMD_GUEST=y
+# BR2_PACKAGE_SYSTEMD_PSTORE is not set
+# BR2_PACKAGE_SYSTEMD_HOSTNAMED is not set
+# BR2_PACKAGE_SYSTEMD_HWDB is not set
+# BR2_PACKAGE_SYSTEMD_MYHOSTNAME is not set
+# BR2_PACKAGE_SYSTEMD_NETWORKD is not set
+# BR2_PACKAGE_SYSTEMD_TIMEDATED is not set
+# BR2_PACKAGE_SYSTEMD_TIMESYNCD is not set
Signature · 1 line
2.25.1