aboutsummaryrefslogtreecommitdiff
path: root/lt-qcom-bootloader/dragonboard820c/builders.sh
blob: 7ebcd9302149d9f0b760a787cb2596650b68dd2c (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
#!/bin/bash

sudo apt-get update
sudo apt-get install -y zip gdisk

set -ex

# download the firmware packages
wget -q ${QCOM_LINUX_FIRMWARE}
echo "${QCOM_LINUX_FIRMWARE_MD5}  $(basename ${QCOM_LINUX_FIRMWARE})" > MD5
md5sum -c MD5

unzip -j -d bootloaders-linux $(basename ${QCOM_LINUX_FIRMWARE}) "*/bootloaders-linux/*" "*/cdt-linux/*" "*/loaders/*"

# Get the Android compiler
git clone ${LK_GCC_GIT} --depth 1 -b ${LK_GCC_REL} android-gcc

# get the signing tools
git clone --depth 1 https://git.linaro.org/landing-teams/working/qualcomm/signlk.git

# Build all needed flavors of LK
git clone --depth 1 ${LK_GIT_LINARO} -b ${LK_GIT_REL_SD_RESCUE} lk_sdrescue
git clone --depth 1 ${LK_GIT_LINARO} -b ${LK_GIT_REL_UFS_BOOT} lk_ufs_boot

for lk in lk_sdrescue lk_ufs_boot; do
    echo "Building LK in : $lk"
    cd $lk
    git log -1
    make -j4 msm8996 EMMC_BOOT=1 VERIFIED_BOOT=1 TOOLCHAIN_PREFIX=${WORKSPACE}/android-gcc/bin/arm-eabi-
    mv build-msm8996/emmc_appsboot.mbn build-msm8996/emmc_appsboot_unsigned.mbn
    ../signlk/signlk.sh -i=./build-msm8996/emmc_appsboot_unsigned.mbn -o=./build-msm8996/emmc_appsboot.mbn -d
    cd -
done

SDCARD_RESCUE=dragonboard-820c-sdcard-rescue-${BUILD_NUMBER}
BOOTLOADER_UFS_LINUX=dragonboard-820c-bootloader-ufs-linux-${BUILD_NUMBER}
BOOTLOADER_UFS_AOSP=dragonboard-820c-bootloader-ufs-aosp-${BUILD_NUMBER}

mkdir -p out/${SDCARD_RESCUE} out/${BOOTLOADER_UFS_LINUX} out/${BOOTLOADER_UFS_AOSP}

# get LICENSE file (for Linux BSP)
unzip -j $(basename ${QCOM_LINUX_FIRMWARE}) "*/LICENSE"
echo "${QCOM_LINUX_FIRMWARE_LICENSE_MD5}  LICENSE" > MD5
md5sum -c MD5

# Create ptable and rawprogram/patch command files
git clone --depth 1 ${QCOM_PTOOL_GIT} ptool
(cd ptool && git log -1)
(mkdir ptool/linux && cd ptool/linux && python2 ${WORKSPACE}/ptool/ptool.py -x ${WORKSPACE}/dragonboard820c/linux/partition.xml)
(mkdir ptool/aosp && cd ptool/aosp && python2 ${WORKSPACE}/ptool/ptool.py -x ${WORKSPACE}/dragonboard820c/aosp/partition.xml)

# Empty/zero boot image file to clear boot partition
dd if=/dev/zero of=boot-erase.img bs=1024 count=1024

# bootloader_ufs_linux
cp -a LICENSE \
   dragonboard820c/linux/flashall \
   lk_ufs_boot/build-msm8996/emmc_appsboot.mbn \
   bootloaders-linux/{cmnlib64.mbn,cmnlib.mbn,devcfg.mbn,hyp.mbn,keymaster.mbn,pmic.elf,rpm.mbn,sbc_1.0_8096.bin,tz.mbn,xbl.elf} \
   bootloaders-linux/prog_ufs_firehose_8996_ddr.elf \
   ptool/linux/{rawprogram,patch}?.xml \
   ptool/linux/gpt_{main,backup,both}?.bin \
   ptool/linux/zeros_*.bin \
   dragonboard820c/ufs-provision_toshiba.xml \
   boot-erase.img \
   out/${BOOTLOADER_UFS_LINUX}

# bootloader_ufs_aosp
cp -a LICENSE \
   dragonboard820c/aosp/flashall \
   lk_ufs_boot/build-msm8996/emmc_appsboot.mbn \
   bootloaders-linux/{cmnlib64.mbn,cmnlib.mbn,devcfg.mbn,hyp.mbn,keymaster.mbn,pmic.elf,rpm.mbn,sbc_1.0_8096.bin,tz.mbn,xbl.elf} \
   bootloaders-linux/prog_ufs_firehose_8996_ddr.elf \
   ptool/aosp/{rawprogram,patch}?.xml \
   ptool/aosp/gpt_{main,backup,both}?.bin \
   ptool/aosp/zeros_*.bin \
   dragonboard820c/ufs-provision_toshiba.xml \
   boot-erase.img \
   out/${BOOTLOADER_UFS_AOSP}

# sdcard_rescue
cp -a LICENSE out/${SDCARD_RESCUE}
sudo ./mksdcard -x -p dragonboard820c/sdrescue.txt \
     -o out/${SDCARD_RESCUE}/${SDCARD_RESCUE}.img \
     -i lk_sdrescue/build-msm8996/ \
     -i bootloaders-sdboot/ \
     -i bootloaders-linux/

# Final preparation of archives for publishing
mkdir ${WORKSPACE}/out2
for i in ${SDCARD_RESCUE} \
         ${BOOTLOADER_UFS_LINUX} \
         ${BOOTLOADER_UFS_AOSP} ; do
    (cd out/$i && md5sum * > MD5SUMS.txt)
    (cd out && zip -r ${WORKSPACE}/out2/$i.zip $i)
done

# Create MD5SUMS file
(cd ${WORKSPACE}/out2 && md5sum * > MD5SUMS.txt)

# Build information
cat > ${WORKSPACE}/out2/HEADER.textile << EOF

h4. Bootloaders for Dragonboard 820c

This page provides the bootloaders packages for the Dragonboard 820c. There are several packages:
* *sdcard_rescue* : an SD card image that can be used to boot from SD card, and rescue a board when the onboard UFS is empty or corrupted
* *bootloader_ufs_linux* : includes the bootloaders and partition table (GPT) used when booting Linux images from onboard UFS
* *bootloader_ufs_aosp* : includes the bootloaders and partition table (GPT) used when booting AOSP images from onboard UFS

Build description:
* Build URL: "$BUILD_URL":$BUILD_URL
* Proprietary bootloaders are not published yet, and not available widely
* Linux proprietary bootloaders package: $(basename ${QCOM_LINUX_FIRMWARE})
* Little Kernel (LK) source code:
** "SD rescue boot":$LK_GIT_LINARO/log/?h=$(echo $LK_GIT_REL_SD_RESCUE | sed -e 's/+/\%2b/g')
** "UFS Linux boot":$LK_GIT_LINARO/log/?h=$(echo $LK_GIT_REL_UFS_BOOT | sed -e 's/+/\%2b/g')
* Tools version: "$GIT_COMMIT":$GIT_URL/commit/?id=$GIT_COMMIT
* Partition table:
** "Linux":$GIT_URL/tree/dragonboard820c/linux/partition.xml?id=$GIT_COMMIT
** "AOSP":$GIT_URL/tree/dragonboard820c/aosp/partition.xml?id=$GIT_COMMIT
EOF

# 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
# TODO CLO: Remove condition once linaro-cp.py is able to push to CLO
if [[ -z ${CLO_MIGRATION} ]]; then
    time python3 ${HOME}/bin/linaro-cp.py \
     --server ${PUBLISH_SERVER} \
     --link-latest \
     ${WORKSPACE}/out2 ${PUB_DEST}
fi