Skip to contentSkip to conversation

linux-cip: add kernel config snippet for container compatibility

PATCH In review Michael Adler 5 participants 9 messages Jan 8, 2025 – Feb 3, 2025

lore
Share & tools
lore
#0 lore raw

cover linux-cip: add kernel config snippet for container compatibility

While the cip-core x86-64 kernel configuration includes the necessary options for container engines like Docker, the arm64 configuration does not. I have identified the required kernel configuration options to ensure compatibility with Docker and Podman.
Instead of integrating these options directly into the arm64 configuration, I am providing them as a drop-in snippet to support custom kernel configurations.

Note: I am open to feedback on whether this should remain a drop-in snippet or be merged into the default configuration.

Michael Adler (1):
linux-cip: add kernel config snippet for container compatibility

 conf/machine/qemu-amd64.conf              |   1 +
 conf/machine/qemu-arm64.conf              |   1 +
 recipes-kernel/linux/files/container.cfg  | 114 ++++++++++++++++++++++
 recipes-kernel/linux/linux-cip-common.inc |   5 +
 4 files changed, 121 insertions(+)
 create mode 100644 recipes-kernel/linux/files/container.cfg
Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/1 linux-cip: add kernel config snippet for container compatibility

Obtaining a fully functional kernel configuration as required by popular container engines such as Docker or Podman can be challenging. By setting the Bitbake variable USE_CIP_KERNEL_CONTAINER_CONFIG to 1, a kernel config snippet is included to ensure compatibility with these container engines.

Note: This feature is designed to be separate from the cip-kernel-config project to allow for custom kernel configurations.

---
 conf/machine/qemu-amd64.conf              |   1 +
 conf/machine/qemu-arm64.conf              |   1 +
 recipes-kernel/linux/files/container.cfg  | 114 ++++++++++++++++++++++
 recipes-kernel/linux/linux-cip-common.inc |   5 +
 4 files changed, 121 insertions(+)
 create mode 100644 recipes-kernel/linux/files/container.cfg
conf/machine/qemu-amd64.conf +1 -0
index d786646..dad6504 100644
@@ -10,4 +10,5 @@ DISTRO_ARCH = "amd64"
 
 IMAGE_FSTYPES ?= "ext4"
 USE_CIP_KERNEL_CONFIG = "1"
+USE_CIP_KERNEL_CONTAINER_CONFIG = "1"
 KERNEL_DEFCONFIG = "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/x86/cip_merged_defconfig"
conf/machine/qemu-arm64.conf +1 -0
index a2c5e53..8fd824c 100644
@@ -10,6 +10,7 @@ DISTRO_ARCH = "arm64"
 
 IMAGE_FSTYPES ?= "ext4"
 USE_CIP_KERNEL_CONFIG = "1"
+USE_CIP_KERNEL_CONTAINER_CONFIG = "1"
 KERNEL_DEFCONFIG ?= "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/arm64/cip_merged_defconfig"
 
 # watchdog is not yet supported in our QEMU executor for this platform, disable it
recipes-kernel/linux/files/container.cfg new file +114 -0

114 lines not on this page · raw message

recipes-kernel/linux/linux-cip-common.inc +5 -0
index 5d1b8ac..437ee17 100644
@@ -23,4 +23,9 @@ SRC_URI += " \
     https://cdn.kernel.org/pub/linux/kernel/projects/cip/${KERNEL_MAJOR_MINOR}/linux-cip-${PV}.tar.xz \
     "
 
+SRC_URI:append = " ${@ \
+    'file://container.cfg' \
+    if d.getVar('USE_CIP_KERNEL_CONTAINER_CONFIG') == '1' else '' \
+    }"
+
 S = "${WORKDIR}/linux-cip-${PV}"
Signature · 1 line
2.47.1
#2 lore raw
Quoted 33 lines · Michael Adler via lists.cip- project.org

Obtaining a fully functional kernel configuration as required by popular container engines such as Docker or Podman can be challenging. By setting the Bitbake variable USE_CIP_KERNEL_CONTAINER_CONFIG to 1, a kernel config snippet is included to ensure compatibility with these container engines.

Note: This feature is designed to be separate from the cip-kernel-config project to allow for custom kernel configurations.

