-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen-configs.sh
executable file
·61 lines (52 loc) · 1.13 KB
/
gen-configs.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
#!/bin/sh
dir=configs_generated
configs=""
i=1
print_usage() {
echo "Generate .config files for defconfig files"
echo
echo "Usage: $0 {all | head | configs list ...}"
echo
echo "Parameters:"
echo " all - For all defconfigs from configs/"
echo " head - For changed configs/ files in last commit"
echo " configs list - For manually specified list of config files "
echo " from configs/ directory"
echo
echo "Generated files will be located in ${dir}/ directory"
}
if [ $# -eq 0 ]; then
echo "Error: Invalid arguments count" >&2
print_usage
exit 1
fi
# Check "all" and "head" params
if [ $# -eq 1 ]; then
if [ $1 = "all" ]; then
configs=$(ls -1 configs/)
shift
elif [ $1 = "head" ]; then
configs=$(git show --stat | grep '^ configs/')
shift
fi
fi
# Check for manually provided configs list
if [ -n "$1" ]; then
configs=""
while [ -n "$1" ]; do
configs="$configs $1"
shift
done
fi
rm -rf $dir
mkdir $dir
count=$(echo $configs | wc -w)
# Generate configs
make distclean
for c in $configs; do
echo "---> Generating $c... ($i / $count)"
make $c
mv .config $dir/$c
make distclean
i=$((i+1))
done