diff --git a/meta-stx-virt/recipes-containers/containerd/containerd-opencontainers_git.bbappend b/meta-stx-virt/recipes-containers/containerd/containerd-opencontainers_git.bbappend new file mode 100644 index 0000000..d8e2ed5 --- /dev/null +++ b/meta-stx-virt/recipes-containers/containerd/containerd-opencontainers_git.bbappend @@ -0,0 +1,100 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +inherit stx-metadata + +STX_REPO = "integ" +STX_SUBPATH = "kubernetes/containerd/centos/files" + +STX_EXTRA_REPO = "config-files" +STX_EXTRA_SUBPATH = "containerd-config/files" +STX_METADATA_EXTRA_PATH = "${TMPDIR}/work-shared/stx-${STX_EXTRA_REPO}-source/git/${STX_EXTRA_SUBPATH}" +FILESEXTRAPATHS_prepend = "${STX_METADATA_EXTRA_PATH}:" + +do_patch[depends] += "stx-${STX_EXTRA_REPO}-source:do_patch" + +SRCREV = "d76c121f76a5fc8a462dc64594aea72fe18e1178" +SRC_URI = "\ + git://github.com/containerd/containerd;branch=release/1.3 \ + file://0001-build-use-oe-provided-GO-and-flags.patch;patchdir=src/${GO_IMPORT} \ + file://containerd.service \ + " + +SRC_URI_STX = "\ + file://0001-customize-containerd-for-StarlingX.patch;patchdir=src/${GO_IMPORT};striplevel=2 \ + file://0002-archive-skip-chmod-IsNotExist-error.patch;patchdir=src/${GO_IMPORT};striplevel=2 \ + " + +CONTAINERD_VERSION = "v1.3.3" + +VENDOR_SRCDIR = "${S}/src/${GO_IMPORT}/vendor/src" +CONTAINERD_DIR = "${VENDOR_SRCDIR}/github.com/containerd/containerd" + +CONTAINERD_SUBDIR = "\ + api archive cio cmd containers content defaults diff errdefs events filters \ + gc identifiers images labels leases log metadata metrics mount namespaces \ + oci platforms plugin protobuf reference remotes rootfs runtime services \ + snapshots sys version \ + " +CONTAINERD_PKG_SUBDIR = "dialer oom process progress seed stdio testutil timeout ttrpcutil" +CONTAINERD_CONTRIB_SUBDIR = "apparmor aws nvidia seccomp snapshotservice" + +do_compile() { + export GOARCH="${TARGET_GOARCH}" + + # link fixups for compilation + rm -f ${VENDOR_SRCDIR} + ln -sf ./ ${VENDOR_SRCDIR} + + mkdir -p ${CONTAINERD_DIR}/ + mkdir -p ${CONTAINERD_DIR}/pkg/ + mkdir -p ${CONTAINERD_DIR}/contrib/ + + # without this, the stress test parts of the build fail + cp ${S}/src/${GO_IMPORT}/*.go ${CONTAINERD_DIR} + + for c in ${CONTAINERD_SUBDIR}; do + if [ -d ${S}/src/${GO_IMPORT}/${c} ]; then + ln -sfn ${S}/src/${GO_IMPORT}/${c} ${CONTAINERD_DIR}/${c} + fi + done + for c in ${CONTAINERD_PKG_SUBDIR}; do + if [ -d ${S}/src/${GO_IMPORT}/pkg/${c} ]; then + ln -sfn ${S}/src/${GO_IMPORT}/pkg/${c} ${CONTAINERD_DIR}/pkg/${c} + fi + done + for c in ${CONTAINERD_CONTRIB_SUBDIR}; do + if [ -d ${S}/src/${GO_IMPORT}/contrib/${c} ]; then + ln -sfn ${S}/src/${GO_IMPORT}/contrib/${c} ${CONTAINERD_DIR}/contrib/${c} + fi + done + + export GOPATH="${S}/src/${GO_IMPORT}/.gopath:${S}/src/${GO_IMPORT}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" + export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" + + # Pass the needed cflags/ldflags so that cgo + # can find the needed headers files and libraries + export CGO_ENABLED="1" + export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export BUILDTAGS="no_btrfs static_build netgo" + export CFLAGS="${CFLAGS}" + export LDFLAGS="${LDFLAGS}" + + cd ${S}/src/${GO_IMPORT} + oe_runmake binaries +} + +do_install_append() { + install -p -m 755 ${S}/src/${GO_IMPORT}/bin/containerd-shim-runc-v1 ${D}/${bindir} + install -p -m 755 ${S}/src/${GO_IMPORT}/bin/containerd-shim-runc-v2 ${D}/${bindir} + install -p -m 755 ${S}/src/${GO_IMPORT}/bin/containerd-stress ${D}/${bindir} + install -p -m 755 ${S}/src/${GO_IMPORT}/bin/ctr ${D}/${bindir} + + # from containerd-config.spec in stx config-files repo + install -d -m 755 ${D}/${sysconfdir}/pmon.d/ + install -p -m 644 ${STX_METADATA_EXTRA_PATH}/containerd-pmon.conf ${D}/${sysconfdir}/pmon.d/containerd.conf + install -d -m 755 ${D}/${sysconfdir}/systemd/system/containerd.service.d/ + install -p -m 644 ${STX_METADATA_EXTRA_PATH}/containerd-stx-override.conf ${D}/${sysconfdir}/systemd/system/containerd.service.d/ +} + +RDEPENDS_${PN} += "cri-tools" diff --git a/meta-stx-virt/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch b/meta-stx-virt/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch new file mode 100644 index 0000000..e703075 --- /dev/null +++ b/meta-stx-virt/recipes-containers/containerd/files/0001-build-use-oe-provided-GO-and-flags.patch @@ -0,0 +1,49 @@ +From a0a8d223df20b473e7e25d32bdeda2e031bcfaed Mon Sep 17 00:00:00 2001 +From: Jackie Huang +Date: Thu, 1 Jul 2021 19:20:20 +0800 +Subject: [PATCH] build: use oe provided GO and flags + +We want to use the go compiler as defined in the oe-enviroment, not the +generic call to 'go'. Without changing this, we'll get things like cgo +errors and invalid flag combos. + +Signed-off-by: Bruce Ashfield + +Rebased for v1.3.3 + +Signed-off-by: Jackie Huang +--- + Makefile | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Makefile b/Makefile +index 37012e8..0af2543 100644 +--- a/Makefile ++++ b/Makefile +@@ -185,19 +185,19 @@ FORCE: + # Build a binary from a cmd. + bin/%: cmd/% FORCE + @echo "$(WHALE) $@${BINARY_SUFFIX}" +- @go build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@${BINARY_SUFFIX} ${GO_LDFLAGS} ${GO_TAGS} ./$< ++ @$(GO) build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@${BINARY_SUFFIX} ${GO_LDFLAGS} ${GO_TAGS} ./$< + + bin/containerd-shim: cmd/containerd-shim FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220 + @echo "$(WHALE) bin/containerd-shim" +- @CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim ++ @$(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim + + bin/containerd-shim-runc-v1: cmd/containerd-shim-runc-v1 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220 + @echo "$(WHALE) bin/containerd-shim-runc-v1" +- @CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1 ++ @$(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1 + + bin/containerd-shim-runc-v2: cmd/containerd-shim-runc-v2 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220 + @echo "$(WHALE) bin/containerd-shim-runc-v2" +- @CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2 ++ @$(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2 + + binaries: $(BINARIES) ## build binaries + @echo "$(WHALE) $@" +-- +2.7.4 +