diff options
Diffstat (limited to 'recipes-core/runx/runx_git.bb')
-rw-r--r-- | recipes-core/runx/runx_git.bb | 154 |
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 @@ | |||
1 | HOMEPAGE = "https://github.com/lf-edge/runx" | ||
2 | SUMMARY = "runx stuff" | ||
3 | DESCRIPTION = "Xen Runtime for OCI" | ||
4 | |||
5 | SRCREV_runx = "a6fe5ca3081f44e9085972d424c74707d4f0fc71" | ||
6 | SRC_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 | " | ||
12 | SRC_URI[md5sum] = "0d701ac1e2a67d47ce7127432df2c32b" | ||
13 | SRC_URI[sha256sum] = "5a26478906d5005f4f809402e981518d2b8844949199f60c4b6e1f986ca2a769" | ||
14 | |||
15 | LICENSE = "Apache-2.0" | ||
16 | LIC_FILES_CHKSUM = "file://LICENSE;md5=945fc9aa694796a6337395cc291ddd8c" | ||
17 | |||
18 | S = "${WORKDIR}/git" | ||
19 | PV = "0.1-git${SRCREV_runx}" | ||
20 | |||
21 | inherit distro_features_check | ||
22 | REQUIRED_DISTRO_FEATURES = "vmsep" | ||
23 | |||
24 | |||
25 | # TODO: for if we need a go shim | ||
26 | # GO_IMPORT = "import" | ||
27 | # inherit go | ||
28 | # inherit goarch | ||
29 | inherit pkgconfig | ||
30 | |||
31 | # for the kernel build | ||
32 | inherit 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 | ||
36 | DEPENDS = "busybox" | ||
37 | |||
38 | # for the kernel build phase | ||
39 | DEPENDS += "openssl-native coreutils-native util-linux-native xz-native bc-native" | ||
40 | DEPENDS += "qemu-native" | ||
41 | |||
42 | RDEPENDS_${PN} += " jq bash" | ||
43 | RDEPENDS_${PN} += " xen-xl" | ||
44 | |||
45 | do_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 | |||
89 | do_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 | |||
135 | do_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 | |||
149 | deltask compile_ptest_base | ||
150 | |||
151 | FILES_${PN} += "${bindir}/* ${datadir}/runX/*" | ||
152 | |||
153 | INHIBIT_PACKAGE_STRIP = "1" | ||
154 | INSANE_SKIP_${PN} += "ldflags already-stripped" | ||