@@ -162,14 +162,52 @@ actions:
162162 (
163163 cd build/{{ $board.platform }}_ptool
164164 conf="${QCOM_PTOOL}/platforms/{{ $board.platform }}/partitions.conf"
165- " ${QCOM_PTOOL}/gen_partition.py" -i "$conf" \
165+ disk_type="unknown"
166+ # make a copy of partitions.conf with patched/added names for
167+ # ESP (name=efi, filename=efi.bin), rootfs (name=rootfs,
168+ # filename=rootfs.img), DTB (name=dtb_a or name=dtb_b,
169+ # filename=dtb.bin), and CDT (name=cdt, no or special
170+ # filenames)
171+ while read line; do
172+ case "$line" in
173+ " --disk " *)
174+ disk_type="$(echo "$line" | sed -n 's/.*--type=\([^ ]*\).*/\1/p')"
175+ case $disk_type in
176+ " emmc" )
177+ touch flash-emmc
178+ esp="../disk-sdcard.img1"
179+ rootfs="../disk-sdcard.img2"
180+ ;;
181+ " ufs" )
182+ touch flash-ufs
183+ esp="../disk-ufs.img1"
184+ rootfs="../disk-ufs.img2"
185+ ;;
186+ esac
187+ ;;
188+ " --partition " *)
189+ name="$(echo "$line" | sed -n 's/.*--name=\([^ ]*\).*/\1/p')"
190+ filename=""
191+ case "$name" in
192+ dtb_a|dtb_b) filename="dtb.bin";;
193+ efi) filename="$esp";;
194+ rootfs) filename="$rootfs";;
195+ {{- if $board.cdt_download }}
196+ cdt) filename={{ $board.cdt_filename }};;
197+ {{- end }}
198+ esac
199+ if [ -n "$filename" ]; then
200+ line="$(echo "$line" | sed 's/ --filename=[^ ]*//')"
201+ line="${line} --filename=${filename}"
202+ fi
203+ ;;
204+ esac
205+ echo "$line"
206+ done <"$conf" >partitions.conf
207+ # generate ptool-partitions.xml from partitions.conf
208+ " ${QCOM_PTOOL}/gen_partition.py" -i partitions.conf \
166209 -o ptool-partitions.xml
167- # partitions.conf sets --type=emmc, nand or ufs
168- if grep -F '^--disk --type=ufs ' "${conf}"; then
169- touch flash-ufs
170- elif grep -F '^--disk --type=emmc ' "${conf}"; then
171- touch flash-emmc
172- fi
210+ # generate flashing files from qcom-partitions.xml
173211 " ${QCOM_PTOOL}/ptool.py" -x ptool-partitions.xml
174212 )
175213
@@ -219,10 +257,6 @@ actions:
219257 # copy just the CDT data; no partition or flashing files
220258 cp --preserve=mode,timestamps -v build/{{ $board.name }}_cdt/{{ $board.cdt_filename }} \
221259 " ${flash_dir}"
222-
223- # update flashing files for CDT
224- sed -i '/label="cdt"/s/filename=""/filename="{{ $board.cdt_filename }}"/' \
225- " ${flash_dir}" /rawprogram*.xml
226260 {{- end }}
227261
228262 {{- if $board.dtb }}
@@ -242,21 +276,7 @@ actions:
242276 tar -C build -xvf "${ARTIFACTDIR}/dtbs.tar.gz" "{{ $board.dtb }}"
243277 # copy into the FAT as combined-dtb.dtb
244278 mcopy -vmp -i "${dtb_bin}" "build/{{ $board.dtb }}" ::/combined-dtb.dtb
245- # (NB: flashing files already expect "dtb.bin" as a filename)
246279 {{- end }}
247-
248- # update flashing files for ESP image;
249- # qcom-ptool/platforms/*/partitions.conf uses filename=efi.bin for the
250- # ESP partition on EFI capable platforms
251- sed -i '/label="efi"/s#filename="[^"]*"#filename="../disk-{{ $board.disk_image_type }}.img1"#' \
252- " ${flash_dir}" /rawprogram*.xml
253-
254- # update flashing files for rootfs image;
255- # qcom-ptool/platforms/*/partitions.conf uses filename=rootfs.img for the
256- # rootfs partition
257- sed -i \
258- ' /label="rootfs"/s#filename="[^"]*"#filename="../disk-{{ $board.disk_image_type }}.img2"#' \
259- " ${flash_dir}" /rawprogram*.xml
260280{{- end }}
261281
262282 # cleanup
0 commit comments