diff options
author | Mark Asselstine <mark.asselstine@windriver.com> | 2019-04-11 22:20:05 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2019-04-12 10:51:17 -0400 |
commit | 5b92dace1df5909623e011cb9117c931a2f171b2 (patch) | |
tree | b8deb83704676afc6469de44faf339434fef3e8b | |
parent | dfceafea9fa1291de4a9f3fb748e7be5b423d370 (diff) | |
download | meta-virtualization-5b92dace1df5909623e011cb9117c931a2f171b2.tar.gz |
cri-o: build crio-config natively to generate conmon/config.h
Part of building cri-o is the generation of the 'conmon/config.h'
file. The content of this file is dynamic in that it has buffer sizes
and a socket path which will depend on constants that are set in other
parts of the code. For example the socket path can be setup for
Windows or for Linux.
To generate 'conmon/config.h' a small GO application is built and run
called crio-config. This isn't really suitable for a -native package
but we do have to run crio-config on the build host so we don't want
to cross compile it. We therefor use the native GO to build this. This
change allows things to work when the build host arch and the target
arch don't match. A small update to the Makefile avoids mixing build
host arch and target arch GO packages.
Finally, We drop the crio-config binary from the install as it is only
used to create the conmon/config.h as part of the build. This is
consistent with the Makefile's install rule which does not install
this binary as it has no use on the target.
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r-- | recipes-containers/cri-o/cri-o_git.bb | 8 | ||||
-rw-r--r-- | recipes-containers/cri-o/files/Makefile-skip-install-when-generating-the-config.h.patch | 43 |
2 files changed, 50 insertions, 1 deletions
diff --git a/recipes-containers/cri-o/cri-o_git.bb b/recipes-containers/cri-o/cri-o_git.bb index cac55368..bc211f12 100644 --- a/recipes-containers/cri-o/cri-o_git.bb +++ b/recipes-containers/cri-o/cri-o_git.bb | |||
@@ -18,6 +18,7 @@ SRCREV_cri-o = "b986e6a8d2af34451363492479d2671a68fd20a3" | |||
18 | SRC_URI = "\ | 18 | SRC_URI = "\ |
19 | git://github.com/kubernetes-sigs/cri-o.git;branch=release-1.13;name=cri-o \ | 19 | git://github.com/kubernetes-sigs/cri-o.git;branch=release-1.13;name=cri-o \ |
20 | file://0001-Makefile-force-symlinks.patch \ | 20 | file://0001-Makefile-force-symlinks.patch \ |
21 | file://Makefile-skip-install-when-generating-the-config.h.patch \ | ||
21 | file://crio.conf \ | 22 | file://crio.conf \ |
22 | " | 23 | " |
23 | 24 | ||
@@ -74,6 +75,12 @@ do_compile() { | |||
74 | 75 | ||
75 | cd ${S}/src/import | 76 | cd ${S}/src/import |
76 | 77 | ||
78 | # Build conmon/config.h, requires native versions of | ||
79 | # cmd/crio-config/config.go and oci/oci.go | ||
80 | (CGO_ENABLED=0 GO=go GOARCH=${BUILD_GOARCH} GOOS=${BUILD_GOOS} oe_runmake conmon/config.h) | ||
81 | rm -f bin/crio-config | ||
82 | rm -rf vendor/pkg | ||
83 | |||
77 | oe_runmake binaries | 84 | oe_runmake binaries |
78 | } | 85 | } |
79 | 86 | ||
@@ -96,7 +103,6 @@ do_install() { | |||
96 | install -m 755 -D ${S}/src/import/test/testdata/* ${D}/${sysconfdir}/crio/config/ | 103 | install -m 755 -D ${S}/src/import/test/testdata/* ${D}/${sysconfdir}/crio/config/ |
97 | 104 | ||
98 | install ${S}/src/import/bin/crio ${D}/${localbindir} | 105 | install ${S}/src/import/bin/crio ${D}/${localbindir} |
99 | install ${S}/src/import/bin/crio-config ${D}/${localbindir} | ||
100 | 106 | ||
101 | install ${S}/src/import/bin/conmon ${D}/${localbindir}/crio | 107 | install ${S}/src/import/bin/conmon ${D}/${localbindir}/crio |
102 | install ${S}/src/import/bin/pause ${D}/${localbindir}/crio | 108 | install ${S}/src/import/bin/pause ${D}/${localbindir}/crio |
diff --git a/recipes-containers/cri-o/files/Makefile-skip-install-when-generating-the-config.h.patch b/recipes-containers/cri-o/files/Makefile-skip-install-when-generating-the-config.h.patch new file mode 100644 index 00000000..24c7e9d7 --- /dev/null +++ b/recipes-containers/cri-o/files/Makefile-skip-install-when-generating-the-config.h.patch | |||
@@ -0,0 +1,43 @@ | |||
1 | From 3822e834d2dbd87a4dc8cdd36e7fe3b0e9020c4f Mon Sep 17 00:00:00 2001 | ||
2 | From: Mark Asselstine <mark.asselstine@windriver.com> | ||
3 | Date: Tue, 9 Apr 2019 13:52:59 -0400 | ||
4 | Subject: [PATCH] Makefile: skip install when generating the config.h | ||
5 | |||
6 | When running 'go build' "The -i flag installs the packages that are | ||
7 | dependencies of the target." The Makefile makes use of this since many | ||
8 | of the dependencies needed to complete this rule will be used to by | ||
9 | other rules in the Makefile, thus speeding the overall build time | ||
10 | (avoiding redoing work). | ||
11 | |||
12 | In our case the crio-config tool and its dependencies are not being | ||
13 | cross-compiled as they have to run locally to produce the | ||
14 | conmon/config.h file and thus installing them is not useful. In this | ||
15 | case there are no savings and can actually result in errors during the | ||
16 | build or if the build ARCH and target ARCH are the same, a potential | ||
17 | for host contamination. | ||
18 | |||
19 | So we drop the use of '-i'. | ||
20 | |||
21 | Upstream-Status: Inappropriate [cross compile issue] | ||
22 | |||
23 | Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> | ||
24 | --- | ||
25 | Makefile | 2 +- | ||
26 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
27 | |||
28 | diff --git a/src/import/Makefile b/src/import/Makefile | ||
29 | index b9fa97f..8336a5b 100644 | ||
30 | --- a/src/import/Makefile | ||
31 | +++ b/src/import/Makefile | ||
32 | @@ -109,7 +109,7 @@ release-note: | ||
33 | @$(GOPATH)/bin/release-tool -n $(release) | ||
34 | |||
35 | conmon/config.h: cmd/crio-config/config.go oci/oci.go | ||
36 | - $(GO) build -i $(LDFLAGS) -o bin/crio-config $(PROJECT)/cmd/crio-config | ||
37 | + $(GO) build $(LDFLAGS) -o bin/crio-config $(PROJECT)/cmd/crio-config | ||
38 | ( cd conmon && $(CURDIR)/bin/crio-config ) | ||
39 | |||
40 | clean: | ||
41 | -- | ||
42 | 2.7.4 | ||
43 | |||