blob: eff75211d2c672434778470c00f4bb6dfbecb45d (
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
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
120
121
122
123
124
125
|
#!/bin/bash
set -e
source "${BUILD_SCRIPT_ROOT}"/helpers
setup-repo-vars
#Translate
# https://android-build.linaro.org/jenkins/job/doanac_build-script-generation/6/
# into
# http://snapshots.linaro.org/android/~doanac/build-script-generation/6/
SNAPSHOT_URL=${BUILD_URL/http*jenkins\/job\//http://snapshots.linaro.org/android/~}
# change the dash in doanac_build... to doanac/build...
SNAPSHOT_URL=${SNAPSHOT_URL/_/\/}
CLICKTHROUGH=0
[ ${TARGET_PRODUCT} == 'snowball' ] && CLICKTHROUGH=1
[ ${TARGET_PRODUCT} == 'origen' ] && CLICKTHROUGH=1
OPTS="d:ht"
[ $CLICKTHROUGH ] && OPTS="c:d:ht"
[ $CLICKTHROUGH ] && CLICKTHROUGH_OPT="-c .config"
[ $CLICKTHROUGH ] && CLICKTHROUGH_OPT_CASE="c ) CFG=\$OPTARG;;"
[ $CLICKTHROUGH ] && CLICKTHROUGH_MSG="\" -c .config file The kernel config file from the build. Download from:\n ${SNAPSHOT_URL}/kernel_config\n from a browser with cookies enabled.\""
header()
{
cat <<EOF
#!/bin/bash
set -e
EXACT=1
DIR=linaro-kernel
CPUS=\`grep -c processor /proc/cpuinfo\`
usage()
{
echo 'Usage: \$0 ${CLICKTHROUGH_OPT}[ -t -d directory ]'
echo -e ${CLICKTHROUGH_MSG}
echo " -t Reproduce the from the tip of the branch rather than doing"
echo " an exact replica build"
echo " -d <directory> The directory to download code and build from"
echo " Default: \${DIR}"
exit 1
}
while getopts "${OPTS}" optn; do
case \$optn in
d ) DIR=\$OPTARG;;
t ) EXACT=0;;
${CLICKTHROUGH_OPT_CASE}
h ) usage; exit 1;;
esac
done
EOF
if [ $CLICKTHROUGH -eq 1 ] ; then
echo "[ \$CFG ] || usage"
echo
fi
}
sync_commands()
{
KERNELNAME=`python -c "import os.path; print os.path.relpath(os.path.realpath('target/product/$TARGET_OUT_DIR/obj/kernel/source'), '../')"`
GITINFO=`PYTHONPATH=../.repo/repo ${BUILD_SCRIPT_ROOT}/repo_project_info.py -d ../ -p ${KERNELNAME}`
#echo "# $GITINFO"
GITURL=`echo $GITINFO | cut -d\| -f1`
GITREV=`echo $GITINFO | cut -d\| -f2`
cat <<EOF
# download the kernel
if [ -d \${DIR} ] ; then
echo "Directory \${DIR} exists. If the kernel code exists in this directory you may continue without cloning the git repository for the kernel. Are you sure you want to do this? (y/n) "
read CONTINUE
[ \${CONTINUE} == y ] || exit 1
else
git clone $GITURL \$DIR
fi
cd \$DIR
git checkout $GITREV
EOF
if [ $CLICKTHROUGH -eq 0 ] ; then
echo "# download the kernel config"
echo "curl -q $SNAPSHOT_URL/kernel_config> linaro_kernel_config"
echo
fi
}
build_commands()
{
if [ $CLICKTHROUGH -eq 1 ] ; then
CP_CMD="cp \$CFG out/.config"
else
CP_CMD="cp linaro_kernel_config out/.config"
fi
cat <<EOF
# build the code
CROSS_COMPILE=\`which arm-linux-gnueabi-gcc |sed -e 's,gcc,,'\`
[ -d out ] || mkdir out
[ -f out/.config ] || $CP_CMD
if [[ \`grep 'CONFIG_ARCH_MULTIPLATFORM=y' out/.config\` ]]; then
KERNEL_IMAGE=zImage
else
KERNEL_IMAGE=uImage
fi
make -j\${CPUS} O=out ARCH=arm CROSS_COMPILE=\$CROSS_COMPILE \$KERNEL_IMAGE modules
if [[ \`grep 'CONFIG_ARCH_VEXPRESS=y' out/.config\` ]]; then
mkimage -A arm -O linux -T kernel -n "Android Kernel" -C none -a 0x60008000 -e 0x60008000 -d out/arch/arm/boot/zImage out/arch/arm/boot/uImage
fi
mkdir out/modules_for_android
make O=out ARCH=arm modules_install INSTALL_MOD_PATH=modules_for_android
EOF
}
{
header
sync_commands
build_commands
} > linaro_kernel_build_cmds.sh
chmod +x linaro_kernel_build_cmds.sh
|