-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathdo-sqlite-aarch64
executable file
·98 lines (85 loc) · 2.66 KB
/
do-sqlite-aarch64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
# https://stackoverflow.com/a/246128/4804196
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SCRIPT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
source "$SCRIPT_DIR"/../include/base
app="$top"/apps/app-sqlite
source "$SCRIPT_DIR"/../include/common_functions
source "$SCRIPT_DIR"/../include/aarch64_vars
setup_app()
{
if ! test -d "$app"; then
git clone https://github.com/unikraft/app-sqlite "$app"
fi
pushd "$app" > /dev/null
git reset --hard HEAD
# Use updated kraft.yaml (including Musl dependency).
git remote add upb https://github.com/unikraft-upb/app-sqlite
git fetch upb
git checkout -b kraft.yaml-aarch64 upb/kraft.yaml-aarch64
git checkout staging
git rebase kraft.yaml-aarch64
popd > /dev/null
}
build()
{
if test ! -d "$app"; then
echo "$app folder doesn't exist. Did you run '$0 setup'?" 1>&2
exit 1
fi
pushd "$app" > /dev/null
export UK_WORKDIR=$(pwd)/../../
kraft configure -F -m arm64 -p kvm
kraft prepare
make CROSS_COMPILER=$AARCH64_GCC_BASE -j $(nproc)
popd > /dev/null
}
run_qemu()
{
if test ! -d "$app"; then
echo "$app folder doesn't exist. Did you run '$0 setup'?" 1>&2
exit 1
fi
pushd "$app" > /dev/null
sudo rm -fr fs0
mkdir fs0
pushd fs0 > /dev/null
tar xf ../minrootfs.tgz
popd > /dev/null
sudo $AARCH64_QEMU \
-kernel build/sqlite_kvm-arm64 \
-machine virt \
-cpu cortex-a57 \
-fsdev local,id=myid,path=$(pwd)/fs0,security_model=none \
-device virtio-9p-pci,fsdev=myid,mount_tag=fs0,disable-modern=on,disable-legacy=off \
-nographic
popd > /dev/null
}
run_debug()
{
if test ! -d "$app"; then
echo "$app folder doesn't exist. Did you run '$0 setup'?" 1>&2
exit 1
fi
pushd "$app" > /dev/null
sudo rm -fr fs0
mkdir fs0
pushd fs0 > /dev/null
tar xf ../minrootfs.tgz
popd > /dev/null
sudo $AARCH64_QEMU \
-kernel build/sqlite_kvm-arm64.dbg \
-machine virt \
-cpu cortex-a57 \
-fsdev local,id=myid,path=$(pwd)/fs0,security_model=none \
-device virtio-9p-pci,fsdev=myid,mount_tag=fs0,disable-modern=on,disable-legacy=off \
-nographic \
-gdb tcp::1234 -S
popd > /dev/null
}
source "$SCRIPT_DIR"/../include/common_command