forked from ghaerr/elks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·64 lines (47 loc) · 1.25 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
#!/bin/bash
# Full build (including the cross tool chain)
# Arguments:
# - 'auto' : continuous integration context
SCRIPTDIR="$(dirname "$0")"
clean_exit () {
E="$1"
test -z $1 && E=0
if [ $E -eq 0 ]
then echo "Build script has terminated successfully."
else echo "Build script has terminated with error $E"
fi
exit $E
}
# Environment setup
. "$SCRIPTDIR/env.sh"
[ $? -ne 0 ] && clean_exit 1
# Build cross tools if not already
if [ "$1" != "auto" ]; then
mkdir -p "$CROSSDIR"
tools/build.sh || clean_exit 1
fi
# Configure all
if [ "$1" = "auto" ]; then
echo "Invoking 'make defconfig'..."
make defconfig || clean_exit 2
else
echo
echo "Now invoking 'make menuconfig' for you to configure the system."
echo "The defaults should be OK for many systems, but you may want to review them."
echo -n "Press ENTER to continue..."
read
make menuconfig || clean_exit 2
fi
test -e .config || clean_exit 3
# Clean kernel, user land and image
if [ "$1" != "auto" ]; then
echo "Cleaning all..."
make clean || clean_exit 4
fi
# Build kernel, user land and image
# Forcing single threaded build because of dirty dependencies (see #273)
echo "Building all..."
make -j1 all || clean_exit 5
# Success
echo "Target image is in 'image' folder."
clean_exit 0