9.5. Using Processor SDK Linux with Processor SDK RTOS

9.5.1. Introduction

Processor SDK Linux J722S (PSDK LINUX) and Processor SDK RTOS J722S (PSDK RTOS) work together to realize use-cases on the J722S platform. In most cases using the pre-built linux filesystem, kernel, bootloader is sufficient to build different usecases. However sometimes it is needed to rebuild certain parts of PSDK LINUX to update things like bootloader, SYSFW configuration, kernel dtb/dtbo and so on.

This page shows quick steps to rebuild and update below,

  • R5F SPL, A53 SPL, A53 uboot (tiboot3.bin, tispl.bin, u-boot.img)

  • SYSFW configuration (sysfw.itb)

  • Linux kernel .dtb’s and .dtbo’s ( /boot/*.dtb, /boot/*.dtbo)

  • Linux kernel and kernel modules ( /boot/Image, /lib/modules/*)

The below instructions also include details about building for HS devices. The prebuilt binaries included with the Linux SDK are for GP devices, so the HS binaries will need to be built using the instructions below in order to run on HS. Specifically, the u-boot binaries and the fitImage will need to be built for HS and installed onto the SD card as shown in the sections below.

More detailed instruction to build PSDK LINUX are given in PSDK LINUX user guide. Refer ${PSDK_LINUX_PATH}//docs/linux/index.html for more details.

9.5.2. Setup PSDK LINUX

  • Download the PSDK LINUX installer and install as shown below

    chmod +x ti-processor-sdk-linux-<soc>-evm-xx_xx_xx-Linux-x86-Install.bin
    ./ti-processor-sdk-linux-<soc>-evm-xx_xx_xx-Linux-x86-Install.bin
    
  • Edit below files to adjust some paths and variables needed to build SYSFW config, uboot, kernel, dtb’s

    1. Edit below in ${PSDK_LINUX_PATH}/Rules.make to point to the root filesystem and the boot partition in SD card

      #root of the target file system for installing kernel Image, dtb's and modules
      ROOTFS_PART ?=/media/<user name>/rootfs
      
      #Location of the boot partition for installing boot binaries/images
      BOOT_PART ?=/media/<user name>/BOOT
      
    2. Update below in ${PSDK_LINUX_PATH}/Rules.make to choose the device type to build for. The Makefile will build for a General Purpose (GP) device by default. Please refer to the note below for additional steps to boot a High Secure (HS) device type

      #SOC_TYPE : Choose between gp, hs, hs-fs
      SOC_TYPE ?= gp
      
  • Using prebuilt images of ATF (Arm Trusted Firmware), OPTEE (Open Portable Trusted Execution Environment), and MCU1_0 (Micro Controller Unit), we can now quickly build the SYSFW configuration, bootloader and kernel

9.5.3. Build SPL and u-boot

  • R5F SPL, A53 SPL and A53 u-boot can be found below

    ${PSDK_LINUX_PATH}/board-support/ti-u-boot-*
    
  • Do below at ${PSDK_LINUX_PATH}/ to build R5F SPL, A53 SPL and A53 u-boot

    make u-boot
    
  • After successful build, Install files to ‘BOOT’ partition in the SD card using

    make u-boot_install
    
  • Note: The u-boot build and install targets also trigger the makefile targets to build and install the combined tiboot3.bin

  • Using the above, the following files will be copied to the ‘BOOT’ partition. These files will be generated at the location regardless of whether it is build for gp, hs or hs-fs

    ${PSDK_LINUX_PATH}/board-support/built-images/tiboot3.bin
    ${PSDK_LINUX_PATH}/board-support/built-images/tispl.bin
    ${PSDK_LINUX_PATH}/board-support/built-images/u-boot.img
    

9.5.4. Build Linux DTB and DTBO

  • The linux kernel input dts, dtso and generated dtb, dtbo are located below

    ${PSDK_LINUX_PATH}/board-support/ti-linux-*/arch/arm64/boot/dts/ti/
    
  • Do below at ${PSDK_LINUX_PATH}/ to regenerate the linux kernel .dtb, dtbo files

    make linux-dtbs
    
  • Do below at ${PSDK_LINUX_PATH}/ to copy the updated .dtb, dtbo files to SD card

    sudo make linux-dtbs_install;sync
    

9.5.5. Vision Apps DTBO

A device tree overlay is used to disable below components in linux, so that FW running on remote cores can control them

  1. Display Sub System (DSS)

  2. Bridges and PHYs connected to DSS pipeline (Display Port, DSI, SERDES etc..)

  3. i2c buses used to configure components in DSS pipeline

  4. Camera Serial Interface (CSI) controller

    This can be modified in below source dtso file,

${PSDK_LINUX_PATH}/board-support/ti-linux-*/arch/arm64/boot/dts/ti/arch/arm64/boot/dts/ti/k3-j722s-vision-apps.dtso

And rebuild the dtbos as shown in previous section

9.5.6. Build Linux kernel and kernel modules

  • Linux kernel can be found below

    ${PSDK_LINUX_PATH}/board-support/ti-linux-*
    
  • Do below at ${PSDK_LINUX_PATH}/ to rebuild the linux kernel and kernel modules

    make linux
    
  • Do below at ${PSDK_LINUX_PATH}/ to copy the updated linux kernel and kernel modules to SD card

    sudo make linux_install;sync
    
  • HS devices require a fitImage to be installed in the SD card, that packages the signed Kernel Image and dtbs. When building for HS devices (SOC_TYPE=<hs/hs-fs>), the above install command will generate a fitImage at ${PSDK_LINUX_PATH}/board-support/built-images/ and install the same to the SD card.

9.5.7. Additional Steps to use HS Devices

As described above, The SOC_TYPE variable in Rules.make defines what device type to build for. Below is a short description for each

SOC_TYPE=gp                     # For a GP device (default)
SOC_TYPE=hs                     # For a HS-SE device
SOC_TYPE=hs-fs                  # For a HS-FS device

After setting the SOC_TYPE variable appropriately and installing all of the above components, some additional steps may be needed for HS devices (Both HS-SE and HS-FS):

  • Set the environment variable TI_SECURE_DEV_PKG to TI security development tools package, included in the Linux SDK

    export TI_SECURE_DEV_PKG=${PSDK_LINUX_PATH}/board-support/core-secdev-k3
    ROOTFS=/media/$USER/rootfs
    
  • Signing the remote core firmwares: The remote core firmware binaries at /lib/firmware in the target filesystem need to be signed. For instance:

    $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh ${ROOTFS}/lib/firmware/pdk-ipc/ipc_echo_test_mcu2_0_release_strip.xer5f ${ROOTFS}/lib/firmware/pdk-ipc/ipc_echo_test_mcu2_0_release_strip.xer5f.signed
    
  • Softlinks to point to signed remote core firmwares: u-boot will look for -sec suffixed softlinks to the signed remote core binaries

    ln -sfn /lib/firmware/pdk-ipc/ipc_echo_test_mcu2_0_release_strip.xer5f.signed ${ROOTFS}/lib/firmware/j7-main-r5f0_0-fw-sec
    

If using vision apps, the built firmware can be signed and installed using a single command as shown below. For more information, please reference the vision apps documentation.

make linux_fs_install_sd HS=1

9.5.8. Optional : Rebuild Using Further Customizations

Using custom ATF/OPTEE/MCU1_0 images for u-boot

The make u-boot command picks up ATF, OPTEE and MCU1_0 Images from the locations shown below. If using custom binaries for these, replace the original one based on the device type being used.

These locations are used

${PSDK_LINUX_PATH}/board-support/prebuilt-images/bl31.bin                                                  # ATF
${PSDK_LINUX_PATH}/board-support/prebuilt-images/bl32.bin                                                  # OPTEE
${PSDK_LINUX_PATH}/board-support/prebuilt-images/ti-dm/$(SOC)/ipc_echo_testb_mcu1_0_release_strip.xer5f    # MCU1_0 DM image

After updating the above files at the corresponding locations, u-boot can be rebuilt and installed using the same steps.

SYSFW Binaries

The make u-boot command picks up the sysfw binaries from the locations shown below. To build with a new SYSFW binary, replace the original one based on the device type being used.

  • For GP devices (SOC_TYPE=gp), the SYSFW binaries are located at the below path

    ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ti-sysfw/ti-fs-firmware-*-gp.bin
    
  • For HS-SE devices (SOC_TYPE=hs), the SYSFW binaries are located at the below path

    ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ti-sysfw/ti-fs-firmware-*-hs-cert.bin
    ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ti-sysfw/ti-fs-firmware-*-hs-enc.bin
    
  • For HS-FS devices (SOC_TYPE=hs-fs), the SYSFW binaries are located at the below path

    ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ti-sysfw/ti-fs-firmware-*-hs-fs-cert.bin
    ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ti-sysfw/ti-fs-firmware-*-hs-fs-enc.bin
    

After updating the above files at the corresponding locations, sysfw-image can be rebuilt and installed using the same steps.

Customizing fitImage for HS Devices

A prebuilt fitImage is included in the prebuilt-images of the PSDK Linux. Install this using the command shown below

sudo install ${PSDK_LINUX_PATH}/board-support/prebuilt-images/fitImage /media/$(USER)/rootfs/boot/

To build the Linux fitImage for HS devices using a custom fitImage configuration, modify the file shown below required

${PSDK_LINUX_PATH}/board-support/prebuilt-images/fitImage.its
  • After modifying the fitImage.its, simply run the command below to build and install a fitImage using newly built Kernel Image, dtbs and the modified fitImage.its

    SOC_TYPE=hs make linux
    sudo SOC_TYPE=hs make linux_install