summaryrefslogtreecommitdiff
path: root/jenkins_kernel_build_inst
blob: 3e71d55a0dd2ab7d8d531b72e258d3aeda10434d (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
#! /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

if test -z "$kernel_config"; then
  kernel_config='omap2plus_defconfig'
fi
if test -z "$hwpack_type"; then
  hwpack_type='panda'
fi
# Use the new board_types variable to define multiple boards for LAVA testing.
if test -z "$board_types" -a -z "$board_type"; then
    board_types="panda"
elif test -z "$board_types" -a -n "$board_type"; then
    board_types="$board_type"
elif test -n "$board_types" -a -n "$board_type"; then
    board_types="$board_types,$board_type"
fi
if test -z "$kernel_flavour"; then
  kernel_flavour='omap'
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 "$submit_job"; then
  submit_job=1
fi
if test -z "$lava_test_plan"; then
  lava_test_plan="ltp, pwrmgmt"
fi

if test -z "$toolchain_url"; then
  gcc_compiler=`which arm-linux-gnueabihf-gcc`
else
  wget -cq $toolchain_url
  toolchain_tar_filename=`basename $toolchain_url`
  rm -rf "toolchain"
  mkdir "toolchain"
  tar -C "toolchain"  --strip-components 1 -xf $toolchain_tar_filename
  gcc_compiler=`find $PWD/toolchain/bin/arm-linux-gnueabihf-gcc |head -n1`
fi

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

if test -z "$conf_filenames"; then
  conf_filenames='linaro/configs/omap4.conf'
fi
if test -z "$use_config_fragment"; then
  use_config_fragment=0
fi

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 use_config_fragment
export gcc_cc_version=`sh $PWD/scripts/gcc-version.sh -p $gcc_compiler`
export bundle_stream_name=`echo $JOB_NAME | sed -e 's/_.*//' -e 's/\./_/g'`
export TOOLCHAIN_PREFIX=`echo $gcc_compiler | sed -e 's/-gcc$/-/'`
kernel_config_name=`echo ${kernel_config} | sed -e 's/_defconfig//g'`

if $git_reset = "true" ; then
   git reset --hard $GIT_COMMIT
   echo "DEBUG: We have reset the git now to point at $GIT_COMMIT commit id"
fi

export kernel_version=`git describe --match='v*' | sed -e 's/^v//'``echo -${kernel_config_name}-linaro-${kernel_flavour} | sed -e 's/_/-/g'`

# Below is the list of values that will be used in the json files
kernel_git=`cat .git/config|grep -i git |cut -d "=" -f2` 
export KERNEL_GIT="$kernel_git"
export KERNEL_COMMIT=$GIT_COMMIT

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