---
 conf/machine/qemu-amd64.conf              |   1 +
 conf/machine/qemu-arm64.conf              |   1 +
 recipes-kernel/linux/files/container.cfg  | 114 ++++++++++++++++++++++
 recipes-kernel/linux/linux-cip-common.inc |   5 +
 4 files changed, 121 insertions(+)
 create mode 100644 recipes-kernel/linux/files/container.cfg
conf/machine/qemu-amd64.conf +1 -0
index d786646..dad6504 100644
@@ -10,4 +10,5 @@ DISTRO_ARCH = "amd64"
 
 IMAGE_FSTYPES ?= "ext4"
 USE_CIP_KERNEL_CONFIG = "1"
+USE_CIP_KERNEL_CONTAINER_CONFIG = "1"
 KERNEL_DEFCONFIG = "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/x86/cip_merged_defconfig"
conf/machine/qemu-arm64.conf +0 -0
index a2c5e53..8fd824c 100644

conf/machine/qemu-arm64.conf DISTRO_ARCH = "arm64" · line 13

Quoted 4 lines
conf/machine/qemu-arm64.conf +1 -0
@@ -10,6 +10,7 @@ DISTRO_ARCH = "arm64"
 
 IMAGE_FSTYPES ?= "ext4"
 USE_CIP_KERNEL_CONFIG = "1"
+USE_CIP_KERNEL_CONTAINER_CONFIG = "1"

I get the idea, but the user / downstream could append your kconfig file to the SRC_URI directly. No need for the variable. Files ending in .cfg are "auto detected" as kernel configuration files.

Quoted 113 lines
conf/machine/qemu-arm64.conf +0 -0
 KERNEL_DEFCONFIG ?= "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/arm64/cip_merged_defconfig"
 
 # watchdog is not yet supported in our QEMU executor for this platform, disable it
recipes-kernel/linux/files/container.cfg new file +104 -0
new file mode 100644
index 0000000..18f8b2b
@@ -0,0 +1,114 @@
+# Copyright (c) Siemens AG, 2025
+#
+# Authors:
+#  Michael Adler <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+
+# Kernel configuration required by container runtimes such as Docker.
+# Based on the following scripts:
+#
+#   - https://github.com/moby/moby/blob/master/contrib/check-config.sh
+#   - https://github.com/opencontainers/runc/blob/main/script/check-config.sh
+#
+# NOTE: CONFIG_SECURITY_SELINUX and CONFIG_SECURITY_APPARMOR are intentionally
+# not enabled.
+
+CONFIG_NAMESPACES=y
+CONFIG_NET_NS=y
+CONFIG_PID_NS=y
+CONFIG_IPC_NS=y
+CONFIG_UTS_NS=y
+
+CONFIG_CPUSETS=y
+CONFIG_CRYPTO=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_GCM=y
+CONFIG_CRYPTO_GHASH=y
+CONFIG_CRYPTO_SEQIV=y
+CONFIG_KEYS=y
+CONFIG_MEMCG=y
+CONFIG_CHECKPOINT_RESTORE=y
+
+CONFIG_OVERLAY_FS=m
+
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_CGROUP_DEVICE=y
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CGROUP_NET_PRIO=y
+CONFIG_CGROUP_PERF=y
+CONFIG_CGROUP_PIDS=y
+CONFIG_CGROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_CGROUP_BPF=y
+CONFIG_BPF_SYSCALL=y
+CONFIG_CFS_BANDWIDTH=y
+CONFIG_RT_GROUP_SCHED=y
+
+CONFIG_HUGETLBFS=y
+CONFIG_CGROUP_HUGETLB=y
+
+CONFIG_BLK_CGROUP=y
+CONFIG_BLK_CGROUP_IOCOST=y
+CONFIG_BLK_DEV_THROTTLING=y
+
+CONFIG_NET=y
+CONFIG_NET_CLS_CGROUP=y
+CONFIG_NET_CLS_ACT=y
+CONFIG_NET_EMATCH=y
+CONFIG_NET_SCHED=y
+CONFIG_NETLABEL=y
+CONFIG_INET=y
+CONFIG_POSIX_MQUEUE=y
+
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+CONFIG_VETH=m
+CONFIG_BRIDGE=m
+CONFIG_BRIDGE_NETFILTER=m
+CONFIG_BRIDGE_VLAN_FILTERING=m
+CONFIG_VXLAN=m
+CONFIG_IPVLAN=m
+CONFIG_MACVLAN=m
+
+CONFIG_NETFILTER=y
+CONFIG_NETFILTER_ADVANCED=y
+CONFIG_NETFILTER_XT_MARK=m
+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
+CONFIG_NETFILTER_XT_MATCH_BPF=m
+CONFIG_NETFILTER_XT_MATCH_COMMENT=m
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
+CONFIG_NETFILTER_XT_MATCH_IPVS=m
+CONFIG_IP_NF_FILTER=m
+CONFIG_IP_NF_IPTABLES=m
+CONFIG_IP_NF_MANGLE=m
+CONFIG_IP_NF_NAT=m
+CONFIG_IP_NF_TARGET_MASQUERADE=m
+CONFIG_IP_NF_TARGET_REDIRECT=m
+CONFIG_IP_VS=m
+CONFIG_IP_VS_NFCT=y
+CONFIG_IP_VS_PROTO_TCP=y
+CONFIG_IP_VS_PROTO_UDP=y
+CONFIG_IP_VS_RR=m
+
+CONFIG_NF_TABLES=m
+CONFIG_NF_TABLES_INET=y
+CONFIG_NF_TABLES_NETDEV=y
+CONFIG_NF_CONNTRACK=m
+CONFIG_NF_CONNTRACK_FTP=m
+CONFIG_NF_CT_NETLINK=m
+CONFIG_NF_NAT=m
+CONFIG_NF_NAT_IPV4=m
+CONFIG_NF_NAT_MASQUERADE=m
+CONFIG_NF_NAT_NEEDED=m

