diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_fcopy_daemon.service b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_fcopy_daemon.service deleted file mode 100644 index c4d63d39ede..00000000000 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/files/hv_fcopy_daemon.service +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Hyper-V FCOPY daemon -ConditionPathExists=/dev/vmbus/hv_fcopy - -[Service] -ExecStart=/usr/bin/hv_fcopy_daemon --no-daemon - -[Install] -WantedBy=multi-user.target diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.12.62.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.12.62.ebuild deleted file mode 120000 index 95dcc24d68a..00000000000 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.12.62.ebuild +++ /dev/null @@ -1 +0,0 @@ -hv-daemons-9999.ebuild \ No newline at end of file diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.12.62.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.12.62.ebuild new file mode 100644 index 00000000000..be770a80814 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-6.12.62.ebuild @@ -0,0 +1,31 @@ +# Copyright 2025 The Flatcar Maintainers +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit coreos-kernel systemd + +DESCRIPTION="HyperV guest support daemons" +KEYWORDS="amd64 arm64" + +src_configure() { + : +} + +src_compile() { + emake \ + -C "${KV_DIR}/tools/hv" \ + ARCH="${CHOST%%-*}" \ + CROSS_COMPILE="${CHOST}-" \ + OUTPUT="${S}/" \ + V=1 +} + +src_install() { + local HV_DAEMON + for HV_DAEMON in hv_{kvp,vss}_daemon $(usex !arm64 hv_fcopy_uio_daemon ""); do + dobin "${HV_DAEMON}" + systemd_dounit "${FILESDIR}/${HV_DAEMON}.service" + systemd_enable_service "multi-user.target" "${HV_DAEMON}.service" + done +} diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-9999.ebuild deleted file mode 100644 index 5cca1461c78..00000000000 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/hv-daemons-9999.ebuild +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2044-2016 The Flatcar Maintainers -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit coreos-kernel savedconfig systemd - -DESCRIPTION="HyperV guest support daemons." -KEYWORDS="amd64 arm64" - -if [[ "${PV}" == 9999 ]]; then - KEYWORDS="~amd64 ~arm64" -fi - -src_compile() { - # Build hv_vss_daemon, hv_kvp_daemon, hv_fcopy_daemon - kmake tools/hv -} - -src_install() { - local -a HV_DAEMONS=(hv_vss_daemon hv_kvp_daemon hv_fcopy_daemon hv_fcopy_uio_daemon) - local HV_DAEMON - for HV_DAEMON in "${HV_DAEMONS[@]}" - do - if [ -f "${S}/build/tools/hv/${HV_DAEMON}" ]; then - dobin "${S}/build/tools/hv/${HV_DAEMON}" - systemd_dounit "${FILESDIR}/${HV_DAEMON}.service" - systemd_enable_service "multi-user.target" "${HV_DAEMON}.service" - fi - done -} diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/metadata.xml b/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/metadata.xml deleted file mode 100644 index 097975e3adc..00000000000 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/hv-daemons/metadata.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-kernel.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-kernel.eclass index cd895343330..a0e65535066 100644 --- a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-kernel.eclass +++ b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-kernel.eclass @@ -7,24 +7,6 @@ # Revision of the source ebuild, e.g. -r1. default is "" : ${COREOS_SOURCE_REVISION:=} -COREOS_SOURCE_VERSION="${PV}${COREOS_SOURCE_REVISION}" - -# $COREOS_KERNEL_SOURCE_NAME is the kernel source name to be used for -# $KERNEL_DIR, e.g. linux-4.19.0-coreos. This comes from upstream, so -# Flatcar should not change it. -# -# On the other hand, $COREOS_SOURCE_NAME is the kernel name to be used for -# $KV_OUT_DIR in individual coreos-kernel*.ebuild files. That one needs to -# have a flatcar-specific name. We cannot define another variable like -# $FLATCAR_SOURCE_NAME, because it will then be rewritten by upstream changes -# that set $COREOS_SOURCE_NAME by default. In the Gentoo world, the ebuild -# for each new version has a totally new file name. So it's hard to replace -# a new $COREOS_SOURCE_NAME variable for every new ebuild. -# $COREOS_SOURCE_NAME should be a name without a revision suffix (e.g. "-r1"), -# because $KV_FULL would not include such a suffix. -COREOS_KERNEL_SOURCE_NAME="linux-${PV/_rc/-rc}-coreos${COREOS_SOURCE_REVISION}" -COREOS_SOURCE_NAME="linux-${PV/_rc/-rc}-flatcar" - [[ ${EAPI} != [78] ]] && die "Only EAPI 7 and 8 are supported" inherit linux-info toolchain-funcs @@ -36,7 +18,7 @@ SRC_URI="" IUSE="" BDEPEND="dev-util/pahole" -DEPEND="=sys-kernel/coreos-sources-${COREOS_SOURCE_VERSION}" +DEPEND="=sys-kernel/coreos-sources-${PV}${COREOS_SOURCE_REVISION}" # Do not analyze or strip installed files RESTRICT="binchecks strip" @@ -44,10 +26,8 @@ RESTRICT="binchecks strip" # The build tools are OK and shouldn't trip up multilib-strict. QA_MULTILIB_PATHS="usr/lib/modules/.*/build/scripts/kconfig/.*" -# Use source installed by coreos-sources -# KERNEL_DIR must find the kernel source tree under /usr/src/linux-*-coreos, -# not /usr/src/linux-*-flatcar, which does not exist at all. -KERNEL_DIR="${SYSROOT}/usr/src/${COREOS_KERNEL_SOURCE_NAME}" +# Force linux-info to detect version-matched source installed by coreos-sources +KERNEL_DIR="${ESYSROOT}/usr/src/linux-${PV/_rc/-rc}-coreos${COREOS_SOURCE_REVISION}" # Search for an apropriate config in ${FILESDIR}. The config should reflect # the kernel version but partial matching is allowed if the config is @@ -117,7 +97,7 @@ kmake() { if gcc-specs-pie; then kernel_cflags="-nopie -fstack-check=no ${kernel_cflags}" fi - emake "--directory=${KERNEL_DIR}" \ + emake "--directory=${KV_DIR}" \ ARCH="${kernel_arch}" \ CROSS_COMPILE="${CHOST}-" \ KBUILD_OUTPUT="${S}/build" \ @@ -219,9 +199,9 @@ setup_keys() { coreos-kernel_pkg_pretend() { [[ "${MERGE_TYPE}" == binary ]] && return - if [[ -f "${KERNEL_DIR}/.config" || -d "${KERNEL_DIR}/include/config" ]] + if [[ -f "${KV_DIR}/.config" || -d "${KV_DIR}/include/config" ]] then - die "Source is not clean! Run make mrproper in ${KERNEL_DIR}" + die "Source is not clean! Run make mrproper in ${KV_DIR}" fi } @@ -229,7 +209,7 @@ coreos-kernel_pkg_setup() { [[ "${MERGE_TYPE}" == binary ]] && return # tc-arch-kernel requires a call to get_version from linux-info.eclass - get_version || die "Failed to detect kernel version in ${KERNEL_DIR}" + get_version || die "Failed to detect kernel version in ${KV_DIR}" } coreos-kernel_src_unpack() { diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.62.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.62.ebuild index 068df8adc78..8b9cea19187 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.62.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-kernel/coreos-kernel-6.12.62.ebuild @@ -56,14 +56,10 @@ DEPEND=" " src_prepare() { - # Fail early if we didn't detect the build installed by coreos-modules - [[ -n "${KV_OUT_DIR}" ]] || die "Failed to detect modules build tree" - default # KV_OUT_DIR points to the minimal build tree installed by coreos-modules # Pull in the config and public module signing key - KV_OUT_DIR="${ESYSROOT}/lib/modules/${COREOS_SOURCE_NAME#linux-}/build" cp -v "${KV_OUT_DIR}/.config" build/ || die validate_sig_key diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-modules/coreos-modules-6.12.62.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-modules/coreos-modules-6.12.62.ebuild index 983c2321d00..1e41fc6b5e0 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-modules/coreos-modules-6.12.62.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-modules/coreos-modules-6.12.62.ebuild @@ -51,7 +51,7 @@ src_install() { # Replace the broken /lib/modules/${KV_FULL}/build symlink with a copy of # the files needed to build out-of-tree modules. rm "${ED}/usr/${build}" || die - kmake run-command KBUILD_RUN_COMMAND="${KERNEL_DIR}/scripts/package/install-extmod-build ${ED}/usr/${build}" + kmake run-command KBUILD_RUN_COMMAND="${KV_DIR}/scripts/package/install-extmod-build ${ED}/usr/${build}" # Install the original config because the above doesn't. insinto "/usr/${build}" diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/coreos-sources-6.12.62.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/coreos-sources-6.12.62.ebuild index 80f25e45706..eb361930dcd 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/coreos-sources-6.12.62.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/coreos-sources-6.12.62.ebuild @@ -11,9 +11,14 @@ ETYPE="sources" K_BASE_VER="5.15" inherit kernel-2 -EXTRAVERSION="-flatcar" detect_version +# Replace the -coreos suffix with -flatcar. Don't simply reset the whole +# variable because it may have additional numbers before the suffix. This +# doesn't affect the sources directory, which is still suffixed with -coreos, +# but it does affect the Makefile that is used in the build. +EXTRAVERSION="${EXTRAVERSION/-coreos/-flatcar}" + DESCRIPTION="Full sources for the CoreOS Linux kernel" HOMEPAGE="http://www.kernel.org" if [[ "${PV%%_rc*}" != "${PV}" ]]; then @@ -35,13 +40,12 @@ IUSE="" # patchlevel revision. We mustn't apply our patches first, it fails when the # local patches overlap with the upstream patch. UNIPATCH_LIST=" - ${PATCH_DIR}/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch \ - ${PATCH_DIR}/z0002-pahole-support-reproducible-builds.patch \ - ${PATCH_DIR}/z0003-Revert-x86-boot-Remove-the-bugger-off-message.patch \ - ${PATCH_DIR}/z0004-efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch \ - ${PATCH_DIR}/z0005-efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch \ - ${PATCH_DIR}/z0006-mtd-disable-slram-and-phram-when-locked-down.patch \ - ${PATCH_DIR}/z0007-arm64-add-kernel-config-option-to-lock-down-when.patch \ - ${PATCH_DIR}/z0008-tools-hv-fix-cross-compilation-for-ARM64.patch \ - ${PATCH_DIR}/z0009-block-add-partition-uuid-into-uevent.patch \ + ${PATCH_DIR}/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch + ${PATCH_DIR}/z0002-pahole-support-reproducible-builds.patch + ${PATCH_DIR}/z0003-Revert-x86-boot-Remove-the-bugger-off-message.patch + ${PATCH_DIR}/z0004-efi-add-an-efi_secure_boot-flag-to-indicate-secure-b.patch + ${PATCH_DIR}/z0005-efi-lock-down-the-kernel-if-booted-in-secure-boot-mo.patch + ${PATCH_DIR}/z0006-mtd-disable-slram-and-phram-when-locked-down.patch + ${PATCH_DIR}/z0007-arm64-add-kernel-config-option-to-lock-down-when.patch + ${PATCH_DIR}/z0009-block-add-partition-uuid-into-uevent.patch " diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/6.12/z0008-tools-hv-fix-cross-compilation-for-ARM64.patch b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/6.12/z0008-tools-hv-fix-cross-compilation-for-ARM64.patch deleted file mode 100644 index b06e6564756..00000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/6.12/z0008-tools-hv-fix-cross-compilation-for-ARM64.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0890eb69da82aec12518a5c2998afea467a0e9d7 Mon Sep 17 00:00:00 2001 -From: Adrian Vladu -Date: Thu, 19 Sep 2024 07:59:59 +0000 -Subject: [PATCH] tools: hv: fix cross-compilation for ARM64 - ---- - tools/hv/Makefile | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/tools/hv/Makefile b/tools/hv/Makefile -index 2e60e2c212cd..d72554cedbf6 100644 ---- a/tools/hv/Makefile -+++ b/tools/hv/Makefile -@@ -2,7 +2,9 @@ - # Makefile for Hyper-V tools - include ../scripts/Makefile.include - -+ifeq ($(ARCH),) - ARCH := $(shell uname -m 2>/dev/null) -+endif - sbindir ?= /usr/sbin - libexecdir ?= /usr/libexec - sharedstatedir ?= /var/lib -@@ -20,7 +22,7 @@ override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include - override CFLAGS += -Wno-address-of-packed-member - - ALL_TARGETS := hv_kvp_daemon hv_vss_daemon --ifneq ($(ARCH), aarch64) -+ifeq ($(filter $(ARCH),aarch64 arm64),) - ALL_TARGETS += hv_fcopy_uio_daemon - endif - ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) --- -2.34.1 - diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/revbump.sh b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/revbump.sh index 8ac4d4552bd..df8b8d6efb1 100755 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/revbump.sh +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/revbump.sh @@ -2688,7 +2688,7 @@ mv "${srcdir}"/[0-9]*.patch . for f in [0-9]*.patch; do mv "$f" "z$f" done -ls z[0-9]*.patch | sed -e 's/^/\t${PATCH_DIR}\//g' -e 's/$/ \\/g' >> \ +ls z[0-9]*.patch | sed -e 's/^/\t${PATCH_DIR}\//g' >> \ "../../${new_ebuild}" popd >/dev/null