Qualcomm Linux 1.8 Build Guide (previous release)
Qualcomm Linux 1.8 Installation
This version supports a wide range of security features that its newer release (2.0-rc) does not, thus being the optimal release to enable Secure Boot, UEFI Secure Boot, Disk Cryptography, Secure filesystem, along with other tools. The wiki will cover how to sync and build firmware and the correspondent BSP image with the added extras such as the QTEE and SELinux firmware for the Dragonwing IQ-9075. This guide follows the Qualcomm's Official Build Documentation.[1]
Host Requirements
These are the required tools and configuration to build the Qualcomm Linux 1.8 image for the Dragonwing IQ-9075:
- Configuration:
- x86 machine
- Quad-core CPU
- 300 GB free disk space (swap partition > 32GB)
- 16 GB RAM
- Ubuntu 22.04
- Tools:
- Git 1.8.3.1 or later versions
- Tar 1.28 or later versions
- Python 3.10.2 or later versions
- GCC 8.0 or later versions
- GNU Make 4.0 or later versions
Install QSC CLI
You will need a Qualcomm email ID and PAT (Personal Access Token). You can register in the Qualcomm Support page.
1. Install curl (if not installed already):
sudo apt install curl
2. Download the Debian package for qsc-cli:
cd <workspace-path> curl -L https://softwarecenter.qualcomm.com/api/download/software/tools/Qualcomm_Software_Center/Linux/Debian/latest.deb -o qsc_installer.deb
- For x86
3. Install the qsc-cli Debian package:
sudo apt update sudo apt install ./qsc_installer.deb
4. Sign in to qsc-cli using your registered email ID:
qsc-cli login -u <email-ID>
Set up the Ubuntu Host Computer
1. Install the required packages:
sudo apt update sudo apt install repo gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm python3-subunit mesa-common-dev zstd liblz4-tool locales tar python-is-python3 file libxml-opml-simplegen-perl vim whiptail g++ libacl1 sudo apt-get install lib32stdc++6 libncurses5 checkinstall libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev curl
2. Generate the PAT (Personal Access Token) for your Qualcomm email ID:
qsc-cli login -u <email-ID> qsc-cli show-access-token
This token will be valid for two weeks. After that, it will expire and you will need to generate a new PAT.
3. If the ~/.netrc file does not exist, create it:
touch ~/.netrc
4. Add the following content to the ~/.netrc file:
machine chipmaster2.qti.qualcomm.com login <your Qualcomm email id> password <your PAT token> machine qpm-git.qualcomm.com login <your Qualcomm email id> password <your PAT token>
5. Set up locales if they have not been set up already:
sudo locale-gen en_US.UTF-8 sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8
6. Verify your git configuration:
git config --get user.email git config --get user.name
- 6.1 If your git credentials are not set, run the following commands:
git config --global user.email <Your email ID> git config --global user.name <"Your Name">
7. Update git configurations to fetch large size repositories and follow remote redirects from http-alternates files or alternates:
git config --global http.postBuffer 1048576000 git config --global http.maxRequestBuffer 1048576000 git config --global http.lowSpeedLimit 0 git config --global http.lowSpeedTime 999999 git config --global http.https://chipmaster2.qti.qualcomm.com.followRedirects true git config --global http.https://qpm-git.qualcomm.com.followRedirects true
8. Set up Python 3.10.2. Skip this step if you already have Python 3.10.2 or later versions:
python --version cd wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz tar -xvf Python-3.10.2.tgz cd Python-3.10.2 # Sudo may be necessary to access the /opt directory ./configure --prefix=/opt/python3 --enable-optimizations make make install ln -s /opt/python3/bin/python3 /opt/python3/bin/python export PATH=/opt/python3/bin:$PATH export PYTHONPATH=/opt/python3/lib:$PYTHONPATH
Build with Firmware Sources
The following guide will download and build sources for a firmware image without modem and GPS, thus the qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk repository will be used. For more information on mapping firmware distributions to git repositories, visit Qualcomm's official documentation. The full list of available firmware images is:
| Firmware Distribution | Git Command | Directory Name |
|---|---|---|
| AP|Standard|OEM|NoModem | git clone -b <firmware_release_tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem.git
|
qualcomm-linux-spf-1-0_ap_standard_oem_nomodem
|
| AP|Standard|OEM|NM_QIMPSDK | git clone -b <firmware_release_tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk.git
|
qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk
|
| AP|Standard|OEM|NM_QIRPSDK | git clone -b <firmware_release_tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qirpsdk.git
|
qualcomm-linux-spf-1-0_ap_standard_oem_nm-qirpsdk
|
| AP|Standard|OEM | git clone -b <firmware_release_tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem.git
|
qualcomm-linux-spf-1-0_ap_standard_oem
|
| AP|Standard|OEM|QIMPSDK | git clone -b <firmware_release_tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_qimpsdk.git
|
qualcomm-linux-spf-1-0_ap_standard_oem_qimpsdk
|
| AMSS|Standard|OEM | git clone -b <firmware_release_tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_amss_standard_oem.git
|
qualcomm-linux-spf-1-0_amss_standard_oem
|
| AMSS|Standard|OEM|QIMPSDK | git clone -b <firmware_release_tag> --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_amss_standard_oem_qimpsdk.git
|
qualcomm-linux-spf-1-0_amss_standard_oem_qimpsdk
|
Sync Firmware
Clone the desired repository for your selected firmware source components:
export FIRMWARE_ROOT=$HOME/firmware-dir/ mkdir -p $FIRMWARE_ROOT cd $FIRMWARE_ROOT git clone -b r1.0_00120.0 --depth 1 https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk.git
The r1.0_00120.0 value corresponds to the firmware release tag. For the latest release tags available, see the Release notes documentation.
Build Firmware
1. Install the libffi6 package using the following commands:
curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb sudo dpkg -i libffi6_3.2.1-8_amd64.deb
2. Install LLVM for AOP, Qualcomm TEE, and boot compilation:
cd $FIRMWARE_ROOT mkdir llvm qsc-cli login #If you haven't log in yet with your Qualcomm email ID and PAT qsc-cli tool activate-license --name sdllvm_arm #LLVM requirement for boot compilation is 14.0.4. Also, the permission granting may need to be run with the sudo option. qsc-cli tool install --name sdllvm_arm --required-version 14.0.4 --path $FIRMWARE_ROOT/llvm/14.0.4 chmod -R 777 $FIRMWARE_ROOT/llvm/14.0.4 #LLVM requirement for Qualcomm TEE compilation is 16.0.7. Also, the permission granting may need to be run with the sudo option. qsc-cli tool install --name sdllvm_arm --required-version 16.0.7 --path $FIRMWARE_ROOT/llvm/16.0.7 chmod -R 777 $FIRMWARE_ROOT/llvm/16.0.7
3. Export the SECTOOLS variable paths:
export SECTOOLS=$FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS9100.LE.1.0/common/sectoolsv2/ext/Linux/sectools export SECTOOLS_DIR=$FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS9100.LE.1.0/common/sectoolsv2/ext/Linux
4. Install Hexagon (compiler tool) in your desired path:
export HEXAGON_ROOT=<desired-path> mkdir -p $HEXAGON_ROOT qsc-cli tool extract --name hexagon8.6 --required-version 8.6.05.2 --path $HEXAGON_ROOT/8.6.05
Build DSP
1. Install the device tree compiler:
sudo apt-get install device-tree-compiler export DTC_PATH=/usr/bin
2. Install dependencies:
pip install ruamel.yaml==0.17.17 pip install dtschema==2021.10 pip install jsonschema==4.0.0
3. Go to the following directory:
cd $FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/DSP.AT.1.0.1/dsp_proc/build/ms
4. Clean the current build:
python ./build_variant.py lemans.adsp.prod --clean python ./build_variant.py lemans.cdsp0.prod --clean python ./build_variant.py lemans.cdsp1.prod --clean python ./build_variant.py lemans.gpdsp0.prod --clean python ./build_variant.py lemans.gpdsp1.prod --clean
5. Build the image:
python ./build_variant.py lemans.adsp.prod && python ./build_variant.py lemans.cdsp0.prod && python ./build_variant.py lemans.cdsp1.prod && python ./build_variant.py lemans.gpdsp0.prod && python ./build_variant.py lemans.gpdsp1.prod
Build Boot
For this image, the LLVM compiler will need the 14.0.4 version:
export LLVM=$FIRMWARE_ROOT/llvm/14.0.4/
1. Install the device tree compiler:
sudo apt-get install device-tree-compiler export DTC=/usr/bin
2. Go to the following directory:
cd $FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/BOOT.MXF.1.0.c1/
3. Install the dependencies:
python -m pip install -r boot_images/boot_tools/dtschema_tools/oss/requirements.txt pip install json-schema-for-humans
4. Clean the current build:
python -u boot_images/boot_tools/buildex.py -t lemans,QcomToolsPkg -v LAA -r RELEASE --build_flags=cleanall
5. Build the boot image:
python -u boot_images/boot_tools/buildex.py -t lemans,QcomToolsPkg -v LAA -r RELEASE
Build the Qualcomm TEE firmware
1. Update the LLVM sources for version 16.0.7, needed for compiling the Qualcomm TEE firmware:
cd $FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/TZ.XF.5.29.1/trustzone_images/build/ms/ sed -i "s|/pkg/qct/software/llvm/release/arm/16.0.7/|$FIRMWARE_ROOT/llvm/16.0.7/|g" build_config_deploy_lemans.xml # The 'sed' command will edit all the occurrences of /pkg/qct/software/llvm/release/arm/16.0.7/ to $FIRMWARE_ROOT/llvm/16.0.7/, your compiler tool path.
2. Clean the current build:
python build_all.py -b TZ.XF.5.0 CHIPSET=lemans --cfg=build_config_deploy_lemans.xml --clean
3. Build the Qualcomm TEE image:
cd $FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/TZ.XF.5.29.1/trustzone_images/build/ms/ python build_all.py -b TZ.XF.5.0 CHIPSET=lemans --cfg=build_config_deploy_lemans.xml
Build AOP firmware
For this image, the LLVM compiler will need the 14.0.4 version.
1. Go to the following directory:
cd $FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/AOP.HO.3.6.1/aop_proc/build/
2. Clean the current build:
./build_lemansau.sh -c -l $FIRMWARE_ROOT/llvm/14.0.4/
3. Build the AOP image:
./build_lemansau.sh -l $FIRMWARE_ROOT/llvm/14.0.4/
Other Extra Firmware Images
Firmware images such as the following are released as a binary and do not required build compilation:
- CPUCP Firmware
- CPUSYS.VM Firmware
- BTFM Firmware
- WLAN Firmware
Integrate Individual Components in a Single Firmware Image
Create an integrated firmware binary from the individual components that were compiled:
cd $FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS9100.LE.1.0/common/build python build.py --imf
The firmware build will generate the following zip files in the $FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS9100.LE.1.0/common/build/ufs/bin if the compilation succeed:
QCS9100_bootbinaries.zipQCS9100_dspso.zipQCS9100_fw.zip
Build a BSP Image with Extras
The BSP image build has the software components for the Qualcomm device support and software features applicable to the Qualcomm SoCs. This build includes a reference distribution configuration for the Qualcomm development kits. The meta-qcom-extras layer enables source compilation of select components that otherwise would be present as binaries in the meta-qcom-hwe layer.
1. Download Qualcomm Yocto and the supporting layers with extras:
export WORK_DIR=<desired-path> mkdir -p $WORK_DIR cd $WORK_DIR repo init -u https://github.com/quic-yocto/qcom-manifest -b qcom-linux-scarthgap -m qcom-6.6.119-QLI.1.8-Ver.1.1.xml repo sync git clone https://qpm-git.qualcomm.com/home2/git/qualcomm/qualcomm-linux-spf-1-0_hlos_oem_metadata.git -b r1.0_00121.0 --depth 1 mkdir -p layers/meta-qcom-extras cp -rf qualcomm-linux-spf-1-0_hlos_oem_metadata/QCS9100.LE.1.0/common/config/meta-qcom-extras/* layers/meta-qcom-extras/
2. Set up Yocto build:
export EXTRALAYERS="meta-qcom-extras"
3. Set up the CUST_ID variable. This variable must be set to 213195 for no-modem based distributions, otherwise, it mus be set based in the "Customer ID" of your Qualcomm account. To find "Customer ID", sign in to your account at the Qualcomm page, click the Profile icon, select Account Settings, and then scroll down to the Company Information section. Export the CUST_ID using the following command:
export CUST_ID=213195
4. Set the environment variable to pick up the prebuilts. The firmware recipe is compiled when the Yocto build is initiated and it expects the firmware path. Since there has been firmware prebuilts generated in the previous sections, the directory must be set accordingly:
export FWZIP_PATH="$FIRMWARE_ROOT/qualcomm-linux-spf-1-0_ap_standard_oem_nm-qimpsdk/QCS9100.LE.1.0/common/build/ufs/bin"
5. Set up the build environment:
MACHINE=qcs9075-iq-9075-evk DISTRO=qcom-wayland QCOM_SELECTED_BSP=custom source setup-environment
6. Verify the available images:
bitbake-layers show-recipes "*image*"
7. Define the image you want to compile:
IMAGE=qcom-minimal-image
8. Compile the Yocto build:
bitbake $IMAGE
9. After a successful build, check the system.img file:
cd $WORK_DIR/build-qcom-wayland/tmp-glibc/deploy/images/qcs9075-iq-9075-evk/$IMAGE ls -al system.img
You can proceed flashing the software image following the Flashing a Yocto Image page.
References