recipes-kernel/linux/files/container.cfg line 114

Quoted 10 lines
recipes-kernel/linux/files/container.cfg new file +10 -0
+
+CONFIG_NFT_COMPAT=m
+CONFIG_NFT_CT=m
+CONFIG_NFT_HASH=m
+CONFIG_NFT_LIMIT=m
+CONFIG_NFT_LOG=m
+CONFIG_NFT_MASQ=m
+CONFIG_NFT_NAT=m
+CONFIG_NFT_REDIR=m
+CONFIG_NFT_REJECT=m

All CIP kernels are building fine with this config enabled? I'm missing the testing part...

recipes-kernel/linux/linux-cip-common.inc SRC_URI += " \ · line 30

Quoted 13 lines
recipes-kernel/linux/linux-cip-common.inc +5 -0
index 5d1b8ac..437ee17 100644
@@ -23,4 +23,9 @@ SRC_URI += " \
     https://cdn.kernel.org/pub/linux/kernel/projects/cip/${KERNEL_MAJOR_MINOR}/linux-cip-${PV}.tar.xz \
     "
 
+SRC_URI:append = " ${@ \
+    'file://container.cfg' \
+    if d.getVar('USE_CIP_KERNEL_CONTAINER_CONFIG') == '1' else '' \
+    }"
+

As said, could be moved to the user.

Quoted 3 lines
recipes-kernel/linux/linux-cip-common.inc +0 -0
 S = "${WORKDIR}/linux-cip-${PV}"
Signature · 1 line
2.47.1
#3 lore raw
In reply to Michael Adler
Quoted 10 lines · Michael Adler

While the cip-core x86-64 kernel configuration includes the necessary options
for container engines like Docker, the arm64 configuration does not. I have identified the required kernel configuration options to ensure compatibility with Docker and Podman.
Instead of integrating these options directly into the arm64 configuration, I
am providing them as a drop-in snippet to support custom kernel configurations.

Quoted 3 lines

Note: I am open to feedback on whether this should remain a drop-in snippet or
be merged into the default configuration.

Hi, IMHO this should be merged into the cip defconf. At least the non- arch specific features should be consistent across architectures.

Putting Nobuhiro in CC, as he maintains the cip kernel config.

We further should validate the both platforms with the runc checker script:
https://github.com/opencontainers/runc/blob/main/script/check-config.sh

Best regards,
Felix

Quoted 13 lines

