File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # This is a helper script for building init/init (a Linux ELF binary) in
4
+ # a lightweight VM using krunvm.
5
+
6
+ KRUNVM=` which krunvm`
7
+ if [ -z " $KRUNVM " ]; then
8
+ echo " Couldn't find krunvm binary"
9
+ exit -1
10
+ fi
11
+
12
+ SCRIPTPATH=` realpath $0 `
13
+ WORKDIR=` dirname $SCRIPTPATH `
14
+ krunvm create fedora --name libkrun-builder -v $WORKDIR :/work -w /work
15
+ if [ $? != 0 ]; then
16
+ echo " Error creating lightweight VM"
17
+ exit -1
18
+ fi
19
+
20
+ krunvm start libkrun-builder /usr/bin/dnf -- install -y glibc-static gcc make
21
+ if [ $? != 0 ]; then
22
+ krunvm delete libkrun-builder
23
+ echo " Error running command on VM"
24
+ exit -1
25
+ fi
26
+
27
+ krunvm start libkrun-builder /usr/bin/make -- init/init
28
+ if [ $? != 0 ]; then
29
+ krunvm delete libkrun-builder
30
+ echo " Error running command on VM"
31
+ exit -1
32
+ fi
33
+
34
+ krunvm delete libkrun-builder
35
+
36
+ if [ ! -e " init/init" ]; then
37
+ echo " There was a problem building init/init in the VM"
38
+ exit -1
39
+ fi
40
+
41
+ exit 0
You can’t perform that action at this time.
0 commit comments