summaryrefslogtreecommitdiffstats
path: root/recipes-core/runx/runx_git.bb
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@xilinx.com>2019-12-17 17:25:31 -0800
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-03-11 12:20:04 -0400
commit4ff05c1bc7313743b572b116b37c893b69c68971 (patch)
treeec51e913ecae1cf18d512ca8deaca261b371b7be /recipes-core/runx/runx_git.bb
parent7a8ee8e986ea180f3a4d94d4d83d01c786488d96 (diff)
downloadmeta-virtualization-4ff05c1bc7313743b572b116b37c893b69c68971.tar.gz
runx: introduce xen OCI container recipe
This is the initial version of the runX OCI wrapper to allow Xen based virtual machines to be launched and managed as containers via an OCI interface. In this first version, runx consists of the following components: - runX binary/wrapper (/usr/bin/) - state control wrappers (/usr/share/runX) - runx kernel - initrd Once built and installed these allow the launching of Xen virtual machines in an OCI compliant manner. Dependencies of this recipe include: - kernel: must be a specific version, currently 4.15. This is done as a nested build and not as a multiconfig (by design). - static target busybox: used for the initrd - initrd: constructed from the kernel + busybox The configuration of the system to build the dependencies in the right mode for use in runX is controlled via the DISTRO_FEATURE "vmsep". If this feature is missing, and runx is bitbaked, an error is thrown. Installing the "runx" package to a rootfs will install all the required support components (and dependencies). Signed-off-by: Bruce Ashfield <bruce.ashfield@xilinx.com>
Diffstat (limited to 'recipes-core/runx/runx_git.bb')
-rw-r--r--recipes-core/runx/runx_git.bb154
1 files changed, 154 insertions, 0 deletions
diff --git a/recipes-core/runx/runx_git.bb b/recipes-core/runx/runx_git.bb
new file mode 100644
index 00000000..36fede67
--- /dev/null
+++ b/recipes-core/runx/runx_git.bb
@@ -0,0 +1,154 @@
1HOMEPAGE = "https://github.com/lf-edge/runx"
2SUMMARY = "runx stuff"
3DESCRIPTION = "Xen Runtime for OCI"
4
5SRCREV_runx = "a6fe5ca3081f44e9085972d424c74707d4f0fc71"
6SRC_URI = "\
7 git://github.com/lf-edge/runx;nobranch=1;name=runx \
8 https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.15.tar.xz;destsuffix=git/kernel/build \
9 file://0001-make-kernel-cross-compilation-tweaks.patch \
10 file://0001-make-initrd-cross-install-tweaks.patch \
11 "
12SRC_URI[md5sum] = "0d701ac1e2a67d47ce7127432df2c32b"
13SRC_URI[sha256sum] = "5a26478906d5005f4f809402e981518d2b8844949199f60c4b6e1f986ca2a769"
14
15LICENSE = "Apache-2.0"
16LIC_FILES_CHKSUM = "file://LICENSE;md5=945fc9aa694796a6337395cc291ddd8c"
17
18S = "${WORKDIR}/git"
19PV = "0.1-git${SRCREV_runx}"
20
21inherit distro_features_check
22REQUIRED_DISTRO_FEATURES = "vmsep"
23
24
25# TODO: for if we need a go shim
26# GO_IMPORT = "import"
27# inherit go
28# inherit goarch
29inherit pkgconfig
30
31# for the kernel build
32inherit kernel-arch
33
34# we have a busybox bbappend that makes /bin available to the
35# sysroot, and hence gets us the target binary that we need
36DEPENDS = "busybox"
37
38# for the kernel build phase
39DEPENDS += "openssl-native coreutils-native util-linux-native xz-native bc-native"
40DEPENDS += "qemu-native"
41
42RDEPENDS_${PN} += " jq bash"
43RDEPENDS_${PN} += " xen-xl"
44
45do_compile() {
46 # we'll need this for the initrd later, so lets error if it isn't what
47 # we expect (statically linked)
48 file ${STAGING_DIR_HOST}/bin/busybox.nosuid
49
50 # prep steps to short circuit some of make-kernel's fetching and
51 # building.
52 mkdir -p ${S}/kernel/build
53 mkdir -p ${S}/kernel/src
54 cp ${DL_DIR}/linux-4.15.tar.xz ${S}/kernel/build/
55
56 # In the future, we might want to link the extracted kernel source (if
57 # we move patches to recipe space, but for now, we need make-kernel to
58 # extract a copy and possibly patch it.
59 # ln -sf ${WORKDIR}/linux-4.15 ${S}/kernel/src/
60
61 # build the kernel
62 echo "[INFO]: runx: building the kernel"
63
64 export KERNEL_CC="${KERNEL_CC}"
65 export KERNEL_LD="${KERNEL_LD}"
66 export ARCH="${ARCH}"
67 export HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
68 export HOSTCPP="${BUILD_CPP}"
69 export CROSS_COMPILE="${CROSS_COMPILE}"
70 export build_vars="HOSTCC='$HOSTCC' STRIP='$STRIP' OBJCOPY='$OBJCOPY' ARCH=$ARCH CC='$KERNEL_CC' LD='$KERNEL_LD'"
71
72 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
73
74 # We want make-kernel, to have the following build lines:
75 # make O=$kernel_builddir HOSTCC="${HOSTCC}" ARCH=$ARCH oldconfig
76 # make -j4 O=$kernel_builddir HOSTCC="${HOSTCC}" STRIP="$STRIP" OBJCOPY="$OBJCOPY" ARCH=$ARCH CC="$KERNEL_CC" LD="$KERNEL_LD" $image
77 ${S}/kernel/make-kernel
78
79 # construct the initrd
80 echo "[INFO]: runx: constructing the initrd"
81
82 cp ${STAGING_DIR_HOST}/bin/busybox.nosuid ${WORKDIR}/busybox
83 export QEMU_USER=`which qemu-${HOST_ARCH}`
84 export BUSYBOX="${WORKDIR}/busybox"
85 export CROSS_COMPILE="t"
86 ${S}/kernel/make-initrd
87}
88
89do_build_go_shim() {
90
91 # placeholder for any go shim code we may need, i.e. console
92
93 # export GOARCH="${TARGET_GOARCH}"
94 # export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
95 # export GOPATH="${S}/src/import:${S}/src/import/vendor"
96
97 # # Pass the needed cflags/ldflags so that cgo
98 # # can find the needed headers files and libraries
99 # export CGO_ENABLED="1"
100 # export CFLAGS=""
101 # export LDFLAGS=""
102 # export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
103 # export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
104
105 # # link fixups for compilation
106 # rm -f ${S}/src/import/vendor/src
107 # ln -sf ./ ${S}/src/import/vendor/src
108
109 # mkdir -p ${S}/src/import/vendor/github.com/hyperhq/runv
110
111 # ln -sf src/import/cli
112 # ln -sf ../../../../api ${S}/src/import/vendor/github.com/hyperhq/runv/api
113 # ln -sf ../../../../cli ${S}/src/import/vendor/github.com/hyperhq/runv/cli
114 # ln -sf ../../../../lib ${S}/src/import/vendor/github.com/hyperhq/runv/lib
115 # ln -sf ../../../../driverloader ${S}/src/import/vendor/github.com/hyperhq/runv/driverloader
116 # ln -sf ../../../../factory ${S}/src/import/vendor/github.com/hyperhq/runv/factory
117 # ln -sf ../../../../hyperstart ${S}/src/import/vendor/github.com/hyperhq/runv/hyperstart
118 # ln -sf ../../../../hypervisor ${S}/src/import/vendor/github.com/hyperhq/runv/hypervisor
119 # ln -sf ../../../../template ${S}/src/import/vendor/github.com/hyperhq/runv/template
120
121 # export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
122 # export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
123
124 # # Pass the needed cflags/ldflags so that cgo
125 # # can find the needed headers files and libraries
126 # export CGO_ENABLED="1"
127 # export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
128 # export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
129
130 # oe_runmake build-shim
131
132 true
133}
134
135do_install() {
136 install -d ${D}${bindir}
137 install -m 755 ${S}/runX ${D}${bindir}
138
139 install -d ${D}${datadir}/runX
140 install -m 755 ${S}/kernel/out/kernel ${D}/${datadir}/runX
141 install -m 755 ${S}/kernel/out/initrd ${D}/${datadir}/runX
142 install -m 755 ${S}/files/start ${D}/${datadir}/runX
143 install -m 755 ${S}/files/state ${D}/${datadir}/runX
144 install -m 755 ${S}/files/delete ${D}/${datadir}/runX
145
146
147}
148
149deltask compile_ptest_base
150
151FILES_${PN} += "${bindir}/* ${datadir}/runX/*"
152
153INHIBIT_PACKAGE_STRIP = "1"
154INSANE_SKIP_${PN} += "ldflags already-stripped"