Michael Adler (1):
  linux-cip: add kernel config snippet for container compatibility

 conf/machine/qemu-amd64.conf              |   1 + conf/machine/qemu-arm64.conf              |   1 + recipes-kernel/linux/files/container.cfg  | 114
++++++++++++++++++++++
 recipes-kernel/linux/linux-cip-common.inc |   5 +

 4 files changed, 121 insertions(+)

 create mode 100644 recipes-kernel/linux/files/container.cfg

#4 lore raw
Quoted 11 lines · Felix
Quoted 10 lines · Michael Adler

While the cip-core x86-64 kernel configuration includes the necessary options
for container engines like Docker, the arm64 configuration does not. I have identified the required kernel configuration options to ensure compatibility with Docker and Podman.
Instead of integrating these options directly into the arm64 configuration, I
am providing them as a drop-in snippet to support custom kernel configurations.

Quoted 6 lines
Quoted 3 lines

Note: I am open to feedback on whether this should remain a drop-in snippet or
be merged into the default configuration.

Hi, IMHO this should be merged into the cip defconf. At least the non- arch specific features should be consistent across architectures.

It must be merged there to have practical effect: support scope extension, test coverage for the kernel.

Once merged, please propose a patch for isar-cip-core to bump the cip-kernel-config revision here (and tag it with [isar-cip-core], please).

Thanks,
Jan

Quoted 24 lines

Putting Nobuhiro in CC, as he maintains the cip kernel config.

We further should validate the both platforms with the runc checker script:
https://github.com/opencontainers/runc/blob/main/script/check-config.sh

Best regards,
Felix

Quoted 13 lines

Michael Adler (1):
  linux-cip: add kernel config snippet for container compatibility

 conf/machine/qemu-amd64.conf              |   1 + conf/machine/qemu-arm64.conf              |   1 + recipes-kernel/linux/files/container.cfg  | 114
++++++++++++++++++++++
 recipes-kernel/linux/linux-cip-common.inc |   5 +

 4 files changed, 121 insertions(+)

 create mode 100644 recipes-kernel/linux/files/container.cfg

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
#5 lore raw
In reply to MOESSBAUER, Felix

Hi all,

Sorry for reply was late.

Quoted 20 lines

-----Original Message-----
From: MOESSBAUER, Felix <[email protected]>
Sent: Wednesday, January 8, 2025 7:17 PM
To: [email protected]; Adler, Michael <[email protected]>
Cc: iwamatsu nobuhiro(岩松 信洋 ○DITC□DIT○OST) <[email protected]>
Subject: Re: [PATCH 0/1] linux-cip: add kernel config snippet for container compatibility

Quoted 9 lines · Michael Adler

While the cip-core x86-64 kernel configuration includes the necessary options for container engines like Docker, the arm64 configuration does not.
I have identified the required kernel configuration options to ensure compatibility with Docker and Podman.
Instead of integrating these options directly into the arm64 configuration, I am providing them as a drop-in snippet to support custom kernel configurations.

Quoted 8 lines
Quoted 2 lines

Note: I am open to feedback on whether this should remain a drop-in snippet or be merged into the default configuration.

Hi, IMHO this should be merged into the cip defconf. At least the non- arch specific features should be consistent across architectures.

Putting Nobuhiro in CC, as he maintains the cip kernel config.

Yes, please send us patches.
There is no reason to distribute and manage CIP kernel configs.

Best regards,
Nobuhiro

#6 lore raw

Hi Nobuhiro,

thanks for your reply.

Quoted 2 lines

Yes, please send us patches.
There is no reason to distribute and manage CIP kernel configs.

I was hoping you could incorporate the options (which I sent in this patch) because I'm not really sure where to start:

- There seems to be a lot of duplication, even at the file level (e.g., find . -name '*_defconfig' | xargs md5sum | awk '{ print $1; }' | sort | uniq -c). Do you manage everything manually, or do you have scripts to automate the process?
- Device-specific configs include non-device settings (e.g., cgroups, filesystems). In which file should the container settings go? cip_merged_defconfig or is that file auto-generated?
- There are kernel versions listed that were never LTS upstream (e.g., 6.11, 6.13). Are these versions officially supported by CIP?

Kind Regards,
Michael

Signature · 15 lines
Michael Adler

