Skip to content

Commit 9f1288c

Browse files
committed
debos: flash: Use qcom-ptool for RB1
Signed-off-by: Loïc Minier <[email protected]>
1 parent 4ed6011 commit 9f1288c

File tree

1 file changed

+57
-17
lines changed

1 file changed

+57
-17
lines changed

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

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,70 @@ actions:
5555
# unpack rescue image
5656
unzip -j "${ROOTDIR}/../qrb2210-rb1_rescue-image.zip" \
5757
-d build/qrb2210-rb1_rescue-image
58-
# TODO: on RB1, we don't generate partition files with ptool since its
59-
# partitions.conf does not have entries for data files from the rescue
60-
# image, while the rescue image defines useful partitions such as the ESP
58+
# generate partition files
59+
mkdir -v build/qrb2210-rb1_partitions
60+
(
61+
cd build/qrb2210-rb1_partitions
62+
conf="${QCOM_PTOOL}/platforms/qrb2210-rb1/partitions.conf"
63+
"${QCOM_PTOOL}/gen_partition.py" -i "$conf" \
64+
-o ptool-partitions.xml
65+
# partitions.conf sets --type=emmc, nand or ufs
66+
if grep -F '^--disk --type=ufs ' "${conf}"; then
67+
touch flash-ufs
68+
elif grep -F '^--disk --type=emmc ' "${conf}"; then
69+
touch flash-emmc
70+
fi
71+
"${QCOM_PTOOL}/ptool.py" -x ptool-partitions.xml
72+
)
73+
6174
flash_dir="${ARTIFACTDIR}/flash_rb1"
6275
rm -rf "${flash_dir}"
6376
mkdir -v "${flash_dir}"
64-
# copy rescue image files
65-
cp --preserve=mode,timestamps -v build/qrb2210-rb1_rescue-image/* \
77+
# copy board partition files
78+
cp --preserve=mode,timestamps -v build/qrb2210-rb1_partitions/* \
6679
"${flash_dir}"
67-
# copy RB1 U-Boot binary to u-boot-abootimg.img
80+
# remove BLANK_GPT and WIPE_PARTITIONS files as it's common for people
81+
# to run "qdl rawprogram*.xml", mistakingly including these; perhaps
82+
# ptool should have a flag not to generate these; note that there are
83+
# wipe_rawprogram*.xml files still
84+
rm -v "${flash_dir}"/rawprogram*_BLANK_GPT.xml
85+
rm -v "${flash_dir}"/rawprogram*_WIPE_PARTITIONS.xml
86+
# copy board boot binaries; these shouldn't ship partition files, but
87+
# make sure not to accidentally clobber any such file
88+
find build/qrb2210-rb1_rescue-image \
89+
-not -name 'gpt_*' \
90+
-not -name 'patch*.xml' \
91+
-not -name 'rawprogram*.xml' \
92+
-not -name 'wipe*.xml' \
93+
-not -name 'zeros_*' \
94+
\( \
95+
-name LICENSE \
96+
-or -name Qualcomm-Technologies-Inc.-Proprietary \
97+
-or -name 'prog_*' \
98+
-or -name '*.bin' \
99+
-or -name '*.elf' \
100+
-or -name '*.fv' \
101+
-or -name '*.mbn' \
102+
\) \
103+
-exec cp --preserve=mode,timestamps -v '{}' "${flash_dir}" \;
104+
# copy RB1 U-Boot binary to boot.img;
105+
# qcom-ptool/platforms/*/partitions.conf uses filename=boot.img
106+
# boot_a and boot_b partitions
68107
cp --preserve=mode,timestamps -v "${ARTIFACTDIR}/{{- .u_boot_rb1 -}}" \
69-
"${flash_dir}/rb1-boot.img"
108+
"${flash_dir}/boot.img"
70109

71-
# update flashing file for RB1 U-Boot; in the rescue image, this
72-
# partition is blanked with boot-erase.img
73-
sed -i '/label="boot_a"/s/filename="[^"]*"/filename="rb1-boot.img"/' "${flash_dir}"/rawprogram*.xml
74-
75-
# update flashing files for ESP image; in the rescue image, this
76-
# partition is blanked with boot-erase.img
77-
sed -i '/label="esp"/s#filename="[^"]*"#filename="../disk-sdcard.img1"#' "${flash_dir}"/rawprogram*.xml
110+
# update flashing files for ESP image;
111+
# qcom-ptool/platforms/*/partitions.conf uses filename=efi.bin for the
112+
# ESP partition on EFI capable platforms
113+
sed -i '/label="efi"/s#filename="[^"]*"#filename="../disk-sdcard.img1"#' \
114+
"${flash_dir}"/rawprogram*.xml
78115

79-
# update flashing files for rootfs image;; in the rescue image, this
80-
# partition is not provisioned
81-
sed -i '/label="rootfs"/s#filename="[^"]*"#filename="../disk-sdcard.img2"#' "${flash_dir}"/rawprogram*.xml
116+
# update flashing files for rootfs image;
117+
# qcom-ptool/platforms/*/partitions.conf uses filename=rootfs.img for the
118+
# rootfs partition
119+
sed -i \
120+
'/label="rootfs"/s#filename="[^"]*"#filename="../disk-sdcard.img2"#' \
121+
"${flash_dir}"/rawprogram*.xml
82122

83123
# TODO: there is currently no dtb.bin alike system with the RB1 firmware
84124

0 commit comments

Comments
 (0)