summaryrefslogtreecommitdiff
path: root/build-rpi3.sh
blob: f68baac6712bf7fce2710d63ffe989eff533623e (plain)
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
#!/bin/bash

NCPUS=`cat /proc/cpuinfo | grep processor | wc -l`
NCPUS=$(($NCPUS * 2))

if [ $# != 1 ]; then
	echo "Usage : $0 <architecture>"
	echo "	architecture : arm or arm64"
	echo "	e.g) $0 arm"
	exit
fi

# Check this system has ccache
check_ccache()
{
	type ccache
	if [ "$?" -eq "0" ]; then
		CCACHE=ccache
	fi
}

check_ccache

if [ $1 = "arm" ]; then
	echo "ARM"

	rm -f arch/arm/boot/zImage
	rm -f arch/arm/boot/dts/*.dtb

	CROSS_COMPILER=arm-linux-gnueabi-

	if ! [ -e .config ] ; then
		make ARCH=arm CROSS_COMPILE="${CCACHE} ${CROSS_COMPILER}" tizen_bcm2709_defconfig
	fi

	make ARCH=arm CROSS_COMPILE="${CCACHE} ${CROSS_COMPILER}" -j $NCPUS

	if [ ! -f "./arch/arm/boot/zImage" ]; then
		echo "Build fail"
		exit 1
	fi
elif [ $1 = "arm64" ]; then
	echo "ARM64"

	rm -f arch/arm64/boot/Image
	rm -f arch/arm64/boot/dts/broadcom/*.dtb

	CROSS_COMPILER=aarch64-linux-gnu-

	if ! [ -e .config ] ; then
		make ARCH=arm64 CROSS_COMPILE="${CCACHE} ${CROSS_COMPILER}" tizen_bcmrpi3_defconfig
	fi

	make ARCH=arm64 CROSS_COMPILE="${CCACHE} ${CROSS_COMPILER}" -j $NCPUS

	if [ ! -f "./arch/arm64/boot/Image" ]; then
		echo "Build fail"
		exit 1
	fi
fi