summaryrefslogtreecommitdiff
path: root/linux-lng.sh
blob: bdfd9a97c902b69571795c3b90bcfa19e1356a84 (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
#!/bin/bash

set -ex

export parent_workspace="/mnt/ci_build/workspace/linux-lng"
export reference_git="${parent_workspace}/reference-git"
export linux_git="${linux_git:-git://git.linaro.org/kernel/linux-linaro-lng.git}"
export linux_branch_version="${linux_branch_version:-"v3.14"}"
export linux_branch="${linux_branch:-"linux-linaro-lng-${linux_branch_version}"}"
endian=${endian:-le}
TC_RELEASE="${TC_RELEASE:-14.09}"
GCC_VERSION="${GCC_VERSION:-4.9}"
export ARCH=arm

if [ -z "${WORKSPACE}" ]; then
  # Local build
  export hwpack=${hwpack:-arndale}
  export parent_workspace=`pwd`
  export reference_git="${parent_workspace}/reference-git"
  export WORKSPACE="${parent_workspace}/workspace"
  export BUILD_NUMBER=1
  mkdir -p ${WORKSPACE}
  cd ${WORKSPACE}
fi

trap cleanup_exit INT TERM EXIT

cleanup_exit()
{
  cd ${WORKSPACE}
  rm -rf lci-build-tools
  rm -rf builddir*
}

test -d ${reference_git} || git clone --depth 1 -b $linux_branch $linux_git ${reference_git}
cp -a ${reference_git}/* ${reference_git}/.git* .

export use_config_fragment=1
export MAKE_DTBS=true
export toolchain_url="http://releases.linaro.org/${TC_RELEASE}/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.9-20${TC_RELEASE}_linux.tar.xz"
export rootfs_arch="armv7a"

case "${hwpack}" in
  arndale)
    export hwpack_type="arndale"
    export board_types="lng-arndale"
    export kernel_flavour="arndale"
    export conf_filenames="linaro/configs/linaro-base.conf linaro/configs/distribution.conf linaro/configs/hugepage.conf linaro/configs/preemption.conf linaro/configs/ovs.conf linaro/configs/kvm-host.conf linaro/configs/no_hz_full.conf linaro/configs/arndale.conf"
    export device_type="lng-arndale"
    lmc_dev="arndale"
    ;;
  arndale-be)
    export hwpack_type="arndale"
    export board_types="lng-arndale"
    export kernel_flavour="arndale"
    export conf_filenames="linaro/configs/linaro-base.conf linaro/configs/distribution.conf linaro/configs/hugepage.conf linaro/configs/preemption.conf linaro/configs/ovs.conf linaro/configs/kvm-host.conf linaro/configs/no_hz_full.conf linaro/configs/arndale.conf linaro/configs/bigendian.conf"
    export device_type="lng-arndale"
    export rootfs_arch="armv7ab"
    lmc_dev="arndale"
    endian="be"
    ;;
  vexpress64)
    export hwpack_type="vexpress64"
    export board_types="rtsm_foundation-armv8"
    export kernel_flavour="vexpress64"
    export conf_filenames="linaro/configs/linaro-base.conf linaro/configs/linaro-base64.conf linaro/configs/distribution.conf linaro/configs/preemption.conf linaro/configs/ovs.conf linaro/configs/kvm-host.conf linaro/configs/no_hz_full.conf linaro/configs/vexpress64.conf"
    export device_type="rtsm_foundation-armv8"
    export ARCH="arm64"
    export toolchain_url="https://releases.linaro.org/${TC_RELEASE}/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.9-20${TC_RELEASE}_linux.tar.xz"
    export rootfs_arch="armv8"
    export make_bootwrapper=false
    lmc_dev="fastmodel"
    ;;
esac

export tcbindir="$HOME/$ARCH-tc-${TC_RELEASE}/bin"
mkdir -p $(dirname ${tcbindir})

git clone git://git.linaro.org/ci/lci-build-tools.git
bash -x lci-build-tools/jenkins_kernel_build_inst
cp -a builddir-*-${kernel_flavour}/.config kernel_config_${hwpack}

# Get rootfs
rm -f linaro-image-lng-generic*.tar.gz
export ROOTFS_BUILD_NUMBER=`wget -q --no-check-certificate -O - https://ci.linaro.org/jenkins/job/openembedded-${rootfs_arch}-rootfs/gcc_version=${GCC_VERSION},label=build,rootfs=lng/lastSuccessfulBuild/buildNumber`
export ROOTFS_BUILD_TIMESTAMP=`wget -q --no-check-certificate -O - https://ci.linaro.org/jenkins/job/openembedded-${rootfs_arch}-rootfs/gcc_version=${GCC_VERSION},label=build,rootfs=lng/lastSuccessfulBuild/buildTimestamp?format=yyyyMMdd`
export ROOTFS_BUILD_URL="http://snapshots.linaro.org/openembedded/images/lng-${rootfs_arch}-gcc-${GCC_VERSION}/${ROOTFS_BUILD_NUMBER}/linaro-image-lng-generic${rootfs_arch}-${ROOTFS_BUILD_TIMESTAMP}-${ROOTFS_BUILD_NUMBER}.rootfs.tar.gz"
wget --progress=dot -e dotbytes=2M ${ROOTFS_BUILD_URL}

# Create pre-built image(s)
linaro-media-create --dev ${lmc_dev} --output-directory ${WORKSPACE} --image-size 3G --binary linaro-image-lng-generic${rootfs_arch}-${ROOTFS_BUILD_TIMESTAMP}-${ROOTFS_BUILD_NUMBER}.rootfs.tar.gz --hwpack hwpack_linaro-${hwpack_type}*.tar.gz --hwpack-force

# Compress image(s)
mv sd.img ${hwpack}-lng-sd.img
gzip -9 ${hwpack}-lng-sd.img

# Create metadata to send to LAVA
cat << EOF > metadata.json
{
"linux.hash":"$(git log -n1 --pretty=format:%h)",
"hwpack.endian":"${endian}"
}
EOF

cat << EOF > post_build_lava_parameters
HWPACK_JOB_NAME=${JOB_NAME}
HWPACK_BUILD_NUMBER=${BUILD_NUMBER}
HWPACK_FILE_NAME=`ls hwpack_linaro-${hwpack_type}*.tar.gz`
IMAGE_URL=https://snapshots.linaro.org/kernel-hwpack/linux-lng-${hwpack}/${BUILD_NUMBER}/${hwpack}-lng-sd.img.gz
BUNDLE_STREAM_NAME=/public/team/linaro/ci-linux-lng/
LAVA_TEST_PLAN=nohz-isolation ltp-realtime ltp kvm
DEVICE_TYPE=${board_types}
DISTRIBUTION=openembedded
METADATA_URL=${JOB_URL}/ws/metadata.json
EOF

cat << EOF > BUILD-INFO.txt
Format-Version: 0.5

Files-Pattern: *
License-Type: open
EOF