aboutsummaryrefslogtreecommitdiff
path: root/96boards-hikey.yaml
blob: fc289551c3438917b7cfe82302e566bba7f405b8 (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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
- job:
    name: 96boards-hikey
    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: 'alip developer'
    disabled: false
    node: docker-utopic
    display-name: '96boards - HiKey'
    scm:
        - git:
            url: https://github.com/96boards/linux.git
            refspec: +refs/heads/hikey:refs/remotes/origin/hikey
            name: origin
            branches:
                - refs/heads/hikey
            skip-tag: true
            shallow-clone: true
            wipe-workspace: false
    wrappers:
        - timestamps
        - copy-to-slave:
            includes:
                - wifi.r8.5.tar.gz
        - 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/hikey-jessie_*.img || true
              rm -rf lci-build-tools
              rm -rf builddir*
              rm -rf out
            }

            sudo apt-get install -y kpartx python-pycurl
            wget http://repo.linaro.org/ubuntu/linaro-overlay/pool/main/a/android-tools/android-tools-fsutils_4.2.2+git20130218-3ubuntu41+linaro1_amd64.deb
            sudo dpkg -i --force-all android-tools-fsutils_*.deb
            rm -f android-tools-fsutils_*.deb
            # FIXME - temporary workaround
            sudo wget https://git.linaro.org/ci/linaro-image-tools.git/blob_plain/HEAD:/linaro-hwpack-install -O /usr/bin/linaro-hwpack-install
            sudo chmod +x /usr/bin/linaro-hwpack-install

            export LANG=C
            export make_bootwrapper=false
            export make_install=true
            export kernel_flavour=hikey
            export kernel_config=defconfig
            export MAKE_DTBS=true
            export ARCH=arm64
            export tcbindir="${HOME}/srv/toolchain/arm64-tc-14.09/bin"
            export toolchain_url=http://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz

            # Disable wireless configuration API
            # TI wl18xx R8.5 is using a backported CFG80211 and MAC80211
            tar zxf wifi.r8.5.tar.gz
            patch -p1 < ${WORKSPACE}/wifi.r8.5/kernel.patch/0001-defconfig-hikey-discard-CFG80211-and-MAC80211.patch
            echo "CONFIG_LOCALVERSION=\"-linaro-hikey\"" >> arch/arm64/configs/defconfig
            touch .scmversion

            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
            rm -rf out/dtbs

            # ******** TI wl18xx R8.5 - out of tree modules ********
            git clone --depth 1 https://github.com/96boards/wilink8-wlan_build-utilites.git build-utilites
            KERNEL_PATH=$(find ${WORKSPACE} -maxdepth 1 -type d -name 'builddir-*-linaro-hikey')
            make O=${KERNEL_PATH} INSTALL_MOD_PATH=${WORKSPACE}/build-utilites/fs modules_install
            cp -a build-utilites/setup-env.sample build-utilites/setup-env
            sed -e "s|^export TOOLCHAIN_PATH=.*|export TOOLCHAIN_PATH=${HOME}/srv/toolchain/arm64-tc-14.09/bin|" \
                -e "s|^export KERNEL_PATH=.*|export KERNEL_PATH=${KERNEL_PATH}|" \
                -e "s|^export CROSS_COMPILE=.*|export CROSS_COMPILE=aarch64-linux-gnu-|" \
                -e "s|^export ARCH=.*|export ARCH=arm64|" \
                -i build-utilites/setup-env

            git clone -b hikey --depth 1 https://github.com/96boards/wilink8-wlan_wl18xx.git    build-utilites/src/driver
            git clone -b R8.5  --depth 1 https://github.com/96boards/wilink8-wlan_wl18xx_fw.git build-utilites/src/fw_download
            git clone -b hikey --depth 1 https://github.com/96boards/wilink8-wlan_backports.git build-utilites/src/backports

            # XXX FIXME local hack to avoid setlocalversion to pick up and add a plus sign
            touch ${WORKSPACE}/build-utilites/src/driver/.scmversion

            cd ${WORKSPACE}/build-utilites
            ./build_wl18xx.sh modules
            ./build_wl18xx.sh firmware
            cd ${WORKSPACE}
            # ******** TI wl18xx R8.5 - out of tree modules ********

            # Create the hardware pack
            cat << EOF > linaro-hikey
            format: '3.0'
            name: linaro-hikey
            architectures:
            - arm64
            origin: Linaro
            maintainer: Linaro Platform <linaro-dev@lists.linaro.org>
            support: supported
            serial_tty: ttyAMA0
            kernel_addr: '0x60000000'
            initrd_addr: '0x62000000'
            load_addr: '0x60008000'
            dtb_addr: '0x61000000'
            partition_layout: bootfs16_rootfs
            mmc_id: '0:1'
            kernel_file: boot/Image-*-hikey
            initrd_file: boot/initrd.img-*-hikey
            dtb_file: lib/firmware/*-linaro-hikey/device-tree/hi6220-hikey.dtb
            boot_script: boot.scr
            boot_min_size: 65
            extra_serial_options:
            - console=tty0
            - console=ttyAMA0,115200n8
            - k3v2mem
            - hisi_dma_print=0
            - vmalloc=484M
            - no_irq_affinity
            - maxcpus=8
            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
            packages:
            - linux-image-arm64
            - linux-headers-arm64
            - firmware-linux
            - firmware-ti-connectivity
            - ti-uim
            - ti-calibrator
            sources:
              debian: http://ftp.debian.org/debian/ jessie main contrib non-free
              repo: http://repo.linaro.org/ubuntu/linaro-overlay jessie main
            EOF

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

            echo "console=tty0 console=ttyAMA0,115200n8 root=/dev/disk/by-partlabel/system rootwait rw" > cmdline.emmc
            echo "console=tty0 console=ttyAMA0,115200n8 root=/dev/mmcblk1p2 rootwait rw" > cmdline

            FASTBOOT_EFI_BUILD_NUMBER=`wget -q --no-check-certificate -O - https://ci.linaro.org/job/96boards-hikey-uefi/lastSuccessfulBuild/buildNumber`
            FASTBOOT_EFI_URL="http://builds.96boards.org/snapshots/hikey/linaro/uefi/${FASTBOOT_EFI_BUILD_NUMBER}/AndroidFastbootApp.efi"

            cat > out/README.txt << EOF
            Build information:
            * build: ${BUILD_URL}
            * git URL: ${GIT_URL}
            * git branch: ${GIT_BRANCH}
            * git commit: ${GIT_COMMIT}
            * uefi: http://builds.96boards.org/snapshots/hikey/linaro/uefi/${FASTBOOT_EFI_BUILD_NUMBER}
            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=build,rootfs=${rootfs}/lastSuccessfulBuild/buildNumber`
              export ROOTFS_BUILD_TIMESTAMP=`wget -q --no-check-certificate -O - https://ci.linaro.org/job/debian-arm64-rootfs/label=build,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

              if [ "${rootfs}" = "alip" ]; then
                mali_pkg="xserver-xorg-video-fbdev-mali-450_0.0.1-1_all.deb"
                wget http://builds.96boards.org/snapshots/hikey/linaro/binaries/20150407/${mali_pkg} -O ${mali_pkg}
                linaro-hwpack-append -t `ls hwpack_linaro-hikey_*_arm64_supported.tar.gz` -p ${mali_pkg} -d -i
                rm -f ${mali_pkg}
              fi

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

              # Create eMMC rootfs image(s)
              mkdir boot rootfs
              for device in $(sudo kpartx -av out/hikey-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

              if [ "${rootfs}" = "developer" ]; then
                sed -e "s|^PULSEAUDIO_SYSTEM_START=0|PULSEAUDIO_SYSTEM_START=1|" \
                    -e "s|^DISALLOW_MODULE_LOADING=1|DISALLOW_MODULE_LOADING=0|" \
                    < rootfs/usr/share/doc/pulseaudio/examples/pulseaudio.default.example \
                    | sudo tee rootfs/etc/default/pulseaudio
                sudo install -D -p -m0755 \
                  rootfs/usr/share/doc/pulseaudio/examples/pulseaudio.init.example \
                  rootfs/etc/init.d/pulseaudio
                cat << EOF | sudo tee -a rootfs/etc/pulse/system.pa

            ### Automatically load driver modules for Bluetooth hardware
            .ifexists module-bluetooth-policy.so
            load-module module-bluetooth-policy
            .endif

            .ifexists module-bluetooth-discover.so
            load-module module-bluetooth-discover
            .endif
            EOF
              else
                sudo install -D -p -m0644 \
                  rootfs/etc/xdg/lxsession/LXDE/autostart \
                  rootfs/home/linaro/.config/lxsession/LXDE/autostart
                cat << EOF | sudo tee -a rootfs/home/linaro/.config/lxsession/LXDE/autostart
            @bash -c /home/linaro/bin/xmms2-output-plugin-pulse
            EOF
              fi

              sudo cp -a boot/hi6220-hikey.dtb boot/lcb.dtb || true
              sudo cp -a boot/initrd.img-* boot/ramdisk.img || true
              sudo cp -a cmdline boot/cmdline || true

              sudo ln -sf /etc/resolvconf/run/resolv.conf rootfs/etc/resolv.conf

              cat << EOF | sudo tee rootfs/etc/network/interfaces.d/eth0
            #auto eth0
            #iface eth0 inet dhcp
            EOF

              cat << EOF | sudo tee rootfs/etc/network/interfaces.d/wlan0
            #auto wlan0
            #iface wlan0 inet dhcp
            #    wpa-driver nl80211
            #    wpa-ssid YOUR-SSID-HERE
            #    wpa-psk YOUR-PASSWORD-HERE
            #    pre-up /sbin/iw wlan0 set power_save off
            #    pre-up echo 0 > /sys/kernel/debug/ieee80211/phy0/wlcore/sleep_auth
            EOF

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

              sudo rm -rf rootfs/dev rootfs/boot rootfs/var/lib/apt/lists rootfs/lib/modules/*-linaro-hikey
              sudo mkdir rootfs/dev rootfs/boot rootfs/var/lib/apt/lists rootfs/home/linaro/bin

              sudo wget https://raw.githubusercontent.com/96boards/usb_speed_switch/master/usb_speed -O rootfs/home/linaro/bin/usb_speed
              cat << EOF | sudo tee -a rootfs/home/linaro/bin/xmms2-output-plugin-pulse
            #!/bin/sh

            [ ! -f "\$HOME/.config/xmms2/xmms2.conf" ] && xmms2 server config output.plugin pulse
            EOF
              cat << EOF | sudo tee -a rootfs/home/linaro/.profile

            /home/linaro/bin/xmms2-output-plugin-pulse
            EOF
              sudo chmod a+x rootfs/home/linaro/bin/*
              sudo chown -R 1000:1000 rootfs/home/linaro

              # ******** TI wl18xx R8.5 - out of tree modules ********
              sudo rm -f rootfs/lib/firmware/ti-connectivity/wl18xx-conf.bin
              sudo install -D -p -m0644 \
                ${WORKSPACE}/build-utilites/fs/lib/firmware/ti-connectivity/wl18xx-fw-4.bin \
                rootfs/lib/firmware/ti-connectivity/wl18xx-fw-4.bin
              sudo find ${WORKSPACE}/build-utilites/fs/lib/modules -type l -delete
              sudo cp -a ${WORKSPACE}/build-utilites/fs/lib/modules/*-linaro-hikey rootfs/lib/modules/
              # ******** TI wl18xx R8.5 - out of tree modules ********

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

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

            # Create boot image(s)
            mkdir boot-fat
            #dd if=/dev/zero of=out/boot-fat.img bs=512 count=131072
            #sudo mkfs.fat -n "BOOT IMG" out/boot-fat.img
            #sudo mount -o loop,rw,sync out/boot-fat.img boot-fat
            #sudo cp -a out/Image boot-fat/Image || true
            #sudo cp -a out/hi6220-hikey.dtb boot-fat/lcb.dtb || true
            #sudo cp -a out/initrd.img-* boot-fat/ramdisk.img || true
            #sudo cp -a cmdline boot-fat/cmdline || true
            #sudo umount boot-fat
            #sudo chmod 777 out/boot-fat.img
            dd if=/dev/zero of=out/boot-fat.emmc.img bs=512 count=131072
            sudo mkfs.fat -n "BOOT IMG" out/boot-fat.emmc.img
            sudo mount -o loop,rw,sync out/boot-fat.emmc.img boot-fat
            sudo cp -a out/Image boot-fat/Image || true
            sudo cp -a out/hi6220-hikey.dtb boot-fat/lcb.dtb || true
            sudo cp -a out/initrd.img-* boot-fat/ramdisk.img || true
            sudo cp -a cmdline.emmc boot-fat/cmdline || true
            sudo umount boot-fat
            sudo chmod 777 out/boot-fat.emmc.img
            dd if=/dev/zero of=out/boot-fat.uefi.img bs=512 count=131072
            sudo mkfs.fat -n "BOOT IMG" out/boot-fat.uefi.img
            sudo mount -o loop,rw,sync out/boot-fat.uefi.img boot-fat
            sudo cp -a out/Image out/hi6220-hikey.dtb boot-fat/ || true
            sudo cp -a out/initrd.img-* boot-fat/initrd.img || true
            sudo wget --progress=dot ${FASTBOOT_EFI_URL} -O boot-fat/fastboot.efi || true
            sudo umount boot-fat
            sudo chmod 777 out/boot-fat.uefi.img
            rm -rf boot-fat

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

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

            # Publish
            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
            wget https://git.linaro.org/ci/job/configs.git/blob_plain/HEAD:/96boards-hikey/build-info/template.txt -O out/BUILD-INFO.txt
            time python ${HOME}/bin/linaro-cp.py \
              --server ${PUBLISH_SERVER} \
              --build-info out/BUILD-INFO.txt \
              out snapshots/hikey/linaro/debian/${BUILD_NUMBER}
            python ${HOME}/bin/linaro-cp.py \
              --server ${PUBLISH_SERVER} \
              --make-link snapshots/hikey/linaro/debian/${BUILD_NUMBER}
    publishers:
        - email:
            recipients: 'fathi.boudra@linaro.org'