-
Notifications
You must be signed in to change notification settings - Fork 0
/
falter.sh
executable file
·119 lines (103 loc) · 2.95 KB
/
falter.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
114
115
116
117
118
119
#!/bin/sh
# This script implements the tutorial given at http://10.31.44.119:10178/compiling-falter-images-for-freifunk-berlin/
# (only accessible in Freifunk-Berlin-net) from kls0e in a somehow automatted way. Falter, live long and prosperous. ;-)
# get amount of cpu-threads +1
THREADS_TMP=$(lscpu | grep "CPU(s):" | head -n 1 | rev | cut -d' ' -f 1)
THREADS=$((THREADS_TMP + 1))
DIFFFILE=$2
VERSIONDEF="build_config/version"
BUILDDIR="falter-firmware"
VERSION="v0.0.7"
set -e
update_owrt() {
./scripts/feeds update -a
./scripts/feeds install -a
}
add_falter_feed() {
# check if already included
cp feeds.conf.default feeds.conf
if [ "$(grep 'src-git falter https://github.com/Freifunk-Spalter/packages.git' feeds.conf)" != 0 ]; then
echo "src-git falter https://github.com/Freifunk-Spalter/packages.git" >>feeds.conf
fi
}
init_buildsystem() {
git clone https://git.openwrt.org/openwrt/openwrt.git $BUILDDIR
cd $BUILDDIR
add_falter_feed
update_owrt
}
update_source() {
cd $BUILDDIR
git pull
update_owrt
}
branch_change() {
cd $BUILDDIR
echo "performing distclean on $BUILDDIR..."
make distclean
echo "switching branch to $1..."
git checkout "$1"
add_falter_feed
update_owrt
}
write_diffconfig() {
# read configuration from file
DIFFCONFIG=$(cat "$DIFFFILE")
VERSIONINFO=$(cat "$VERSIONDEF")
# write new diffconfig
cd $BUILDDIR
if [ -e diffconfig ]; then
rm diffconfig && touch diffconfig
fi
./scripts/diffconfig.sh > diffconfig
# write diff for freifunk-packages
for FLAG in $DIFFCONFIG; do
echo "$FLAG" >>diffconfig
done
# add version-info, to generate images named Freifunk-falter[...]
echo "$VERSIONINFO" >> diffconfig
cp diffconfig .config
#cat diffconfig >>.config
make defconfig
}
case $1 in
"-i" | "--init")
init_buildsystem
;;
"-s" | "--select")
cd $BUILDDIR
make menuconfig
;;
"-w" | "--write")
write_diffconfig
;;
"-m" | "--make")
cd $BUILDDIR
echo "start building falter with $THREADS threads..."
make -j$THREADS V=sc
;;
"-u" | "--update")
update_source
;;
"-b" | "--branch")
TAG=$2
branch_change "$TAG"
;;
*)
printf "Falter-build-script %s
To build falter-images, execute the options in this order.
-i | --init\tinitialise buildsystem
-s | --select\tselect the target, falter will be built for
-w | --write [FILE]\twrite the package-selection to buildsystem
-m | --make\tstart building
optional:
-u | --update\t\tupdates with new patches from falter-repo.
\t\t\tAfter using this option, you need to start
\t\t\tagain at option -s.
-b | --branch [BRANCH]\tif you want to build falter on a different
\t\t\tOpenWrt-branch than master, give the branch
\t\t\tor tag. After executing this option start
\t\t\tagain at -s.
EVER use only one option at the same time!\n" "$VERSION"
;;
esac