← Back
OP-TEE Β· Qualcomm Platforms

Quick Start

Initialize the workspace with repo, sync all source trees, and build the toolchains and components. Complete the common setup below, then pick a bootflow to build the images and flash the board.

πŸ“± Best viewed on a desktop. The command blocks are hidden on small screens β€” open this Quick Start on a larger display to copy the commands.
Common setup Β· every bootflow

Get the sources and build the stack

These three steps are shared by every bootflow. Do them once, then pick a bootflow below for the flow-specific image build and flashing.

1 Initialize the workspace β€” Qualcomm SA8775P / QCS9075 EVK
# create the sandbox and pull the manifest
mkdir sandbox.lemans && cd sandbox.lemans
repo init -u https://github.com/ldts/qcom-manifest -m lemans.xml
2 Sync all source trees
repo sync -j4 --no-clone-bundle
3 Build toolchains and all components
cd build
make -j8 toolchains
make -j8 all         # linux-firmware is fetched automatically by buildroot
Local or remote flash
4 Build the two flashable images β€” no Yocto needed
make bootimage       # tz.mbn + uefi.elf β€” the signed boot chain
make efi             # efi.bin β€” kernel UKI + Buildroot rootfs
Flashing Β· on the build machine

Flash over USB β€” board plugged into this host, qdl on PATH

The board is in EDL (9008) mode on the same Linux host you built on, with qdl on the PATH. These targets are flash-only β€” the images were already built in step 4 β€” so they just push bits to the device over USB.

For the full Linux procedure β€” installing qdl, putting the board into EDL mode, and provisioning the UFS β€” follow Qualcomm's official Flash over QLI guide.

First flash β€” full boot chain + kernel
# fetch the Qualcomm boot-chain blobs the flash targets need
# (xbl, aop, cpucp, cdt, GPT + rawprogram XMLs) β€” no Yocto build needed
make fetch-blobs

# flash the full boot chain (LUNs 1–5) once, then the kernel (LUN 0)
make flash-loader
make flash-kernel
Kernel-only iteration β€” afterwards
# reflash just efi.bin β€” no loader re-flash needed
make flash-kernel
Flashing Β· from a separate machine

Package for off-server flashing β€” board not on the build server

If the EVK lives on a different machine β€” typically a Windows box running Qualcomm's PCATApp or QFIL β€” the build server can't reach it over USB. Instead, package the images into a single self-contained directory here, copy it across, and flash from there. The edl-* targets assemble the package but flash nothing, so no device needs to be connected while building. File lookup mirrors the flash targets: input/ β†’ Yocto deploy dir β†’ blobs/, so make fetch-blobs is enough to populate a package.

edl-package β€” full-system package (all 6 LUNs)
# build the images (steps 3–4) and fetch the boot-chain blobs first
make fetch-blobs

# assemble everything PCATApp/QFIL needs into one flat directory:
#   prog_firehose_ddr.elf, all rawprogram*/patch* XMLs, GPT bins,
#   firmware MBNs/ELFs, tz.mbn, uefi.elf, efi.bin, qupv3fw.elf
make edl-package     # output: lemans/output/edl-package/

# the target pre-selects the safe XML variants (originals kept as
# *.xml.backup): rawprogram4 with qupfw_a/b populated (avoids GENI
# SE boot storms) and rawprogram0 with rootfs.img stripped out.
edl-bootloader β€” bootloaders only (LUN1–4), fast re-flash
# only XBL, CDT, tz.mbn, uefi.elf + supporting FW β€” no efi.bin/rootfs.
# the path to take when only OP-TEE / U-Boot changed. OP-TEE is built
# with full debug logging (LOG_LEVEL=4) for this package, then the
# quiet production build is restored so lemans/output/ stays clean.
make edl-bootloader  # output: lemans/output/edl-bootloader/
On the Windows machine β€” PCATApp / QFIL
# copy the whole directory across (scp, USB stick, share, …)
scp -r lemans/output/edl-package user@winbox:C:/edl-package

# put the board in EDL (9008) mode, then in the tool:
#   Programmer:  prog_firehose_ddr.elf
#   XMLs:        rawprogram0.xml … rawprogram5.xml + patch0.xml (full)
#                rawprogram1–4.xml + patch1–4.xml   (bootloader-only)
Recovery Β· partitions broken by a bad flash

Re-provision the UFS β€” last resort after a firmware upgrade gone wrong

