aboutsummaryrefslogtreecommitdiff
path: root/96boards-helium.yaml
blob: 1c26577afd5997908642a0bc903b27341d8ff2c3 (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
- job:
    name: 96boards-helium
    project-type: freestyle
    defaults: global
    logrotate:
        daysToKeep: 30
        numToKeep: 30
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
                - job-workspace
    parameters:
        - string:
            name: ROOTFS
            default: 'developer'
    disabled: false
    node: docker-jessie-amd64
    display-name: '96boards - Marvell PXA1928 Helium'
    scm:
        - git:
            url: https://git.linaro.org/people/rob.herring/linux.git
            refspec: +refs/heads/v4.1-pxa1928:refs/remotes/origin/v4.1-pxa1928
            name: origin
            branches:
                - refs/heads/v4.1-pxa1928
            skip-tag: true
            shallow-clone: true
            wipe-workspace: false
    wrappers:
        - timestamps
        - build-name:
            name: '#${BUILD_NUMBER}-${GIT_REVISION,length=8}'
    builders:
        - linaro-publish-token:
            host: builds.96boards.org
        - shell: |
            #!/bin/bash

            set -ex

            trap cleanup_exit INT TERM EXIT

            cleanup_exit()
            {
              cd ${WORKSPACE}
              sudo kpartx -dv out/helium-jessie_*.img || true
              rm -rf lci-build-tools
              rm -rf builddir*
              rm -rf out
            }

            sudo apt-get update
            sudo apt-get install -y kpartx python-requests
            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_2016.05-1linarojessie1_amd64.deb \
              http://repo.linaro.org/ubuntu/linaro-tools/pool/main/l/linaro-image-tools/python-linaro-image-tools_2016.05-1linarojessie1_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=helium
            export kernel_config=pxa1928_defconfig
            export MAKE_DTBS=true
            export ARCH=arm64
            export tcbindir="${HOME}/srv/toolchain/arm64-tc-15.02/bin"
            export toolchain_url=http://releases.linaro.org/15.02/components/toolchain/binaries/aarch64-linux-gnu/gcc-linaro-4.9-2015.02-3-x86_64_aarch64-linux-gnu.tar.xz

            # FIXME - enable wl18xx driver
            sed -i "/^CONFIG_RFKILL/d" arch/arm64/configs/pxa1928_defconfig
            cat << EOF >> arch/arm64/configs/pxa1928_defconfig
            CONFIG_CFG80211=m
            CONFIG_MAC80211=m
            CONFIG_RFKILL=m
            CONFIG_RFKILL_REGULATOR=m
            CONFIG_RFKILL_GPIO=m
            CONFIG_WL18XX=m
            CONFIG_WLCORE_SDIO=m
            EOF

            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
            bash -x lci-build-tools/jenkins_kernel_build_inst
            rm -rf out/dtbs
            cp -a linux-*.deb out/

            # Create the hardware pack
            cp -a configs/96boards-helium/hwpacks/linaro-helium .

            VERSION=`date +%Y%m%d`-${BUILD_NUMBER}
            linaro-hwpack-create --debug linaro-helium ${VERSION}
            linaro-hwpack-replace -t `ls hwpack_linaro-helium_*_arm64_supported.tar.gz` -p `ls linux-image-*-linaro-helium_*.deb` -r linux-image -d -i
            linaro-hwpack-replace -t `ls hwpack_linaro-helium_*_arm64_supported.tar.gz` -p `ls linux-headers-*-linaro-helium_*.deb` -r linux-headers -d -i

            cat > out/README.txt << EOF
            Build information:
            * build: ${BUILD_URL}
            * git URL: ${GIT_URL}
            * git branch: ${GIT_BRANCH}
            * git commit: ${GIT_COMMIT}
            EOF

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

              cat >> out/README.txt << EOF
            * rootfs (${rootfs}): http://snapshots.linaro.org/debian/images/${rootfs}-arm64/${ROOTFS_BUILD_NUMBER}
            EOF

              # Create pre-built image(s)
              linaro-media-create --dev fastmodel --output-directory ${WORKSPACE}/out --image-file helium-jessie_${rootfs}_${VERSION}.img --image-size 2G --binary linaro-jessie-${rootfs}-${ROOTFS_BUILD_TIMESTAMP}-${ROOTFS_BUILD_NUMBER}.tar.gz --hwpack hwpack_linaro-helium_*.tar.gz --hwpack-force-yes --bootloader uefi

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

              cat << EOF | sudo tee rootfs/etc/fstab
            /dev/disk/by-partlabel/userdata /     ext4 errors=remount-ro 0 1
            EOF

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

              sudo make_ext4fs -o -L rootfs -l 5400M -s out/helium-jessie_${rootfs}_${VERSION}.emmc.img rootfs/
              sudo umount boot rootfs
              sudo kpartx -dv out/helium-jessie_${rootfs}_${VERSION}.img
              sudo rm -rf boot rootfs

              # Compress image(s)
              gzip -9 out/helium-jessie_${rootfs}_${VERSION}.emmc.img
              gzip -9 out/helium-jessie_${rootfs}_${VERSION}.img
            done

            # Create boot image(s)
            wget -q https://android.googlesource.com/platform/system/core.git/+/master/mkbootimg/mkbootimg?format=text -O mkbootimg.txt
            cat mkbootimg.txt | base64 -d > mkbootimg
            python mkbootimg \
              --kernel out/Image \
              --ramdisk out/initrd.img-* \
              --cmdline "console=tty0 console=ttyS3,115200n8 root=/dev/disk/by-partlabel/userdata rootwait rw" \
              --base "0x01200000" \
              --kernel_offset "0x00080000" \
              --output out/boot.emmc.img

            # Compress boot partition image(s)
            gzip -9 out/boot.emmc.img

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

            # Publish
            test -d ${HOME}/bin || mkdir ${HOME}/bin
            wget -q 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 \
              --server ${PUBLISH_SERVER} \
              --link-latest \
              out snapshots/helium/linaro/debian/${BUILD_NUMBER}
    publishers:
        - email:
            recipients: 'fathi.boudra@linaro.org'