Skip to content

Commit 457a38b

Browse files
committed
debos: Add recipe to generate flashable images
Signed-off-by: Loïc Minier <[email protected]>
1 parent 4dfa8d4 commit 457a38b

File tree

1 file changed

+125
-0
lines changed

1 file changed

+125
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
architecture: arm64
2+
3+
actions:
4+
- action: download
5+
description: Download qcom-ptool
6+
url: https://github.com/qualcomm-linux/qcom-ptool/archive/refs/heads/main.tar.gz
7+
name: qcom-ptool
8+
filename: qcom-ptool.tar.gz
9+
unpack: true
10+
11+
- action: download
12+
description: Download QCM6490 boot binaries
13+
url: https://softwarecenter.qualcomm.com/download/software/chip/qualcomm_linux-spf-1-0/qualcomm-linux-spf-1-0_test_device_public/r1.0_00058.0/qcm6490-le-1-0/common/build/ufs/bin/QCM6490_bootbinaries.zip
14+
name: qcm6490_boot-binaries
15+
filename: qcm6490_boot-binaries.zip
16+
17+
- action: download
18+
description: Download RB3 Gen2 Vision Kit CDT
19+
url: https://artifacts.codelinaro.org/artifactory/codelinaro-le/Qualcomm_Linux/QCS6490/cdt/rb3gen2-vision-kit.zip
20+
name: rb3gen2-vision-kit_cdt
21+
filename: rb3gen2-vision-kit_cdt.zip
22+
23+
- action: run
24+
description: Generate flash directories for UFS boards
25+
chroot: false
26+
command: |
27+
set -eux
28+
# work dir that will be thrown away
29+
mkdir -v build
30+
31+
# path to unpacked qcom-ptool tarball
32+
QCOM_PTOOL="${ROOTDIR}/../qcom-ptool.tar.gz.d/qcom-ptool-main"
33+
34+
## platform: QCM6490
35+
# unpack boot binaries
36+
unzip -j "${ROOTDIR}/../qcm6490_boot-binaries.zip" \
37+
-d build/qcm6490_boot-binaries
38+
# generate partition files
39+
mkdir -v build/qcm6490_partitions
40+
(
41+
cd build/qcm6490_partitions
42+
conf="${QCOM_PTOOL}/platforms/qcm6490/partitions.conf"
43+
"${QCOM_PTOOL}/gen_partition.py" -i "$conf" \
44+
-o ptool-partitions.xml
45+
# partitions.conf sets --type=emmc, nand or ufs
46+
if grep -F '^--disk --type=ufs ' "${conf}"; then
47+
touch flash-ufs
48+
fi
49+
"${QCOM_PTOOL}/ptool.py" -x ptool-partitions.xml
50+
)
51+
52+
### board: RB3Gen2 Vision Kit
53+
flash_dir="${ARTIFACTDIR}/flash_rb3gen2-vision-kit"
54+
rm -rf "${flash_dir}"
55+
mkdir -v "${flash_dir}"
56+
# copy platform partition files
57+
cp --preserve=mode,timestamps -v build/qcm6490_partitions/* \
58+
"${flash_dir}"
59+
# copy platform boot binaries; these shouldn't ship partition files, but
60+
# make sure not to accidentally clobber any such file
61+
find build/qcm6490_boot-binaries \
62+
-not -name 'gpt_*' \
63+
-not -name 'patch*.xml' \
64+
-not -name 'rawprogram*.xml' \
65+
-not -name 'wipe*.xml' \
66+
-not -name 'zeros_*' \
67+
\( \
68+
-name Qualcomm-Technologies-Inc.-Proprietary \
69+
-or -name 'prog_*' \
70+
-or -name '*.bin' \
71+
-or -name '*.elf' \
72+
-or -name '*.fv' \
73+
-or -name '*.mbn' \
74+
\) \
75+
-exec cp --preserve=mode,timestamps -v '{}' "${flash_dir}" \;
76+
# unpack board CDT
77+
unzip -j "${ROOTDIR}/../rb3gen2-vision-kit_cdt.zip" \
78+
-d build/rb3gen2-vision-kit_cdt
79+
# copy just the CDT data; no partition or flashing files
80+
cp --preserve=mode,timestamps -v build/rb3gen2-vision-kit_cdt/cdt_vision_kit.bin \
81+
"${flash_dir}"
82+
83+
# update flashing files for CDT
84+
sed -i '/label="cdt"/s/filename=""/filename="cdt_vision_kit.bin"/' \
85+
"${flash_dir}"/rawprogram*.xml
86+
87+
# generate a dtb.bin FAT partition with just a single dtb for the current
88+
# board; long-term this should really be a set of dtbs and overlays as to
89+
# share dtb.bin across boards
90+
dtb_bin="${flash_dir}/dtb.bin"
91+
rm -f "${dtb_bin}"
92+
# dtb.bin is only used in UFS based boards at the moment and UFS uses a
93+
# 4k sector size, so pass -S 4096
94+
# in qcom-ptool/platforms/*/partitions.conf, dtb_a and _b partitions
95+
# are provisioned with 64MiB; create a 4MiB FAT that will comfortably fit
96+
# in these and hold the target device tree, which is 4096 KiB sized
97+
# blocks for mkfs.vfat's last argument
98+
mkfs.vfat -S 4096 -C "${dtb_bin}" 4096
99+
# RB3 Gen2 Vision Kit will probably have a more specific DTB (see
100+
# <[email protected]> on lore.kernel.org)
101+
# but for now use the core kit one
102+
dtb="qcom/qcs6490-rb3gen2.dtb"
103+
# extract board device tree from the root filesystem provided tarball
104+
tar -C build -xvf "${ARTIFACTDIR}/dtbs.tar.gz" "${dtb}"
105+
# copy into the FAT as combined-dtb.dtb
106+
mcopy -vmp -i "${dtb_bin}" "build/${dtb}" ::/combined-dtb.dtb
107+
108+
# (NB: flashing files already expect "dtb.bin" as a filename)
109+
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-ufs.img1"#' \
114+
"${flash_dir}"/rawprogram*.xml
115+
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-ufs.img2"#' \
121+
"${flash_dir}"/rawprogram*.xml
122+
123+
# cleanup
124+
rm -rf build
125+

0 commit comments

Comments
 (0)