Skip to content

Commit c4836d4

Browse files
authored
Merge pull request #59 from lool/rb1-use-ptool
Use qcom-ptool for RB1
2 parents c271451 + 584beaa commit c4836d4

File tree

1 file changed

+69
-21
lines changed

1 file changed

+69
-21
lines changed

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

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
{{- $build_qcm6490 := or .build_qcm6490 "true" }}
12
{{- $build_rb1 := "false" -}}
23
{{- if .u_boot_rb1 -}}
3-
{{- $build_rb1 := "true" }}
4+
{{- $build_rb1 = "true" }}
45
{{- end -}}
56

67
architecture: arm64
@@ -13,7 +14,7 @@ actions:
1314
filename: qcom-ptool.tar.gz
1415
unpack: true
1516

16-
{{- if .u_boot_rb1 }}
17+
{{- if eq $build_rb1 "true" }}
1718
# TODO: consider switching to https://releases.linaro.org/96boards/rb1/qualcomm/firmware/RB1_firmware_20231124-v4.zip instead
1819
- action: download
1920
description: Download RB1 rescue image
@@ -22,17 +23,21 @@ actions:
2223
filename: qrb2210-rb1_rescue-image.zip
2324
{{- end }}
2425

26+
{{- if eq $build_qcm6490 "true" }}
2527
- action: download
2628
description: Download QCM6490 boot binaries
2729
url: https://softwarecenter.qualcomm.com/download/software/chip/qualcomm_linux-spf-1-0/qualcomm-linux-spf-1-0_test_device_public/r1.0_00075.0/qcm6490-le-1-0/common/build/ufs/bin/QCM6490_bootbinaries.zip
2830
name: qcm6490_boot-binaries
2931
filename: qcm6490_boot-binaries.zip
32+
{{- end }}
3033

34+
{{- if eq $build_qcm6490 "true" }}
3135
- action: download
3236
description: Download RB3 Gen2 Vision Kit CDT
3337
url: https://artifacts.codelinaro.org/artifactory/codelinaro-le/Qualcomm_Linux/QCS6490/cdt/rb3gen2-vision-kit.zip
3438
name: rb3gen2-vision-kit_cdt
3539
filename: rb3gen2-vision-kit_cdt.zip
40+
{{- end }}
3641

3742
- action: run
3843
description: Generate flash directories for eMMC and UFS boards
@@ -45,35 +50,75 @@ actions:
4550
# path to unpacked qcom-ptool tarball
4651
QCOM_PTOOL="${ROOTDIR}/../qcom-ptool.tar.gz.d/qcom-ptool-main"
4752
48-
{{- if .u_boot_rb1 }}
53+
{{- if eq $build_rb1 "true" }}
4954
### board: qrb2210-rb1
5055
# unpack rescue image
5156
unzip -j "${ROOTDIR}/../qrb2210-rb1_rescue-image.zip" \
5257
-d build/qrb2210-rb1_rescue-image
53-
# TODO: on RB1, we don't generate partition files with ptool since its
54-
# partitions.conf does not have entries for data files from the rescue
55-
# 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+
5674
flash_dir="${ARTIFACTDIR}/flash_rb1"
5775
rm -rf "${flash_dir}"
5876
mkdir -v "${flash_dir}"
59-
# copy rescue image files
60-
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/* \
6179
"${flash_dir}"
62-
# 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
63107
cp --preserve=mode,timestamps -v "${ARTIFACTDIR}/{{- .u_boot_rb1 -}}" \
64-
"${flash_dir}/rb1-boot.img"
108+
"${flash_dir}/boot.img"
65109

66-
# update flashing file for RB1 U-Boot; in the rescue image, this
67-
# partition is blanked with boot-erase.img
68-
sed -i '/label="boot_a"/s/filename="[^"]*"/filename="rb1-boot.img"/' "${flash_dir}"/rawprogram*.xml
69-
70-
# update flashing files for ESP image; in the rescue image, this
71-
# partition is blanked with boot-erase.img
72-
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
73115

74-
# update flashing files for rootfs image;; in the rescue image, this
75-
# partition is not provisioned
76-
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
77122

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

@@ -82,6 +127,7 @@ actions:
82127
# rb1-bootloader-emmc-linux-47528.zip
83128
{{- end }}
84129

130+
{{- if eq $build_qcm6490 "true" }}
85131
## platform: QCM6490
86132
# unpack boot binaries
87133
unzip -j "${ROOTDIR}/../qcm6490_boot-binaries.zip" \
@@ -124,7 +170,8 @@ actions:
124170
-not -name 'wipe*.xml' \
125171
-not -name 'zeros_*' \
126172
\( \
127-
-name Qualcomm-Technologies-Inc.-Proprietary \
173+
-name LICENSE \
174+
-or -name Qualcomm-Technologies-Inc.-Proprietary \
128175
-or -name 'prog_*' \
129176
-or -name '*.bin' \
130177
-or -name '*.elf' \
@@ -178,6 +225,7 @@ actions:
178225
sed -i \
179226
'/label="rootfs"/s#filename="[^"]*"#filename="../disk-ufs.img2"#' \
180227
"${flash_dir}"/rawprogram*.xml
228+
{{- end }}
181229

182230
# cleanup
183231
rm -rf build

0 commit comments

Comments
 (0)