|
8 | 8 | {{- end -}} |
9 | 9 | {{- $buildid := or .buildid "" }} |
10 | 10 |
|
| 11 | +{{- $target_boards := or .target_boards "all" }} |
| 12 | + |
11 | 13 | architecture: arm64 |
12 | 14 |
|
13 | 15 | actions: |
@@ -166,11 +168,52 @@ actions: |
166 | 168 | # path to unpacked qcom-ptool tarball |
167 | 169 | QCOM_PTOOL="$(ls -d "${ROOTDIR}/../qcom-ptool.tar.gz.d/qcom-ptool-"*)" |
168 | 170 |
|
| 171 | + # build a list of supported dtbs from the dtbs tarball |
| 172 | + dtbs_file="build/dtbs.txt" |
| 173 | + : >"${dtbs_file}" |
| 174 | + if [ -f "${ARTIFACTDIR}/dtbs.tar.gz" ]; then |
| 175 | + tar -tzf "${ARTIFACTDIR}/dtbs.tar.gz" --wildcards '*.dtb' \ |
| 176 | + >>"$dtbs_file" |
| 177 | + fi |
| 178 | +
|
| 179 | + # optional list of board names to build |
| 180 | + targets_file="build/targets.txt" |
| 181 | + rm -f "${targets_file}" |
| 182 | + case "{{ $target_boards }}" in |
| 183 | + all) |
| 184 | + # no override; build all possible boards (default) |
| 185 | + touch "${targets_file}" |
| 186 | +{{- range $board := $boards }} |
| 187 | + echo "{{ $board.name }}" >>"${targets_file}" |
| 188 | +{{- end }} |
| 189 | + ;; |
| 190 | + *) |
| 191 | + echo "{{ $target_boards }}" | |
| 192 | + tr ',' '\n' | |
| 193 | + sed '/^$/d' | |
| 194 | + sort -u >"${targets_file}" |
| 195 | + ;; |
| 196 | + esac |
| 197 | + |
169 | 198 | {{- range $board := $boards }} |
170 | 199 | ### board: {{ $board.name }} |
171 | 200 | ### platform: {{ $board.platform }} |
172 | 201 | ### silicon family: {{ $board.silicon_family }} |
173 | 202 |
|
| 203 | + # set skip_board if board isn't listed |
| 204 | + skip_board=false |
| 205 | + if ! grep -Fxq "{{ $board.name }}" "${targets_file}"; then |
| 206 | + skip_board=true |
| 207 | + echo "Skipping board {{ $board.name }}: not in target list" |
| 208 | + fi |
| 209 | +{{- if $board.dtb }} |
| 210 | + # set skip_board if board has a dtb and dtb isn't present |
| 211 | + if ! grep -Fxq "{{ $board.dtb }}" "${dtbs_file}"; then |
| 212 | + skip_board=true |
| 213 | + echo "Skipping board {{ $board.name }}: dtb not available" |
| 214 | + fi |
| 215 | +{{- end }} |
| 216 | + |
174 | 217 | # unpack boot binaries |
175 | 218 | mkdir -v build/{{ $board.name }}_boot-binaries |
176 | 219 | unzip "${ROOTDIR}/../{{ $board.boot_binaries_download.filename }}" \ |
@@ -264,83 +307,94 @@ actions: |
264 | 307 | "${QCOM_PTOOL}/ptool.py" -x ptool-partitions.xml |
265 | 308 | ) |
266 | 309 |
|
267 | | - # create board-specific flash directory |
268 | | - flash_dir="${ARTIFACTDIR}/flash_{{ $board.name }}" |
269 | | - rm -rf "${flash_dir}" |
270 | | - mkdir -v "${flash_dir}" |
271 | | - # copy platform partition files |
272 | | - cp --preserve=mode,timestamps -v build/ptool/{{ $board.platform }}/* \ |
273 | | - "${flash_dir}" |
274 | | - # adjust paths in contents.xml to use board-specific flash_* subdir |
275 | | - if [ -e "${flash_dir}/contents.xml" ]; then |
276 | | - # one set of backslashes for shell quoting, another one for sed |
277 | | - # parsing |
278 | | - windows_path=".\\\\flash_{{ $board.name }}\\\\" |
279 | | - linux_path="./flash_{{ $board.name }}/" |
280 | | - sed -i \ |
281 | | - -e "s:<windows_root_path>.*:<windows_root_path>${windows_path}</windows_root_path>:" \ |
282 | | - -e "s:<linux_root_path>.*:<linux_root_path>${linux_path}</linux_root_path>:" \ |
283 | | - "${flash_dir}/contents.xml" |
| 310 | + if [ "${skip_board}" = false ]; then |
| 311 | + # create board-specific flash directory |
| 312 | + flash_dir="${ARTIFACTDIR}/flash_{{ $board.name }}" |
| 313 | + rm -rf "${flash_dir}" |
| 314 | + mkdir -v "${flash_dir}" |
| 315 | + # copy platform partition files |
| 316 | + cp --preserve=mode,timestamps -v \ |
| 317 | + build/ptool/{{ $board.platform }}/* "${flash_dir}" |
| 318 | + # adjust paths in contents.xml to use board-specific flash_* subdir |
| 319 | + if [ -e "${flash_dir}/contents.xml" ]; then |
| 320 | + # one set of backslashes for shell quoting, another one for sed |
| 321 | + # parsing |
| 322 | + windows_path=".\\\\flash_{{ $board.name }}\\\\" |
| 323 | + linux_path="./flash_{{ $board.name }}/" |
| 324 | + sed -i \ |
| 325 | + -e "s:<windows_root_path>.*:<windows_root_path>${windows_path}</windows_root_path>:" \ |
| 326 | + -e "s:<linux_root_path>.*:<linux_root_path>${linux_path}</linux_root_path>:" \ |
| 327 | + "${flash_dir}/contents.xml" |
| 328 | + fi |
| 329 | + # remove BLANK_GPT and WIPE_PARTITIONS files as it's common for |
| 330 | + # people to run "qdl rawprogram*.xml", mistakingly including these; |
| 331 | + # perhaps ptool should have a flag not to generate these; note that |
| 332 | + # there are wipe_rawprogram*.xml files still |
| 333 | + rm -v "${flash_dir}"/rawprogram*_BLANK_GPT.xml |
| 334 | + rm -v "${flash_dir}"/rawprogram*_WIPE_PARTITIONS.xml |
| 335 | + # copy silicon family boot binaries; these shouldn't ship partition |
| 336 | + # files, but make sure not to accidentally clobber any such file |
| 337 | + find build/{{ $board.name }}_boot-binaries \ |
| 338 | + -not -name 'gpt_*' \ |
| 339 | + -not -name 'patch*.xml' \ |
| 340 | + -not -name 'rawprogram*.xml' \ |
| 341 | + -not -name 'wipe*.xml' \ |
| 342 | + -not -name 'zeros_*' \ |
| 343 | + \( \ |
| 344 | + -name LICENSE \ |
| 345 | + -or -name Qualcomm-Technologies-Inc.-Proprietary \ |
| 346 | + -or -name 'prog_*' \ |
| 347 | + -or -name '*.bin' \ |
| 348 | + -or -name '*.elf' \ |
| 349 | + -or -name '*.fv' \ |
| 350 | + -or -name '*.mbn' \ |
| 351 | + \) \ |
| 352 | + -exec cp --preserve=mode,timestamps -v '{}' "${flash_dir}" \; |
| 353 | + fi |
| 354 | + {{- if $board.u_boot_file }} |
| 355 | + if [ "${skip_board}" = false ]; then |
| 356 | + # copy U-Boot binary to boot.img; |
| 357 | + # qcom-ptool/platforms/*/partitions.conf uses filename=boot.img |
| 358 | + # boot_a and boot_b partitions |
| 359 | + cp --preserve=mode,timestamps -v \ |
| 360 | + "${ARTIFACTDIR}/{{ $board.u_boot_file }}" "${flash_dir}/boot.img" |
284 | 361 | fi |
285 | | - # remove BLANK_GPT and WIPE_PARTITIONS files as it's common for people |
286 | | - # to run "qdl rawprogram*.xml", mistakingly including these; perhaps |
287 | | - # ptool should have a flag not to generate these; note that there are |
288 | | - # wipe_rawprogram*.xml files still |
289 | | - rm -v "${flash_dir}"/rawprogram*_BLANK_GPT.xml |
290 | | - rm -v "${flash_dir}"/rawprogram*_WIPE_PARTITIONS.xml |
291 | | - # copy silicon family boot binaries; these shouldn't ship partition |
292 | | - # files, but make sure not to accidentally clobber any such file |
293 | | - find build/{{ $board.name }}_boot-binaries \ |
294 | | - -not -name 'gpt_*' \ |
295 | | - -not -name 'patch*.xml' \ |
296 | | - -not -name 'rawprogram*.xml' \ |
297 | | - -not -name 'wipe*.xml' \ |
298 | | - -not -name 'zeros_*' \ |
299 | | - \( \ |
300 | | - -name LICENSE \ |
301 | | - -or -name Qualcomm-Technologies-Inc.-Proprietary \ |
302 | | - -or -name 'prog_*' \ |
303 | | - -or -name '*.bin' \ |
304 | | - -or -name '*.elf' \ |
305 | | - -or -name '*.fv' \ |
306 | | - -or -name '*.mbn' \ |
307 | | - \) \ |
308 | | - -exec cp --preserve=mode,timestamps -v '{}' "${flash_dir}" \; |
309 | | - {{- if $board.u_boot_file }} |
310 | | - # copy U-Boot binary to boot.img; |
311 | | - # qcom-ptool/platforms/*/partitions.conf uses filename=boot.img |
312 | | - # boot_a and boot_b partitions |
313 | | - cp --preserve=mode,timestamps -v "${ARTIFACTDIR}/{{ $board.u_boot_file }}" \ |
314 | | - "${flash_dir}/boot.img" |
315 | | - {{- end }} |
| 362 | + {{- end }} |
316 | 363 |
|
317 | | - {{- if $board.cdt_download }} |
318 | | - # unpack board CDT |
319 | | - unzip "${ROOTDIR}/../{{ $board.cdt_download.filename }}" \ |
320 | | - -d build/{{ $board.name }}_cdt |
321 | | - # copy just the CDT data; no partition or flashing files |
322 | | - cp --preserve=mode,timestamps -v build/{{ $board.name }}_cdt/{{ $board.cdt_filename }} \ |
323 | | - "${flash_dir}" |
324 | | - {{- end }} |
| 364 | + {{- if $board.cdt_download }} |
| 365 | + if [ "${skip_board}" = false ]; then |
| 366 | + # unpack board CDT |
| 367 | + unzip "${ROOTDIR}/../{{ $board.cdt_download.filename }}" \ |
| 368 | + -d build/{{ $board.name }}_cdt |
| 369 | + # copy just the CDT data; no partition or flashing files |
| 370 | + cp --preserve=mode,timestamps -v \ |
| 371 | + build/{{ $board.name }}_cdt/{{ $board.cdt_filename }} \ |
| 372 | + "${flash_dir}" |
| 373 | + fi |
| 374 | + {{- end }} |
325 | 375 |
|
326 | | - {{- if $board.dtb }} |
327 | | - # generate a dtb.bin FAT partition with just a single dtb for the current |
328 | | - # board; long-term this should really be a set of dtbs and overlays as to |
329 | | - # share dtb.bin across boards |
330 | | - dtb_bin="${flash_dir}/dtb.bin" |
331 | | - rm -f "${dtb_bin}" |
332 | | - # dtb.bin is only used in UFS based boards at the moment and UFS uses a |
333 | | - # 4k sector size, so pass -S 4096 |
334 | | - # in qcom-ptool/platforms/*/partitions.conf, dtb_a and _b partitions |
335 | | - # are provisioned with 64MiB; create a 4MiB FAT that will comfortably fit |
336 | | - # in these and hold the target device tree, which is 4096 KiB sized |
337 | | - # blocks for mkfs.vfat's last argument |
338 | | - mkfs.vfat -S 4096 -C "${dtb_bin}" 4096 |
339 | | - # extract board device tree from the root filesystem provided tarball |
340 | | - tar -C build -xvf "${ARTIFACTDIR}/dtbs.tar.gz" "{{ $board.dtb }}" |
341 | | - # copy into the FAT as combined-dtb.dtb |
342 | | - mcopy -vmp -i "${dtb_bin}" "build/{{ $board.dtb }}" ::/combined-dtb.dtb |
343 | | - {{- end }} |
| 376 | + {{- if $board.dtb }} |
| 377 | + if [ "${skip_board}" = false ]; then |
| 378 | + # generate a dtb.bin FAT partition with just a single dtb for the |
| 379 | + # current board; long-term this should really be a set of dtbs and |
| 380 | + # overlays as to share dtb.bin across boards |
| 381 | + dtb_bin="${flash_dir}/dtb.bin" |
| 382 | + rm -f "${dtb_bin}" |
| 383 | + # dtb.bin is only used in UFS based boards at the moment and UFS |
| 384 | + # uses a 4k sector size, so pass -S 4096 in |
| 385 | + # qcom-ptool/platforms/*/partitions.conf, dtb_a and _b partitions |
| 386 | + # are provisioned with 64MiB; create a 4MiB FAT that will |
| 387 | + # comfortably fit in these and hold the target device tree, which is |
| 388 | + # 4096 KiB sized blocks for mkfs.vfat's last argument |
| 389 | + mkfs.vfat -S 4096 -C "${dtb_bin}" 4096 |
| 390 | + # extract board device tree from the root filesystem provided |
| 391 | + # tarball |
| 392 | + tar -C build -xvf "${ARTIFACTDIR}/dtbs.tar.gz" "{{ $board.dtb }}" |
| 393 | + # copy into the FAT as combined-dtb.dtb |
| 394 | + mcopy -vmp -i "${dtb_bin}" "build/{{ $board.dtb }}" \ |
| 395 | + ::/combined-dtb.dtb |
| 396 | + fi |
| 397 | + {{- end }} |
344 | 398 | {{- end }} |
345 | 399 |
|
346 | 400 | # cleanup |
|
0 commit comments