-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·89 lines (72 loc) · 1.98 KB
/
build.sh
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
#!/bin/bash
set -x
set -o errexit
# shellcheck source=prepare_env.sh
source prepare_env.sh
ENV_HOME="$(pwd)"
export ENV_HOME
clone_repo()
{
git clone https://github.com/OpenXiangShan/riscv-pk -b noop "$RISCV_PK_HOME"
git clone https://github.com/OpenXiangShan/riscv-linux -b nanshan "$RISCV_LINUX_HOME"
git clone https://github.com/OpenXiangShan/riscv-rootfs -b master "$RISCV_ROOTFS_HOME"
git clone https://github.com/OpenXiangShan/qemu.git -b checkpoint "$QEMU_HOME"
git clone https://github.com/OpenXiangShan/NEMU.git -b master "$NEMU_HOME"
cd nemu_rv64gc_checkpoint && git submodule update --init
git clone https://github.com/OpenXiangShan/NEMU.git -b gcpt_new_mem_layout nemu_rv64gcvh_checkpoint
cd nemu_rv64gcvh_checkpoint && git submodule update --init
}
export -f clone_repo
if [ -n "$CLONE" ]; then
clone_repo
fi
config_linux()
{
config=$1
cd "$RISCV_LINUX_HOME"
make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- "$config"
}
export -f config_linux
if [ -n "$CONFIG_LINUX" ]; then
config_linux "$CONFIG_LINUX"
fi
if [ -n "$BUILD_BBL" ]; then
cd "$RISCV_PK_HOME"
make clean && mkdir build && make -j
fi
if [ -n "$CLEAN_REPO" ]; then
rm -irf "$RISCV_PK_HOME"
rm -irf "$RISCV_LINUX_HOME"
rm -irf "$RISCV_ROOTFS_HOME"
rm -irf "$QEMU_HOME"
fi
build_bbl ()
{
elf_dir=$1
spec_apps=$2
if [ -f "$spec_apps" ]; then
python3 generate_checkpoint.py --elfs "$elf_dir" --spec-app-list "$spec_apps" --CPU2017
else
python3 generate_checkpoint.py --elfs "$elf_dir" --spec-apps "$spec_apps" --CPU2017
fi
}
export -f build_bbl
if [ -n "$SPEC_APPS" ]; then
build_bbl "$ELF_FOLDER" "$SPEC_APPS"
fi
build_NEMU ()
{
cd "$NEMU_HOME"
make riscv64-xs-cpt_defconfig
make -j
git submodule update --init
cd "$NEMU_HOME/resource/gcpt_restore" && make -j
cd "$NEMU_HOME/resource/simpoint/simpoint_repo" && make -j
}
export -f build_NEMU
if [ -n "$INIT_NEMU" ]; then
build_NEMU
fi
if [ -n "$LINK_PAYLOAD" ]; then
build_GCPT_PAYLOAD "$LINK_PAYLOAD"
fi