Thundercomm TurboX C8550 - Building Images from Source


Index






In this section we will explain the steps on how to build from source the images for the TurboX C8550 Development Kit[1]. It is assumed that you already have configured the SDK Manager. If not, please check the Configuring SDK Manager section.

Download the SDK Source Code

1. Execute the SDK Manager container:

turbox-sdkmanager-setup.sh --os-version 18.04 -u

2. Once the SDK Manager application has been configured, execute it once again with the following option:

sdkmanager --sdk_download

2.1. When asked for the product to use, select Turbox_C8550.

2.2. On the SDK branch selection, choose SDK.Turbox-QCS8550.LE.1.0.

2.3. For version options, choose turbox-c8550-le1.0-dev.release.FC.r001003.

2.4. Press Enter to download the SDK code in the default path, and then confirm by typing Yes.

2.5. Type Yes to register the SSH key.

3. Wait for the source download to finish.

Build the SDK and Image

1. Inside the SDK Manager container, run the following commands:

sudo sysctl -n -w fs.inotify.max_user_watches=542288
sudo sysctl -n -w fs.inotify.max_user_instances=8192

2. Check that the changes have been applied:

sudo sysctl fs.inotify.max_user_watches
sudo sysctl fs.inotify.max_user_instances

3. Install the required dependencies:

sudo apt install android-tools-adb jq cmake xmlstarlet binutils-dev whiptail gdb lcov libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libsqlite3-dev lzma lzma-dev tk-dev android-tools-fastboot language-pack-en-base

4. Go to the source code directory:

cd workspace/sourcecode/turbox-c8550-le1.0-dev.release.FC.r001003/

5. (OPTIONAL, only for Standalone.sdk.addon, former Intelligent SDK) Apply the following patches[2]:

  • LE.PRODUCT.2.1.r1/apps_proc/poky/meta-qti-bsp/conf/machine/kalama.conf
@@ -128,6 +128,9 @@ MACHINE_FEATURES += "qti-ab-boot qti-adsp qti-cdsp qti-camera qti-audio qti-tzlo
 # qti-location: Machine supports Location solution
 MACHINE_FEATURES += "qti-location file-based-encryption"

+#qti-tflite-delegate: Machine supports TensorFlow Lite delegate solution
+MACHINE_FEATURES += "qti-tflite-delegate"
+
 # qti-vble:   Support QTI Verified boot for LE
 #DISTRO_FEATURES += "qti-vble"

  • LE.PRODUCT.2.1.r1/apps_proc/src/vendor/qcom/opensource/gst-pluginsqti-oss/gst-plugin-base/gst/video/CMakeLists.txt