Siemens AG
Technology
Connectivity & Edge
Open Source Embedded Systems
FT RPD CED OES-DE
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Jim Hagemann
Snabe; Managing Board: Roland Busch, Chairman, President and Chief Executive
Officer; Cedrik Neike, Matthias Rebellius, Ralf P. Thomas, Judith Wiese;
Registered offices: Berlin and Munich, Germany; Commercial registries:
Berlin-Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322
#7 lore raw

Hi Michael,

Quoted 7 lines

I was hoping you could incorporate the options (which I sent in this patch) because I'm not really sure where to start:

- There seems to be a lot of duplication, even at the file level (e.g., find . -name '*_defconfig' | xargs md5sum | awk '{ print $1; }' | sort | uniq -c). Do you manage everything manually, or do you have scripts to automate the
process?

The kernel configurations without merged_defconfig currently maintained in the repository are hardware-specific and submitted by the company that provided the hardware. Therefore, there is no script.

Quoted 3 lines

- Device-specific configs include non-device settings (e.g., cgroups, filesystems). In which file should the container settings go? cip_merged_defconfig or is that file auto-generated?

In my opinion, it is better to create a separate config for containers from cip_merged_defconfig first. For example, “cip_container_defconfig”. Because cip_merged_defconfig contains many configurations that depend on a specific CIP reference HW.
In the future, it could be combined with cip_merged_defconfig for build resources and testing.

Quoted 3 lines

- There are kernel versions listed that were never LTS upstream (e.g., 6.11, 6.13). Are these versions officially supported by CIP?

No, 6.11 and other configurations exist for use in past CI's (they were removed from the repository yesterday). Please ignore CIP kernels and non-LTS versions.

First, could you create a config for the container, as wrote above?]

Best regards,
Nobuhiro

Quoted 50 lines

-----Original Message-----
From: Michael Adler <[email protected]>
Sent: Tuesday, January 28, 2025 6:44 PM
To: iwamatsu nobuhiro(岩松 信洋 ○DITC□DIT○OST) <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH 0/1] linux-cip: add kernel config snippet for container compatibility

Hi Nobuhiro,

thanks for your reply.

Quoted 2 lines

Yes, please send us patches.
There is no reason to distribute and manage CIP kernel configs.

I was hoping you could incorporate the options (which I sent in this patch) because I'm not really sure where to start:

- There seems to be a lot of duplication, even at the file level (e.g., find . -name '*_defconfig' | xargs md5sum | awk '{ print $1; }' | sort | uniq -c). Do you manage everything manually, or do you have scripts to automate the
process?
- Device-specific configs include non-device settings (e.g., cgroups, filesystems). In which file should the container settings go? cip_merged_defconfig or is that file auto-generated?
- There are kernel versions listed that were never LTS upstream (e.g., 6.11, 6.13). Are these versions officially supported by CIP?

Kind Regards,
Michael

--
Michael Adler

Siemens AG
Technology
Connectivity & Edge
Open Source Embedded Systems
FT RPD CED OES-DE
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Jim Hagemann Snabe; Managing Board: Roland Busch, Chairman, President and Chief Executive Officer; Cedrik Neike, Matthias Rebellius, Ralf P. Thomas, Judith Wiese; Registered offices: Berlin and Munich, Germany; Commercial registries:
Berlin-Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322

#8 lore raw

Hi Nobuhiro,

Quoted 1 line

First, could you create a config for the container, as wrote above?]

I'm not sure if I understood you correctly, but here we go anyway:

https://gitlab.com/cip-project/cip-kernel/cip-kernel-config/-/merge_requests/112

Here's how I created the config:

- took cip_merged_defconfig
- appended the options from my container.cfg
- removed duplicates

If that's alright, I will go ahead and do the same for the other kernel versions.

Kind regards,
Michael

Signature · 15 lines
Michael Adler

Siemens AG
Technology
Connectivity & Edge
Open Source Embedded Systems
FT RPD CED OES-DE
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Jim Hagemann
Snabe; Managing Board: Roland Busch, Chairman, President and Chief Executive
Officer; Cedrik Neike, Matthias Rebellius, Ralf P. Thomas, Judith Wiese;
Registered offices: Berlin and Munich, Germany; Commercial registries:
Berlin-Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322