summaryrefslogtreecommitdiff
path: root/jenkins_kernel_build_inst
blob: a8afff0fb102d267f7708759f029ac787225bec2 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#! /bin/bash
# Example env variables and its values
# kernel_config='omap2plus_defconfig'
# export board_types='panda'
# kernel_flavour='omap4'
# rootfs_type='nano'
#
# The following three variables:
# conf_git
# conf_branch
# conf_external
#
# are used to retrieve kernel config fragments from an external source tree
# in git.linaro.org.
# The URL where the files are taken is built in this way:
# http://git.linaro.org/gitweb?p=$conf_git;a=blob_plain;f=linaro/configs/$conf;hb=$conf_branch
# conf_git: is the git tree where to look into, like landing-teams/working/arm/kernel.git
# conf_branch: is the branch to use, like HEAD
# conf_external: is a comma separated list of kernel config file names to retrieve, it is
# possible to list also only one file name
#
# An example of usage of these variables:
# conf_git='landing-teams/working/arm/kernel.git'
# conf_branch='HEAD'
# conf_fragment='android.conf,imx5.conf'

set -xe

export ARCH=${ARCH:-arm}
export default_path="/usr/sbin:/usr/bin:/sbin:/bin"
export tcbindir=${tcbindir:-"$HOME/$ARCH-tc/bin"}
toolchain_url=${toolchain_url:-}

install_custom_toolchain()
{
  test -d ${tcbindir} && return 0
  test -z "${toolchain_url}" && return 0
  toolchain=`basename ${toolchain_url}`
  test -f ${toolchain} || curl -sLSO ${toolchain_url}
  mkdir -p `dirname ${tcbindir}`
  tar --strip-components=1 -C `dirname ${tcbindir}` -xf ${toolchain}
}

if [ "${ARCH}" = "arm" ]; then
  compiler_prefix="arm-linux-gnueabihf-"
elif [ "$ARCH" = "arm64" ]; then
  compiler_prefix="aarch64-linux-gnu-"
fi

if test -z "$kernel_flavour"; then
  kernel_flavour='flavour'
fi

if test -z "$rootfs_type"; then
  rootfs_type='nano-lava'
fi

if test -z "$git_web_url"; then
  git_web_url="unknown"
fi

if test -z "$hwpack_type"; then
  submit_job=0
fi

if test -z "$submit_job"; then
  submit_job=1
fi

if test -z "$lava_test_plan"; then
  lava_test_plan="ltp, pwrmgmt"
fi

if test -z "$git_reset"; then
  git_reset=false
fi

if test -z "$make_deb"; then
  make_deb=true
fi

if test -z "$make_bootwrapper"; then
  make_bootwrapper=true
fi

if test -z "$make_install"; then
  make_install=false
fi

if test -z "$make_silent"; then
  make_silent=false
fi

if test -z "$make_perf"; then
  make_perf=false
fi

install_custom_toolchain

if [ "${use_ccache}" = "true" ]; then
  export CCACHE_DIR="${CCACHE_DIR:-$PWD/ccache}"
  export PATH="/usr/lib/ccache:$tcbindir:$default_path"
  export CROSS_COMPILE="ccache ${compiler_prefix}"
else
  export PATH="$tcbindir:$default_path"
  export CROSS_COMPILE="${compiler_prefix}"
fi

export make_silent
export make_deb
export make_perf
export make_bootwrapper
export make_install
export conf_git
export conf_branch
export conf_external
export kernel_config
export hwpack_type
export board_types
export kernel_flavour
export rootfs_type
export git_web_url
export submit_job
export lava_test_plan
export conf_filenames
export gcc_version=`sh $PWD/scripts/gcc-version.sh -p ${compiler_prefix}gcc`
export bundle_stream_name=`echo $JOB_NAME | sed -e 's/_.*//' -e 's/\./_/g'`

if $git_reset = "true" ; then
   git reset --hard
fi

export kernel_version=`make kernelversion`
export kernel_release=${kernel_version}-linaro-${kernel_flavour}
export KERNELVERSION=${kernel_version}
export KERNELRELEASE=${kernel_release}
export KDEB_SOURCENAME=linux-${kernel_release}
export KDEB_PERFNAME=perf-${kernel_release}

# Below is the list of values that will be used in the json files
export KERNEL_GIT=`git config remote.origin.url`
export KERNEL_COMMIT=`git log -n1 --pretty=format:%H`

if [ -z "${WORKSPACE}" ]; then
  # Local build
  export WORKSPACE=`pwd`
  export BUILD_NUMBER=1
fi
. $WORKSPACE/lci-build-tools/jenkins_common_lib

#Calling the function build_instructions which includes the kernel build instructions
build_instructions