@@ -21,6 +21,9 @@ set_target_properties(${GST_QTI_VIDEO_BASE} PROPERTIES PUBLIC_HEADER
 target_compile_definitions(${GST_QTI_VIDEO_BASE} PRIVATE
   $<$<BOOL:${HAVE_MMM_COLOR_FMT_H}>:HAVE_MMM_COLOR_FMT_H>
   $<$<BOOL:${HAVE_LINUX_DMA_HEAP_H}>:HAVE_LINUX_DMA_HEAP_H>
+  $<$<BOOL:${HAVE_IOT_CORE_IB2C_H}>:HAVE_IOT_CORE_IB2C_H>
+  $<$<BOOL:${HAVE_FASTCV_H}>:HAVE_FASTCV_H>
+  $<$<BOOL:${HAVE_ADRENO_C2D2_H}>:HAVE_ADRENO_C2D2_H>
 )
 
 target_include_directories(${GST_QTI_VIDEO_BASE} PUBLIC
  • LE.PRODUCT.2.1.r1/apps_proc/poky/meta-qti-ml-prop/recipes/snpe-sdk/snpe.bb
@@ -29,10 +29,20 @@ do_package_qa[noexec] = "1"
 do_install() {
     install -d ${D}/${libdir}/rfsa/adsp
     install -d ${D}/${bindir}
-    install -m 0755 ${S}/lib/${PLATFORM_DIR}/* ${D}/${libdir}
-    install -m 0755 ${S}/lib/dsp/* ${D}/${libdir}/rfsa/adsp
-    install -m 0755 ${S}/bin/${PLATFORM_DIR}/* ${D}/${bindir}
+    install -m 0755 ${S}/lib/aarch64-oe-linux-gcc11.2/* ${D}/${libdir}
+    install -m 0755 ${S}/lib/hexagon-v73/unsigned/* ${D}/${libdir}/rfsa/adsp
+    install -m 0755 ${S}/bin/aarch64-oe-linux-gcc11.2/* ${D}/${bindir}
+    mkdir -p ${D}/${includedir}
     cp -r ${S}/include/* ${D}/${includedir}
+    cp -r ${S}/lib/aarch64-oe-linux-gcc11.2/libSnpeHtpV73Stub.so ${D}/${libdir}
+    cp -r ${S}/lib/aarch64-oe-linux-gcc11.2/libQnnHtpV73CalculatorStub.so ${D}/${libdir}
+    cp -r ${S}/lib/aarch64-oe-linux-gcc11.2/libQnnHtpV73Stub.so ${D}/${libdir}
+    cp -r ${S}/lib/hexagon-v73/unsigned/libSnpeHtpV73Skel.so ${D}/${libdir}
+    cp -r ${S}/lib/hexagon-v73/unsigned/libQnnHtpV73.so ${D}/${libdir}/rfsa/adsp
+    cp -r ${S}/lib/hexagon-v73/unsigned/libQnnHtpV73Skel.so ${D}/${libdir}/rfsa/adsp
+    cp -r ${S}/lib/aarch64-oe-linux-gcc11.2/libSnpeHtpPrepare.so ${D}/${libdir}/rfsa/adsp
+    cp -r ${S}/lib/aarch64-oe-linux-gcc11.2/libSNPE.so ${D}/${libdir}
+    cp -r ${S}/bin/aarch64-oe-linux-gcc11.2/snpe-throughput-net-run ${D}/${bindir}
     chmod -R 0755 ${D}/${includedir}
 }
  • turbox/tools/build_script/platform/build_hlos.sh
@@ -148,7 +148,11 @@ build_ap() { 
     echo "bitbake qti-robotics-image" 2>&1 | tee -a $log_file 
     bitbake qti-robotics-image 2>&1 | tee -a $log_file 
     assert 
-   
+  
+    export PREBUILT_SRC_DIR="$meta_dir/LE.PRODUCT.2.1.r1/apps_proc/prebuilt_HY11" 
+    bitbake -fc populate_sdk qti-robotics-image 2>&1 | tee -a $log_file 
+    bitbake -fc populate_sdk_ext qti-robotics-image 2>&1 | tee -a $log_file 
+ 
 } 
 

6. Build the SDK code:

./turbox_build.sh -a -l -v debug
Note
This step will take several hours the first time is executed, depending on the host PC capabilities. In our case it took around 10-12 hours.

The SDK will be found at LE.PRODUCT.2.1.r1/apps_proc/build-qti-distro-rb-debug/tmp-glibc/deploy/sdk/.

7. Pack the image for further flashing, according to the flashing method you want to use:

  • FlatBuild:
./turbox_build.sh --zip_flat_build -l -v debug
Note
This type of packaging is currently broken at the time of testing, as it doesn't pack all the files required for flashing compared to the prebuilt version.
  • Fastboot:
./turbox_build.sh --zip_fastboot_build -l -v debug

The output image zip will be located at workspace/sourcecode/turbox-c8550-le1.0-dev.release.FC.r001003/turbox/output/.

To flash the image go to the Flashing the Images section.

(Optional) Customize the Image Packages

In this section we will cover how to customize the packages installed in the image built in the previous section. For this customization we will add a layer called meta-ridgerun, which is a Yocto layer containing the recipes to build RidgeRun's proprietary and open software. For more information on the meta-ridgerun layer and purchasing its packages follow the following link meta-ridgerun. The process described by the following steps to add a layer can be used with any other custom meta layer.

1. Go to the Yocto directory inside the SDK Manager container:

YOCTO_DIR=/home/turbox/workspace/sourcecode/turbox-c8550-le1.0-dev.release.FC.r001003/LE.PRODUCT.2.1.r1/apps_proc
cd ${YOCTO_DIR}

2. Export the MACHINE and DISTRO variables:

export MACHINE=kalama
export DISTRO=qti-distro-rb-debug

3. Load the Yocto environment:

source poky/qti-conf/set_bb_env.sh

4. Get the meta-ridgerun layer into the layers directory:

cd ${YOCTO_DIR}/poky
git clone https://github.com/RidgeRun/meta-ridgerun.git

5. Apply the following diff changes to avoid warnings due to proprietary recipes and layer compatibility:

diff --git a/conf/layer.conf b/conf/layer.conf
index 91074f0..2571150 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -1,8 +1,8 @@
 # We have a conf and classes directory, add to BBPATH 
 BBPATH := "${BBPATH}:${LAYERDIR}" 
 # We have a packages directory, add to BBFILES 
-BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb \ 
-           ${LAYERDIR}/recipes-*/*/*.bbappend" 
+BBFILES := "${BBFILES} ${LAYERDIR}/recipes-multimedia/gstreamer/gst-perf_1.0.bb" 
 BBFILE_COLLECTIONS += "ridgerun" 
 BBFILE_PATTERN_ridgerun := "^${LAYERDIR}/" 
 BBFILE_PRIORITY_ridgerun := "5"
+LAYERSERIES_COMPAT_ridgerun = "kirkstone"
diff --git a/recipes-multimedia/gstreamer/gst-perf_1.0.bb b/recipes-multimedia/gstreamer/gst-perf_1.0.bb
index ce6f3c3..375bbad 100644
--- a/recipes-multimedia/gstreamer/gst-perf_1.0.bb
+++ b/recipes-multimedia/gstreamer/gst-perf_1.0.bb
@@ -14,11 +14,11 @@ SRC_URI = "git://github.com/RidgeRun/gst-perf.git;protocol=https;branch=${SRCBRA
 S = "${WORKDIR}/git"
 
 INSANE_SKIP_${PN} = "dev-so"
-FILES_${PN} += "${libdir}/gstreamer-1.0/libgstperf.so \
+FILES:${PN} += "${libdir}/gstreamer-1.0/libgstperf.so \
                 ${libdir}/gstreamer-1.0/libgstperf.so.0 \
                 ${libdir}/gstreamer-1.0/libgstperf.so.0.0.0 \
                "
-
+FILES:${PN}-staticdev += "${libdir}/gstreamer-1.0/libgstperf.a"
 inherit autotools pkgconfig gettext
 
 do_configure() {
Note
In this case we will build the Gst-Perf product, which is an open source GStreamer element to measure framerate, bitrate and CPU usage.

6. Add the layer to the Yocto environment:

cd ${YOCTO_DIR}/build-qti-distro-rb-debug
bitbake-layers add-layer ${YOCTO_DIR}/poky/meta-ridgerun/

7. Build the recipe:

bitbake gst-perf

8. Add the recipe to the image by adding the following line to the ${YOCTO_DIR}/build-qti-distro-rb-debug/conf/local.conf file.

IMAGE_INSTALL:append = " gst-perf"

9. Build the image again:

bitbake qti-robotics-image

10. Pack the new image following step 7 from the Build the SDK and Image section.

(Optional) Modify the Kernel

In Thundercomm's build the kernel is not built as part of the Yocto build, instead it is built at the ~/workspace/turbox-sdkmanager-ws/sourcecode/turbox-c8550-le1.0-dev.release.FC.r001003/turbox/tools/build_script/platform/build_hlos.sh script (called when running ./turbox_build.sh -a -l -v debug) and then fed into the Yocto build as a pre-built binary. This causes that the kernel recipe of the Yocto build doesn't use a do_compile stage where we can apply patches via a .bbappend file.

So in order to modify the kernel source we need to follow the next steps:

1. Go to the kernel source directory inside the SDK Manager container:

cd ~/workspace/sourcecode/turbox-c8550-le1.0-dev.release.FC.r001003/LE.PRODUCT.2.1.r1/apps_proc/src/kernel-5.15/kernel_platform/common

2. Apply the changes required in the source tree.

3. Build the image again. To do this run steps 6 and 7 from the Build the SDK and Image section.

References

  1. TurboX C8550 DK LE Software Release Notes. Retrieved August 5, 2024, from [1]
  2. TurboX C8550 Linux Embedded Standalone SDK Addon User Manual. Retrieved August 6, 2024, from [2]


Index