Skip to content

Commit 64079e3

Browse files
committed
refactor(debos): Reindent skip_board sections
Reindent if statements for skip_board sections. This is split out to make review easier. Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
1 parent e23c17c commit 64079e3

File tree

1 file changed

+78
-75
lines changed

1 file changed

+78
-75
lines changed

debos-recipes/qualcomm-linux-debian-flash.yaml

Lines changed: 78 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -308,90 +308,93 @@ actions:
308308
)
309309

310310
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 build/ptool/{{ $board.platform }}/* \
317-
"${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 people
330-
# to run "qdl rawprogram*.xml", mistakingly including these; perhaps
331-
# ptool should have a flag not to generate these; note that there are
332-
# 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}" \;
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}" \;
353353
fi
354-
{{- if $board.u_boot_file }}
354+
{{- if $board.u_boot_file }}
355355
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 "${ARTIFACTDIR}/{{ $board.u_boot_file }}" \
360-
"${flash_dir}/boot.img"
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"
361361
fi
362-
{{- end }}
362+
{{- end }}
363363

364-
{{- if $board.cdt_download }}
364+
{{- if $board.cdt_download }}
365365
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 build/{{ $board.name }}_cdt/{{ $board.cdt_filename }} \
371-
"${flash_dir}"
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}"
372373
fi
373-
{{- end }}
374+
{{- end }}
374375

375-
{{- if $board.dtb }}
376+
{{- if $board.dtb }}
376377
if [ "${skip_board}" = false ]; then
377-
# generate a dtb.bin FAT partition with just a single dtb for the current
378-
# board; long-term this should really be a set of dtbs and overlays as to
379-
# share dtb.bin across boards
380-
dtb_bin="${flash_dir}/dtb.bin"
381-
rm -f "${dtb_bin}"
382-
# dtb.bin is only used in UFS based boards at the moment and UFS uses a
383-
# 4k sector size, so pass -S 4096
384-
# in qcom-ptool/platforms/*/partitions.conf, dtb_a and _b partitions
385-
# are provisioned with 64MiB; create a 4MiB FAT that will comfortably fit
386-
# in these and hold the target device tree, which is 4096 KiB sized
387-
# blocks for mkfs.vfat's last argument
388-
mkfs.vfat -S 4096 -C "${dtb_bin}" 4096
389-
# extract board device tree from the root filesystem provided tarball
390-
tar -C build -xvf "${ARTIFACTDIR}/dtbs.tar.gz" "{{ $board.dtb }}"
391-
# copy into the FAT as combined-dtb.dtb
392-
mcopy -vmp -i "${dtb_bin}" "build/{{ $board.dtb }}" ::/combined-dtb.dtb
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
393396
fi
394-
{{- end }}
397+
{{- end }}
395398
{{- end }}
396399

397400
# cleanup

0 commit comments

Comments
 (0)