aboutsummaryrefslogtreecommitdiff
path: root/lt-qcom-debian-images.yaml
blob: ebb48c074cf7207450033b06bfc51ab105689f7d (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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
- job:
    name: lt-qcom-debian-images
    project-type: freestyle
    defaults: global
    logrotate:
        daysToKeep: 30
        numToKeep: 30
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
                - job-workspace
            linaro-landing-team-qualcomm-personnel:
                - job-build
                - job-cancel
    parameters:
        - string:
            name: BUNDLE_STREAM_NAME
            default: '/public/team/linaro/lt-qualcomm/'
        - string:
            name: DEVICE_TYPE
            default: 'ifc6410'
        - string:
            name: LAVA_SERVER
            default: 'validation.linaro.org/RPC2/'
        - string:
            name: VENDOR
            default: 'linaro'
        - string:
            name: OS_FLAVOUR
            default: 'jessie'
        - string:
            name: EXT4FS_IMG_SZ
            default: '1800M'
        - string:
            name: PLATFORM_ARCH
            default: 'armhf'
        - string:
            name: PLATFORM_NAME
            default: 'qcom-snapdragon'
        - string:
            name: ROOTFS
            default: 'developer alip'
        - string:
            name: DTBS
            default: 'qcom-apq8064-ifc6410.dtb qcom-apq8064-cm-qs600.dtb qcom-apq8064-eI_ERAGON600.dtb'
        - string:
            name: SERIAL_CONSOLE
            default: 'ttyMSM0'
        - string:
            name: KERNEL_BRANCH
            default: 'release/qcomlt-4.4'
    disabled: false
    node: docker-utopic-amd64
    display-name: 'Qualcomm Debian based images for Snapdragon 600'
    scm:
        - git:
            url: https://git.linaro.org/landing-teams/working/qualcomm/kernel.git
            refspec: +refs/heads/${KERNEL_BRANCH}:refs/remotes/origin/${KERNEL_BRANCH}
            name: origin
            branches:
                - refs/heads/${KERNEL_BRANCH}
            skip-tag: true
            shallow-clone: true
            wipe-workspace: false
    wrappers:
        - timestamps
        - build-name:
            name: '#${BUILD_NUMBER}-${GIT_REVISION,length=8}'
    builders:
        - linaro-publish-token
        - shell: |
            #!/bin/bash

            set -ex

            trap cleanup_exit INT TERM EXIT

            cleanup_exit()
            {
              cd ${WORKSPACE}
              sudo kpartx -dv out/${VENDOR}-${OS_FLAVOUR}-*.sd.img || true
              rm -rf lci-build-tools
              rm -rf builddir*
              rm -rf out
              rm -rf qcom-firmware
              git clean -fdx
            }

            sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
            sudo apt-get update
            sudo apt-get install -y kpartx python-pycurl device-tree-compiler zip
            wget -q \
              http://repo.linaro.org/ubuntu/linaro-overlay/pool/main/a/android-tools/android-tools-fsutils_4.2.2+git20130218-3ubuntu41+linaro1_amd64.deb \
              http://repo.linaro.org/ubuntu/linaro-tools/pool/main/l/linaro-image-tools/linaro-image-tools_2015.11-1.linarojessie.1_amd64.deb \
              http://repo.linaro.org/ubuntu/linaro-tools/pool/main/l/linaro-image-tools/python-linaro-image-tools_2015.11-1.linarojessie.1_all.deb \
              http://repo.linaro.org/ubuntu/linaro-overlay/pool/main/m/multipath-tools/kpartx_0.5.0-7ubuntu7.1_amd64.deb
            sudo dpkg -i --force-all *.deb
            rm -f *.deb

            export LANG=C
            export make_bootwrapper=false
            export make_install=true
            export kernel_flavour=lt-qcom
            export kernel_config="qcom_defconfig distro.config"
            export MAKE_DTBS=true
            export tcbindir="${HOME}/srv/toolchain/arm-tc-14.04/bin"
            export toolchain_url=http://releases.linaro.org/14.04/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz

            test -d lci-build-tools || git clone https://git.linaro.org/git/ci/lci-build-tools.git lci-build-tools
            bash -x lci-build-tools/jenkins_kernel_build_inst

            # Create the hardware pack
            cat << EOF > ${VENDOR}-lt-qcom.default
            format: '3.0'
            name: ${VENDOR}-lt-qcom
            architectures:
            - ${PLATFORM_ARCH}
            origin: Linaro
            maintainer: Linaro Platform <linaro-dev@lists.linaro.org>
            support: supported
            serial_tty: ${SERIAL_CONSOLE}
            kernel_addr: '0x80208000'
            initrd_addr: '0x83000000'
            load_addr: '0x60008000'
            dtb_addr: '0x61000000'
            partition_layout: bootfs_rootfs
            mmc_id: '0:1'
            kernel_file: boot/vmlinuz-*-qcom
            initrd_file: boot/initrd.img-*-qcom
            dtb_file: lib/firmware/*-qcom/device-tree/qcom-apq8064-ifc6410.dtb
            dtb_files:
            - qcom-apq8064-ifc6410.dtb: lib/firmware/*-qcom/device-tree/qcom-apq8064-ifc6410.dtb
            - qcom-apq8064-cm-qs600.dtb: lib/firmware/*-qcom/device-tree/qcom-apq8064-cm-qs600.dtb
            - qcom-apq8064-eI_ERAGON600.dtb: lib/firmware/*-qcom/device-tree/qcom-apq8064-eI_ERAGON600.dtb
            boot_script: boot.scr
            boot_min_size: 64
            extra_serial_options:
            - console=tty0
            - console=${SERIAL_CONSOLE},115200n8
            assume_installed:
            - adduser
            - apt
            - apt-utils
            - debconf-i18n
            - debian-archive-keyring
            - gcc-4.8
            - gnupg
            - ifupdown
            - initramfs-tools
            - iproute2
            - irqbalance
            - isc-dhcp-client
            - kmod
            - netbase
            - udev
            sources:
              qcom: http://repo.linaro.org/ubuntu/qcom-overlay ${OS_FLAVOUR} main
              repo: http://repo.linaro.org/ubuntu/linaro-overlay ${OS_FLAVOUR} main
              debian: http://ftp.debian.org/debian/ ${OS_FLAVOUR} main contrib non-free
            packages:
            - linux-image-armmp
            - linux-headers-armmp
            - libasound2
            EOF

            # Build information
            cat > out/README.textile << EOF

            h4. QCOM Landing Team - Snapdragon 600 - Debian

            Build description:
            * Build URL: "$BUILD_URL":$BUILD_URL
            * OS flavour: $OS_FLAVOUR
            * Kernel tree: "$GIT_URL":$GIT_URL
            * Kernel branch: $KERNEL_BRANCH
            * Kernel version: "$GIT_COMMIT":$GIT_URL/commit/$GIT_COMMIT
            * Kernel defconfig: $kernel_config
            EOF

            for rootfs in ${ROOTFS}; do

              cat ${VENDOR}-lt-qcom.default > ${VENDOR}-lt-qcom

              # additional packages in desktop images
              [ "${rootfs}" != "developer" ] && cat << EOF >> ${VENDOR}-lt-qcom
            - xserver-xorg-video-freedreno
            EOF

              rm -f `ls hwpack_${VENDOR}-lt-qcom_*_${PLATFORM_ARCH}_supported.tar.gz`
              VERSION=`date +%Y%m%d`-${BUILD_NUMBER}
              linaro-hwpack-create --debug ${VENDOR}-lt-qcom ${VERSION}
              linaro-hwpack-replace -t `ls hwpack_${VENDOR}-lt-qcom_*_${PLATFORM_ARCH}_supported.tar.gz` -p `ls linux-image-*-${VENDOR}-lt-qcom_*.deb` -r linux-image -d -i
              linaro-hwpack-replace -t `ls hwpack_${VENDOR}-lt-qcom_*_${PLATFORM_ARCH}_supported.tar.gz` -p `ls linux-headers-*-${VENDOR}-lt-qcom_*.deb` -r linux-headers -d -i

              # Get rootfs
              export ROOTFS_BUILD_NUMBER=`wget -q --no-check-certificate -O - https://ci.linaro.org/jenkins/job/debian-${PLATFORM_ARCH}-rootfs/label=docker-jessie-${PLATFORM_ARCH},rootfs=${rootfs}/lastSuccessfulBuild/buildNumber`
              export ROOTFS_BUILD_TIMESTAMP=`wget -q --no-check-certificate -O - https://ci.linaro.org/jenkins/job/debian-${PLATFORM_ARCH}-rootfs/label=docker-jessie-${PLATFORM_ARCH},rootfs=${rootfs}/lastSuccessfulBuild/buildTimestamp?format=yyyyMMdd`
              export ROOTFS_BUILD_URL="http://snapshots.linaro.org/debian/images/${rootfs}-${PLATFORM_ARCH}/${ROOTFS_BUILD_NUMBER}/linaro-${OS_FLAVOUR}-${rootfs}-${ROOTFS_BUILD_TIMESTAMP}-${ROOTFS_BUILD_NUMBER}.tar.gz"
              wget --progress=dot -e dotbytes=2M ${ROOTFS_BUILD_URL}

              # Create pre-built image(s)
              linaro-media-create --dev fastmodel --output-directory ${WORKSPACE}/out --image-file ${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.sd.img --image-size 2G --binary linaro-${OS_FLAVOUR}-${rootfs}-${ROOTFS_BUILD_TIMESTAMP}-${ROOTFS_BUILD_NUMBER}.tar.gz --hwpack hwpack_${VENDOR}-lt-qcom_*.tar.gz --hwpack-force-yes --bootloader uefi

              # Create eMMC rootfs image(s)
              mkdir rootfs
              for device in $(sudo kpartx -avs out/${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.sd.img | cut -d' ' -f3); do
                partition=$(echo ${device} | cut -d'p' -f3)
                [ "${partition}" = "2" ] && sudo mount -o loop /dev/mapper/${device} rootfs
              done

              sudo rm -rf rootfs/dev rootfs/boot rootfs/var/lib/apt/lists
              sudo mkdir rootfs/dev rootfs/boot rootfs/var/lib/apt/lists

              # clean up fstab
              sudo sed -i '/UUID/d' rootfs/etc/fstab

              cat << EOF | sudo tee -a rootfs/etc/fstab
            LABEL=qcom-firmware /lib/firmware ext4 defaults 0 0
            EOF

              sudo mkfs.ext4 -L rootfs out/${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.img.raw ${EXT4FS_IMG_SZ}
              mkdir rootfs2
              sudo mount -o loop out/${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.img.raw rootfs2
              sudo cp -a rootfs/* rootfs2
              sudo umount rootfs2 rootfs
              sudo ext2simg -v out/${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.img.raw out/${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.img
              sudo kpartx -dv out/${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.sd.img
              sudo rm -rf rootfs out/${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.sd.img rootfs2 out/${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.img.raw

              # Compress image(s)
              gzip -9 out/${VENDOR}-${OS_FLAVOUR}-${rootfs}-${PLATFORM_NAME}-${VERSION}.img

              cat >> out/README.textile << EOF
            * Linaro Debian ${rootfs}: "http://snapshots.linaro.org/debian/images/${rootfs}-${PLATFORM_ARCH}/${ROOTFS_BUILD_NUMBER}":http://snapshots.linaro.org/debian/images/${rootfs}-${PLATFORM_ARCH}/${ROOTFS_BUILD_NUMBER}
            EOF
            done

            # Create boot image(s)
            cat > out/bootimg.cfg << EOF
            bootsize = 0xA00000
            pagesize = 0x800
            kerneladdr = 0x80208000
            ramdiskaddr = 0x83000000
            secondaddr = 0x81100000
            tagsaddr = 0x80200100
            name = ${VENDOR}-${PLATFORM_NAME}
            cmdline = console=tty0 console=${SERIAL_CONSOLE},115200n8 root=/dev/disk/by-partlabel/userdata rootwait rw systemd.unit=multi-user.target
            EOF

            # Create one boot image for each platform supported, since we need to append DTB to zImage
            for f in ${DTBS} ; do
              mv out/dtbs/${f} out/
              target=`basename ${f} .dtb`
              cat out/zImage out/${f} > zImage-dtb
              abootimg --create out/boot-${target}-${PLATFORM_NAME}-${VERSION}.img -f out/bootimg.cfg -k zImage-dtb -r out/initrd.img-*
              gzip -9 out/boot-${target}-${PLATFORM_NAME}-${VERSION}.img
            done
            rm -rf out/dtbs

            # Create an empty partition, placeholder for proprietary firmware
            # do no create sparse file, so that the file can be easily loop mounted
            mkdir qcom-firmware
            sudo make_ext4fs -L qcom-firmware -l 64M out/firmware-${PLATFORM_NAME}-${VERSION}.img qcom-firmware/
            rm -rf qcom-firmware
            gzip -9 out/firmware-${PLATFORM_NAME}-${VERSION}.img

            # Final preparation for publishing
            cp -a linux-*.deb out/
            rm -f out/vmlinuz

            # Create MD5SUMS file
            (cd out && md5sum * > MD5SUMS.txt)

            # Publish to snapshots
            test -d ${HOME}/bin || mkdir ${HOME}/bin
            wget https://git.linaro.org/ci/publishing-api.git/blob_plain/HEAD:/linaro-cp.py -O ${HOME}/bin/linaro-cp.py
            time python ${HOME}/bin/linaro-cp.py \
              --link-latest \
              out debian/pre-built/snapdragon/${BUILD_NUMBER}
        - shell: |
            VERSION=`date +%Y%m%d`-${BUILD_NUMBER}

            export BOOT_URL=https://snapshots.linaro.org/debian/pre-built/snapdragon/${BUILD_NUMBER}/boot-qcom-apq8064-ifc6410-${PLATFORM_NAME}-${VERSION}.img.gz
            export DATA_URL=https://snapshots.linaro.org/debian/pre-built/snapdragon/${BUILD_NUMBER}/${VENDOR}-${OS_FLAVOUR}-developer-${PLATFORM_NAME}-${VERSION}.img.gz
            export SYSTEM_URL=https://snapshots.linaro.org/debian/pre-built/snapdragon/${BUILD_NUMBER}/firmware-${PLATFORM_NAME}-${VERSION}.img.gz

            rm -rf configs lci-build-tools
            git clone --depth 1 http://git.linaro.org/ci/lci-build-tools.git
            git clone --depth 1 http://git.linaro.org/ci/job/configs.git
            ./lci-build-tools/yaml-to-json.py configs/${JOB_NAME}/lava-job-definitions/${DEVICE_TYPE}/template.yaml > custom_lava_job_definition.json

            cat << EOF > post_build_lava_parameters
            DEVICE_TYPE=${DEVICE_TYPE}
            BUNDLE_STREAM_NAME=${BUNDLE_STREAM_NAME}
            CUSTOM_JSON_URL=${JOB_URL}/ws/custom_lava_job_definition.json
            LAVA_SERVER=${LAVA_SERVER}
            EOF
        - trigger-builds:
            - project: 'post-build-lava'
              property-file: post_build_lava_parameters
              block: true
        - shell: |
            VERSION=`date +%Y%m%d`-${BUILD_NUMBER}

            export BOOT_URL=https://snapshots.linaro.org/debian/pre-built/snapdragon/${BUILD_NUMBER}/boot-qcom-apq8064-ifc6410-${PLATFORM_NAME}-${VERSION}.img.gz
            export DATA_URL=https://snapshots.linaro.org/debian/pre-built/snapdragon/${BUILD_NUMBER}/${VENDOR}-${OS_FLAVOUR}-developer-${PLATFORM_NAME}-${VERSION}.img.gz
            export SYSTEM_URL=https://snapshots.linaro.org/debian/pre-built/snapdragon/${BUILD_NUMBER}/firmware-${PLATFORM_NAME}-${VERSION}.img.gz

            ./lci-build-tools/yaml-to-json.py configs/${JOB_NAME}/lava-job-definitions/${DEVICE_TYPE}/template-ltp.yaml > custom_lava_job_definition_ltp.json

            cat << EOF > post_build_lava_parameters
            DEVICE_TYPE=${DEVICE_TYPE}
            BUNDLE_STREAM_NAME=${BUNDLE_STREAM_NAME}
            CUSTOM_JSON_URL=${JOB_URL}/ws/custom_lava_job_definition_ltp.json
            LAVA_SERVER=${LAVA_SERVER}
            EOF
        - trigger-builds:
            - project: 'post-build-lava'
              property-file: post_build_lava_parameters
              block: true
    publishers:
        - email:
            recipients: 'nicolas.dechesne@linaro.org fathi.boudra@linaro.org'
        - ircbot:
            channels:
                - name: '#linaro-lt-qcomm'
                  password: ${LT_QCOM_KEY}