⚠️ This reconfigures the UFS LUN layout and destroys every byte on the device β€” rootfs, firmware, GPT, all of it. It is not part of a routine flash. Run it only when a firmware upgrade or flash gone wrong has broken the on-device partition (LUN) layout, so that a normal make flash-loader / make flash-kernel no longer succeeds. After it completes, re-flash from scratch with make flash-loader && make flash-kernel.

The board must be in EDL (9008) mode with qdl on the PATH. The target downloads the CodeLinaro provision.zip, loads the DDR firehose programmer (resolved just like the flash targets: input/ β†’ Yocto deploy dir β†’ blobs/), and applies a provision layout over qdl --storage ufs. See Qualcomm's Flash over QLI guide for the full UFS provisioning procedure.

flash-ufs-provision β€” rewrite the LUN layout
# default layout grows HLOS LUN 0 (provision_1_2.xml) β€” LUN 0 is
# where this build writes efi.bin + rootfs.img
make flash-ufs-provision

# then rebuild the device from a clean slate
make flash-loader
make flash-kernel
Pick a different layout
# provision_1_1.xml grows User LUN 7 instead; larger NHLOS LUNs
make flash-ufs-provision UFS_PROVISION_XML=provision_1_1.xml

Iterate on a single component

After the first full build, you rarely rebuild everything. Edit one tree (OP-TEE OS, TF-A, U-Boot or Linux), rebuild just that component, repackage, and reflash. Builds are incremental β€” only the changed source is recompiled β€” so the edit β†’ flash loop is seconds to a couple of minutes, not the hour a full build takes.

Boot-chain change β€” OP-TEE OS, TF-A or U-Boot
# rebuild just the component you touched (incremental β€” seconds–minutes)
make optee-os        # or:  make u-boot  /  make spl
make bootimage       # repackage the signed boot image (tz.mbn + uefi.elf)
make flash-loader    # reflash the boot chain
Kernel change β€” Linux
# rebuild the kernel (incremental β€” typically ~1–2 min)
make linux
make efi             # repackage the EFI image / UKI (efi.bin)
make flash-kernel    # reflash the kernel partition only β€” firmware untouched

Lemans: SPL is signed locally via qtestsign (open-source, no CASS required) β€” signing runs automatically as part of make bootimage / make spl.

make fetch-blobs pulls the Qualcomm boot binaries and CDT directly from the public Qualcomm / CodeLinaro URLs, so a full Yocto BSP build is not required. The flash targets look for inputs in input/ β†’ Yocto deploy dir β†’ blobs/, so the blobs fetched in step 3 are used automatically.

Local flash only

Build & flash the stock Yocto release

Build and flash the released, unmodified Qualcomm BSP as a known-good reference β€” nothing from the manifest is substituted. This flow flashes over USB from the build host only; there is no off-server package for it. Not required for a normal build β€” the Buildroot flow already gives you a bootable image.

Build the Yocto stack
# clones meta-qcom and builds via kas β€” several hours.
# flash-yocto reads the release straight from the Yocto deploy
# dir, so no manual copy into lemans/output/ is needed.
make yocto
Flash the full release (all 6 LUNs)
# flashes the pristine BSP: bootloader, firmware, efi.bin + rootfs.img.
make flash-yocto

# NOTE: this overwrites whatever flash-loader / flash-kernel installed.
# Re-run those afterward to restore your custom build.
Local flash only

Run your kernel on the on-disk Yocto rootfs

Wrap the locally-built kernel in a UKI that boots root=PARTLABEL=rootfs against the already-flashed Yocto rootfs, instead of the Buildroot initramfs. Only the efi.bin is reflashed β€” the rootfs is untouched.

Prerequisite: run the Yocto flow first β€” make efi-kernel-only errors out unless the Yocto efi.bin exists and the Yocto rootfs is flashed on the board.

Build the kernel-only UKI and reflash it
# wraps the freshly-built kernel in an efi.bin that boots the
# on-disk Yocto rootfs (root=PARTLABEL=rootfs).
make efi-kernel-only
make flash-kernel    # reflash efi.bin only β€” Yocto rootfs untouched

make efi-kernel-only builds the kernel for you β€” it depends on make linux, which generates .config from make linux-defconfig automatically on the first build and rebuilds incrementally afterwards. Run make linux-defconfig yourself only to clean and refresh the kernel config (it runs mrproper, forcing a full rebuild) β€” e.g. after bumping the kernel or changing enabled options.

Run make help in build/ for the full target list.