From 628d9430a8316bde742e5defbc6be3733e183624 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Wed, 6 Mar 2024 18:56:18 +0000 Subject: kernel/cfg: move to a kernel-cache / central location for configuration We've had duplicate fragments in the kernel-cache and the meta-virt layer for quite some time (i.e. docker). To more easily keep these in sync, promote the sharing of fragments and to allow them to be used even when meta-virt isn't part of a build, we change our feature additions to use the yocto-kernel-cfg clone of the kernel-cache instead of the ones in our layer. It remains to be seen if any other kernel recipes will run into issues with this movement of the fragments, so we mark this as a WIP/RFC. Signed-off-by: Bruce Ashfield --- .../linux/linux-yocto/cgroup-hugetlb.cfg | 5 --- .../linux/linux-yocto/cgroup-hugetlb.scc | 5 --- recipes-kernel/linux/linux-yocto/criu.cfg | 8 ---- recipes-kernel/linux/linux-yocto/criu.scc | 4 -- recipes-kernel/linux/linux-yocto/docker.cfg | 13 ------ recipes-kernel/linux/linux-yocto/docker.scc | 4 -- recipes-kernel/linux/linux-yocto/ebtables.cfg | 2 - recipes-kernel/linux/linux-yocto/ebtables.scc | 4 -- recipes-kernel/linux/linux-yocto/kubernetes.cfg | 39 ----------------- recipes-kernel/linux/linux-yocto/kubernetes.scc | 3 -- recipes-kernel/linux/linux-yocto/lxc.cfg | 32 -------------- recipes-kernel/linux/linux-yocto/lxc.scc | 4 -- recipes-kernel/linux/linux-yocto/vswitch.cfg | 3 -- recipes-kernel/linux/linux-yocto/vswitch.scc | 4 -- recipes-kernel/linux/linux-yocto/xen.cfg | 49 ---------------------- recipes-kernel/linux/linux-yocto/xen.scc | 4 -- recipes-kernel/linux/linux-yocto/xt-checksum.cfg | 1 - recipes-kernel/linux/linux-yocto/xt-checksum.scc | 4 -- .../linux/linux-yocto_virtualization.inc | 49 ++++++++++++++++------ 19 files changed, 36 insertions(+), 201 deletions(-) delete mode 100644 recipes-kernel/linux/linux-yocto/cgroup-hugetlb.cfg delete mode 100644 recipes-kernel/linux/linux-yocto/cgroup-hugetlb.scc delete mode 100644 recipes-kernel/linux/linux-yocto/criu.cfg delete mode 100644 recipes-kernel/linux/linux-yocto/criu.scc delete mode 100644 recipes-kernel/linux/linux-yocto/docker.cfg delete mode 100644 recipes-kernel/linux/linux-yocto/docker.scc delete mode 100644 recipes-kernel/linux/linux-yocto/ebtables.cfg delete mode 100644 recipes-kernel/linux/linux-yocto/ebtables.scc delete mode 100644 recipes-kernel/linux/linux-yocto/kubernetes.cfg delete mode 100644 recipes-kernel/linux/linux-yocto/kubernetes.scc delete mode 100644 recipes-kernel/linux/linux-yocto/lxc.cfg delete mode 100644 recipes-kernel/linux/linux-yocto/lxc.scc delete mode 100644 recipes-kernel/linux/linux-yocto/vswitch.cfg delete mode 100644 recipes-kernel/linux/linux-yocto/vswitch.scc delete mode 100644 recipes-kernel/linux/linux-yocto/xen.cfg delete mode 100644 recipes-kernel/linux/linux-yocto/xen.scc delete mode 100644 recipes-kernel/linux/linux-yocto/xt-checksum.cfg delete mode 100644 recipes-kernel/linux/linux-yocto/xt-checksum.scc diff --git a/recipes-kernel/linux/linux-yocto/cgroup-hugetlb.cfg b/recipes-kernel/linux/linux-yocto/cgroup-hugetlb.cfg deleted file mode 100644 index 417ca249..00000000 --- a/recipes-kernel/linux/linux-yocto/cgroup-hugetlb.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# This requires CONFIG_HUGETLBFS - -CONFIG_CGROUP_HUGETLB=y diff --git a/recipes-kernel/linux/linux-yocto/cgroup-hugetlb.scc b/recipes-kernel/linux/linux-yocto/cgroup-hugetlb.scc deleted file mode 100644 index 7d1f9997..00000000 --- a/recipes-kernel/linux/linux-yocto/cgroup-hugetlb.scc +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: MIT -define KFEATURE_DESCRIPTION "Enable hugetlb cgroup" -define KFEATURE_COMPATIBILITY all - -kconf non-hardware cgroup-hugetlb.cfg diff --git a/recipes-kernel/linux/linux-yocto/criu.cfg b/recipes-kernel/linux/linux-yocto/criu.cfg deleted file mode 100644 index dc9502a6..00000000 --- a/recipes-kernel/linux/linux-yocto/criu.cfg +++ /dev/null @@ -1,8 +0,0 @@ -#Networking options options for sock-diag subsystem -CONFIG_UNIX_DIAG=y -CONFIG_INET_DIAG=y -CONFIG_INET_UDP_DIAG=y -CONFIG_PACKET_DIAG=y -CONFIG_NETLINK_DIAG=y -CONFIG_NETFILTER_XT_MARK=y -CONFIG_TUN=m diff --git a/recipes-kernel/linux/linux-yocto/criu.scc b/recipes-kernel/linux/linux-yocto/criu.scc deleted file mode 100644 index 87a88113..00000000 --- a/recipes-kernel/linux/linux-yocto/criu.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Enable Networking Features needed by criu." -define KFEATURE_COMPATIBILITY board - -kconf non-hardware criu.cfg diff --git a/recipes-kernel/linux/linux-yocto/docker.cfg b/recipes-kernel/linux/linux-yocto/docker.cfg deleted file mode 100644 index eeeaa242..00000000 --- a/recipes-kernel/linux/linux-yocto/docker.cfg +++ /dev/null @@ -1,13 +0,0 @@ -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -CONFIG_IP_NF_FILTER=m -CONFIG_NF_NAT=m -CONFIG_NF_CONNTRACK=y - -CONFIG_DM_THIN_PROVISIONING=m - - -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -CONFIG_NETFILTER_XT_MATCH_IPVS=m - -CONFIG_OVERLAY_FS=y diff --git a/recipes-kernel/linux/linux-yocto/docker.scc b/recipes-kernel/linux/linux-yocto/docker.scc deleted file mode 100644 index e317456c..00000000 --- a/recipes-kernel/linux/linux-yocto/docker.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Enable Features needed by docker in addition to LXC features" -define KFEATURE_COMPATIBILITY board - -kconf non-hardware docker.cfg diff --git a/recipes-kernel/linux/linux-yocto/ebtables.cfg b/recipes-kernel/linux/linux-yocto/ebtables.cfg deleted file mode 100644 index a3c514e1..00000000 --- a/recipes-kernel/linux/linux-yocto/ebtables.cfg +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_BRIDGE_NF_EBTABLES=m -CONFIG_BRIDGE_EBT_T_NAT=m diff --git a/recipes-kernel/linux/linux-yocto/ebtables.scc b/recipes-kernel/linux/linux-yocto/ebtables.scc deleted file mode 100644 index b3895e58..00000000 --- a/recipes-kernel/linux/linux-yocto/ebtables.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Enable ebtables support" -define KFEATURE_COMPATIBILITY board - -kconf non-hardware ebtables.cfg diff --git a/recipes-kernel/linux/linux-yocto/kubernetes.cfg b/recipes-kernel/linux/linux-yocto/kubernetes.cfg deleted file mode 100644 index 84fa8c57..00000000 --- a/recipes-kernel/linux/linux-yocto/kubernetes.cfg +++ /dev/null @@ -1,39 +0,0 @@ -CONFIG_BLK_CGROUP=y -CONFIG_BLK_DEV_THROTTLING=y -CONFIG_CGROUP_PERF=y -CONFIG_CGROUP_HUGETLB=y -CONFIG_NET_CLS_CGROUP=y -CONFIG_CFS_BANDWIDTH=y -CONFIG_FAIR_GROUP_SCHED=y -CONFIG_RT_GROUP_SCHED=y -CONFIG_IP_NF_TARGET_REDIRECT=y -CONFIG_IP_SET=m -CONFIG_IP_VS=y -CONFIG_IP_VS_NFCT=y -CONFIG_IP_VS_PROTO_TCP=y -CONFIG_IP_VS_PROTO_UDP=y -CONFIG_IP_VS_RR=m -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NETFILTER_XT_CONNMARK=m -CONFIG_NETFILTER_XT_MATCH_COMMENT=m -CONFIG_NETFILTER_XT_MATCH_LIMIT=m -CONFIG_NETFILTER_XT_MATCH_MARK=m -CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -CONFIG_NETFILTER_XT_TARGET_NFLOG=m -CONFIG_NETFILTER_XT_TARGET_REDIRECT=m -CONFIG_NAMESPACES=y -CONFIG_NET_NS=y -CONFIG_PID_NS=y -CONFIG_IPC_NS=y -CONFIG_UTS_NS=y -CONFIG_CGROUPS=y -CONFIG_CGROUP_CPUACCT=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CGROUP_FREEZER=y -CONFIG_CGROUP_SCHED=y -CONFIG_SMP=y -CONFIG_CPUSETS=y -CONFIG_MEMCG=y -CONFIG_INET=y -CONFIG_EXT4_FS=y -CONFIG_PROC_FS=y diff --git a/recipes-kernel/linux/linux-yocto/kubernetes.scc b/recipes-kernel/linux/linux-yocto/kubernetes.scc deleted file mode 100644 index a94ae845..00000000 --- a/recipes-kernel/linux/linux-yocto/kubernetes.scc +++ /dev/null @@ -1,3 +0,0 @@ -include docker.scc -include cgl/cfg/net/ip_vs.scc -kconf non-hardware kubernetes.cfg diff --git a/recipes-kernel/linux/linux-yocto/lxc.cfg b/recipes-kernel/linux/linux-yocto/lxc.cfg deleted file mode 100644 index e195c15b..00000000 --- a/recipes-kernel/linux/linux-yocto/lxc.cfg +++ /dev/null @@ -1,32 +0,0 @@ -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_MEMCG=y -CONFIG_CGROUP_SCHED=y -CONFIG_FAIR_GROUP_SCHED=y -CONFIG_CHECKPOINT_RESTORE=y -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -CONFIG_USER_NS=y -CONFIG_PID_NS=y -CONFIG_NET_NS=y - -CONFIG_NET_CLS_CGROUP=m -CONFIG_BLK_CGROUP=y -CONFIG_CGROUP_NET_PRIO=y - -# Virtual drivers -CONFIG_HVC_DRIVER=y - -# Base support for live boot -CONFIG_BLK_DEV_LOOP=y -CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_ISO8859_1=y -CONFIG_VFAT_FS=y -CONFIG_RD_GZIP=y - -# Support for virtual ethernet and LXC -CONFIG_VETH=y -CONFIG_MACVLAN=y -CONFIG_VXLAN=m diff --git a/recipes-kernel/linux/linux-yocto/lxc.scc b/recipes-kernel/linux/linux-yocto/lxc.scc deleted file mode 100644 index ee518835..00000000 --- a/recipes-kernel/linux/linux-yocto/lxc.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Enable Features needed by LxC, namespaces, cgroups et.c." -define KFEATURE_COMPATIBILITY board - -kconf non-hardware lxc.cfg diff --git a/recipes-kernel/linux/linux-yocto/vswitch.cfg b/recipes-kernel/linux/linux-yocto/vswitch.cfg deleted file mode 100644 index b1fefc0c..00000000 --- a/recipes-kernel/linux/linux-yocto/vswitch.cfg +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_OPENVSWITCH=m -CONFIG_NET_SCH_INGRESS=m -CONFIG_NET_ACT_POLICE=m diff --git a/recipes-kernel/linux/linux-yocto/vswitch.scc b/recipes-kernel/linux/linux-yocto/vswitch.scc deleted file mode 100644 index 2790b4fe..00000000 --- a/recipes-kernel/linux/linux-yocto/vswitch.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Enable in kernel OpenvSwitch module" -define KFEATURE_COMPATIBILITY board - -kconf non-hardware vswitch.cfg diff --git a/recipes-kernel/linux/linux-yocto/xen.cfg b/recipes-kernel/linux/linux-yocto/xen.cfg deleted file mode 100644 index af821d2f..00000000 --- a/recipes-kernel/linux/linux-yocto/xen.cfg +++ /dev/null @@ -1,49 +0,0 @@ -CONFIG_HYPERVISOR_GUEST=y -CONFIG_PARAVIRT=y -CONFIG_XEN=y -CONFIG_XEN_DOM0=y -CONFIG_XEN_PVHVM=y -CONFIG_XEN_SAVE_RESTORE=y -# CONFIG_XEN_DEBUG_FS is not set -CONFIG_XEN_PVH=y -CONFIG_MMU_NOTIFIER=y -CONFIG_HIBERNATE_CALLBACKS=y -CONFIG_PCI_XEN=y -CONFIG_XEN_PCIDEV_FRONTEND=y -CONFIG_SYS_HYPERVISOR=y -CONFIG_XEN_BLKDEV_FRONTEND=y -CONFIG_XEN_BLKDEV_BACKEND=m -CONFIG_XEN_SCSI_FRONTEND=m -CONFIG_XEN_NETDEV_FRONTEND=y -CONFIG_XEN_NETDEV_BACKEND=m -CONFIG_INPUT_MISC=y -CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y -CONFIG_HVC_IRQ=y -CONFIG_HVC_XEN=y -CONFIG_HVC_XEN_FRONTEND=y -CONFIG_XEN_WDT=m -CONFIG_FB_SYS_FILLRECT=y -CONFIG_FB_SYS_COPYAREA=y -CONFIG_FB_SYS_IMAGEBLIT=y -CONFIG_FB_SYS_FOPS=y -CONFIG_FB_DEFERRED_IO=y -CONFIG_XEN_FBDEV_FRONTEND=y -CONFIG_XEN_BALLOON=y -CONFIG_XEN_SCRUB_PAGES_DEFAULT=y -CONFIG_XEN_DEV_EVTCHN=y -CONFIG_XEN_BACKEND=y -CONFIG_XENFS=y -CONFIG_XEN_COMPAT_XENFS=y -CONFIG_XEN_SYS_HYPERVISOR=y -CONFIG_XEN_XENBUS_FRONTEND=y -CONFIG_XEN_GNTDEV=m -CONFIG_XEN_GRANT_DEV_ALLOC=m -CONFIG_SWIOTLB_XEN=y -CONFIG_XEN_PCIDEV_BACKEND=m -CONFIG_XEN_PRIVCMD=y -CONFIG_XEN_ACPI_PROCESSOR=m -CONFIG_XEN_MCE_LOG=y -CONFIG_XEN_HAVE_PVMMU=y -CONFIG_XEN_EFI=y -CONFIG_XEN_AUTO_XLATE=y -CONFIG_XEN_ACPI=y diff --git a/recipes-kernel/linux/linux-yocto/xen.scc b/recipes-kernel/linux/linux-yocto/xen.scc deleted file mode 100644 index b588e5df..00000000 --- a/recipes-kernel/linux/linux-yocto/xen.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Xen Kernel Support" -define KFEATURE_COMPATIBILITY arch - -kconf non-hardware xen.cfg diff --git a/recipes-kernel/linux/linux-yocto/xt-checksum.cfg b/recipes-kernel/linux/linux-yocto/xt-checksum.cfg deleted file mode 100644 index 58afbff6..00000000 --- a/recipes-kernel/linux/linux-yocto/xt-checksum.cfg +++ /dev/null @@ -1 +0,0 @@ -CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m diff --git a/recipes-kernel/linux/linux-yocto/xt-checksum.scc b/recipes-kernel/linux/linux-yocto/xt-checksum.scc deleted file mode 100644 index d3804f0c..00000000 --- a/recipes-kernel/linux/linux-yocto/xt-checksum.scc +++ /dev/null @@ -1,4 +0,0 @@ -define KFEATURE_DESCRIPTION "Add extra iptables modules" -define KFEATURE_COMPATIBILITY board - -kconf non-hardware xt-checksum.cfg diff --git a/recipes-kernel/linux/linux-yocto_virtualization.inc b/recipes-kernel/linux/linux-yocto_virtualization.inc index a37759ef..0ace9a75 100644 --- a/recipes-kernel/linux/linux-yocto_virtualization.inc +++ b/recipes-kernel/linux/linux-yocto_virtualization.inc @@ -1,14 +1,6 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/linux-yocto:" -SRC_URI += "file://xt-checksum.scc \ - file://ebtables.scc \ - file://vswitch.scc \ - file://lxc.scc \ - file://docker.scc \ - file://cgroup-hugetlb.scc \ - file://criu.scc \ - " -KERNEL_FEATURES:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'kvm', 'features/kvm/qemu-kvm-enable.scc', '', d)}" +KERNEL_FEATURES:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'kvm', ' features/kvm/qemu-kvm-enable.scc', '', d)}" KERNEL_MODULE_AUTOLOAD += "nf_conntrack_ipv6 openvswitch" KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains('DISTRO_FEATURES', 'kvm', 'kvm', '', d)}" @@ -16,6 +8,16 @@ KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains('DISTRO_FEATURES', 'kvm', 'kvm', # aufs kernel support required for xen-image-minimal KERNEL_FEATURES:append = "${@bb.utils.contains('DISTRO_FEATURES', 'aufs', ' features/aufs/aufs-enable.scc', '', d)}" + +# SRC_URI += "file://xt-checksum.scc \ +# file://ebtables.scc \ +# file://vswitch.scc \ +# file://lxc.scc \ +# file://docker.scc \ +# file://cgroup-hugetlb.scc \ +# file://criu.scc \ +# " + # if the kernel-yocto meta-data routine automatically starts to add the # recipe-sysroot-native, we can do away with this conditional, since all # features will be found at the same relative offset from a search @@ -28,7 +30,24 @@ def kernel_cache_cond_feature(src_uri,feature): return "../recipe-sysroot-native/kcfg/" + feature -KERNEL_CACHE_FEATURES ?= "${@kernel_cache_cond_feature(d.getVar('SRC_URI'),'cfg/virtio.scc')}" +# no conditional, just use the yocto-kernel-cache addition, yes +# the src_uri isn't used, but we may need to check it in the future +def kernel_cache_feature(src_uri,feature): + return "../recipe-sysroot-native/kcfg/" + feature + +def distro_cond_feature(feature_fragment,distro_feature,d): + import bb + feat = kernel_cache_feature("",feature_fragment) + return bb.utils.contains('DISTRO_FEATURES', distro_feature, feat, '', d) + +KERNEL_CACHE_FEATURES ?= "${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/virtio.scc')} \ + ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/xt-checksum.scc')} \ + ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/vswitch.scc')} \ + ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/lxc.scc')} \ + ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/docker.scc')} \ + ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/cgroup-hugetlb.scc')} \ + ${@kernel_cache_feature(d.getVar('SRC_URI'),'cfg/criu.scc')} \ + " KERNEL_FEATURES:append = " ${KERNEL_CACHE_FEATURES}" # if kernel-yocto has been inherited (how we can check for configuration @@ -38,8 +57,12 @@ KERNEL_FEATURES:append = " ${KERNEL_CACHE_FEATURES}" do_kernel_metadata[depends] += "${@['', 'yocto-cfg-fragments-native:do_populate_sysroot'][(bb.data.inherits_class('kernel-yocto', d))]}" # xen kernel support -SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" +# SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' file://xen.scc', '', d)}" +KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/xen.scc', 'xen', d )}" # k8s and k3s kernel support -SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'k8s', ' file://kubernetes.scc', '', d)}" -SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'k3s', ' file://kubernetes.scc', '', d)}" +# SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'k8s', ' file://kubernetes.scc', '', d)}" +# SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'k3s', ' file://kubernetes.scc', '', d)}" +KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k8s', d )}" +KERNEL_FEATURES:append = "${@distro_cond_feature('cfg/kubernetes.scc', 'k3s', d )}" + -- cgit v1.2.3-54-g00ecf