forked from includeos/IncludeOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·113 lines (83 loc) · 3.11 KB
/
install.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#! /bin/bash
. ./etc/set_traps.sh
export BUILD_DIR=$HOME/IncludeOS_build
export TEMP_INSTALL_DIR=$BUILD_DIR/IncludeOS_TEMP_install
export INSTALL_DIR=$HOME/IncludeOS_install
export PREFIX=$TEMP_INSTALL_DIR
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
export build_dir=$HOME/cross-dev
# Multitask-parameter to make
export num_jobs=-j$((`lscpu -p | tail -1 | cut -d',' -f1` + 1 ))
export newlib_version=2.2.0-1
export INCLUDEOS_SRC=`pwd`
export newlib_inc=$TEMP_INSTALL_DIR/i686-elf/include
export llvm_src=llvm
export llvm_build=build_llvm
export clang_version=3.6
export gcc_version=5.1.0
export binutils_version=2.25
# Options to skip steps
[ ! -v do_binutils ] && do_binutils=1
[ ! -v do_gcc ] && do_gcc=1
[ ! -v do_newlib ] && do_newlib=1
[ ! -v do_includeos ] && do_includeos=1
[ ! -v do_llvm ] && do_llvm=1
# TODO: These should be determined by inspecting if local llvm repo is up-to-date
[ ! -v install_llvm_dependencies ] && export install_llvm_dependencies=1
[ ! -v download_llvm ] && export download_llvm=1
# BUILDING IncludeOS
PREREQS_BUILD="build-essential make nasm texinfo clang-$clang_version clang++-$clang_version"
echo -e "\n\n >>> Trying to install prerequisites for *building* IncludeOS"
echo -e " Packages: $PREREQS_BUILD \n"
sudo apt-get install -y $PREREQS_BUILD
mkdir -p $BUILD_DIR
cd $BUILD_DIR
if [ ! -z $do_binutils ]; then
echo -e "\n\n >>> GETTING / BUILDING binutils (Required for libgcc / unwind / crt) \n"
$INCLUDEOS_SRC/etc/build_binutils.sh
fi
if [ ! -z $do_gcc ]; then
echo -e "\n\n >>> GETTING / BUILDING GCC COMPILER (Required for libgcc / unwind / crt) \n"
$INCLUDEOS_SRC/etc/cross_compiler.sh
fi
if [ ! -z $do_newlib ]; then
echo -e "\n\n >>> GETTING / BUILDING NEWLIB \n"
$INCLUDEOS_SRC/etc/build_newlib.sh
fi
if [ ! -z $do_llvm ]; then
echo -e "\n\n >>> GETTING / BUILDING llvm / libc++ \n"
$INCLUDEOS_SRC/etc/build_llvm32.sh
#echo -e "\n\n >>> INSTALLING libc++ \n"
#cp $BUILD_DIR/$llvm_build/lib/libc++.a $INSTALL_DIR/lib/
fi
echo -e "\n >>> DEPENDENCIES SUCCESSFULLY BUILT. Creating binary bundle \n"
$INCLUDEOS_SRC/etc/create_binary_bundle.sh
if [ ! -z $do_includeos ]; then
# Build and install the vmbuilder
echo -e "\n >>> Installing vmbuilder"
pushd $INCLUDEOS_SRC/vmbuild
make
cp vmbuild $INSTALL_DIR/
popd
echo -e "\n >>> Building IncludeOS"
pushd $INCLUDEOS_SRC/src
make $num_jobs
echo -e "\n >>> Linking IncludeOS test-service"
make test
echo -e "\n >>> Installing IncludeOS"
make install
popd
# RUNNING IncludeOS
PREREQS_RUN="bridge-utils qemu-kvm"
echo -e "\n\n >>> Trying to install prerequisites for *running* IncludeOS"
echo -e " Packages: $PREREQS_RUN \n"
sudo apt-get install -y $PREREQS_RUN
# Set up the IncludeOS network bridge
echo -e "\n\n >>> Create IncludeOS network bridge *Requires sudo* \n"
sudo $INCLUDEOS_SRC/etc/create_bridge.sh
# Copy qemu-ifup til install loc.
$INCLUDEOS_SRC/etc/copy_scripts.sh
fi
echo -e "\n >>> Done. Test the installation by running ./test.sh \n"
trap - EXIT