-
Notifications
You must be signed in to change notification settings - Fork 128
/
compile
executable file
·73 lines (60 loc) · 1.68 KB
/
compile
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
#!/bin/bash
if [ "$BRSRCDIR" == "" ]; then
BRSRCDIR=../buildroot
fi
# Read secrets
if [ -f "secrets" ]; then
. secrets
else
echo "Secrets file not found, this isn't an official HiFiBerry build"
echo "some components might not work as expected"
fi
cd `dirname $0`
MYDIR=`pwd`
TS=`date +%Y%m%d`
echo $TS > buildroot/VERSION
if [ "$1" == "" ]; then
VERSION=`cat .piversion`
echo No version given, assuming Pi$VERSION
else
VERSION=$1
fi
KNOWNVERSION=`echo "2 3 4 0 02" | grep $VERSION`
if [ "$KNOWNVERSION" == "" ]; then
echo "Unsupported version $VERSION, aborting"
exit 1
fi
BRDIR=`./brdir $VERSION`
echo "Building in $BRDIR"
if [ -f $MYDIR/notify ]; then
$MYDIR/notify begin
fi
# Remove some packages
if [ "$2" != "" ]; then
echo Removing $BRDIR/build/$2* $BRDIR/build/host-$2*
rm -rf $BRDIR/build/$2* $BRDIR/build/host-$2* $BRDIR/per-package/$2*
fi
if [ "$3" != "" ]; then
echo Removing $BRDIR/build/$3* $BRDIR/build/host-$3*
rm -rf $BRDIR/build/$3* $BRDIR/build/host-$3* $BRDIR/per-package/$3*
fi
cd $BRSRCDIR
mkdir -p $BRDIR/target/etc
echo $VERSION > $BRDIR/target/etc/piversion
make O=$BRDIR BR2_EXTERNAL=../hifiberry-os/buildroot olddefconfig
# Check if parallel build are supported
PARALLEL=`cat $BRDIR/.config | grep "BR2_PER_PACKAGE_DIRECTORIES=y"`
if [ "$NOPARALLEL" != "" ]; then
PARALLEL=""
fi
if [ "$PARALLEL" == "" ]; then
echo "Using standard (non package-parallel) build system"
make O=$BRDIR BR2_EXTERNAL=../hifiberry-os/buildroot
else
JOBS=`cat /proc/cpuinfo | grep ^processor | wc -l`
echo "Using new package-parallel build with $JOBS parallel jobs"
make -j$JOBS O=$BRDIR BR2_EXTERNAL=../hifiberry-os/buildroot
fi
if [ -f $MYDIR/notify ]; then
$MYDIR/notify finish
fi