8.8. Using Processor SDK Linux with Processor SDK RTOS

8.8.1. Introduction

Processor SDK Linux J721E (PSDK LINUX) and Processor SDK RTOS J721E (PSDK RTOS) work together to realize use-cases on the J721E 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, A72 SPL, A72 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, sysfw binary 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.

8.8.2. Setup PSDK LINUX

  • Download from https://www.ti.com/tool/download/PROCESSOR-SDK-LINUX-J721E and install the PSDK LINUX installer as shown below

    chmod +x ti-processor-sdk-linux-j7-evm-xx_xx_xx-Linux-x86-Install.bin
    ./ti-processor-sdk-linux-j7-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 in SD card

      #root of the target file system for installing applications
      DESTDIR ?=/media/<user name>/rootfs
      
    2. Edit the file ${PSDK_LINUX_PATH}/board-support/k3-image-gen-*/gen_its.sh, comment the below line

      #SYSFW_IMG_GEN_REV=`git describe --tags --abbrev=5 --dirty`
      
  • Now PSDK LINUX is setup to build bootloader, kernel, SYSFW configuration

8.8.3. Build R5F SPL, A72 SPL and A72 u-boot

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

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

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

    ${PSDK_LINUX_PATH}/board-support/u-boot_build/r5/tiboot3.bin
    ${PSDK_LINUX_PATH}/board-support/u-boot_build/a72/tispl.bin
    ${PSDK_LINUX_PATH}/board-support/u-boot_build/a72/u-boot.img
    

8.8.4. Build SYSFW configuration

  • SYSFW configuration files can be found below

    ${PSDK_LINUX_PATH}/board-support/k3-image-gen-*
    
  • To change the config, modify below files

    ${PSDK_LINUX_PATH}/board-support/k3-image-gen-*/soc/j721e/evm/*.c
    
  • To build with a new SYSFW binary, copy the new SYSFW binary at below path, replacing the original one

    ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ti-fs-firmware-j721e-gp.bin
    
  • Do below in ${PSDK_LINUX_PATH}/ to regenerate SYSFW config

    make sysfw-image_clean
    make sysfw-image
    
  • After successful build, copy below file to ‘BOOT’ partition in the SD card

    ${PSDK_LINUX_PATH}/board-support/k3-image-gen-*/sysfw.itb
    

8.8.5. Build Linux DTB and DTBO

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

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

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

    sudo make linux-dtbs_install;sync
    

8.8.6. Build Linux kernel and kernel modules

  • Linux kernel can be found below

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

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

    sudo make linux_install;sync
    

8.8.7. Building PSDK Linux for HS Devices

The PSDK Linux can be built for HS devices with small modifications to the steps listed above. Most steps are identical to the build and installation steps listed above for a non-HS device.

8.8.7.1. Prerequisite

Before building any binaries for HS devices, the PSDK must be set up for HS devices.

Setup PSDK LINUX

  • In addition to the steps shown above for setting up the PSDK Linux, edit the ${PSDK_LINUX_PATH}/Rules.make to choose the HS platform name and u-boot machine names as shown below.

    PLATFORM=j7-hs-evm
    UBOOT_MACHINE=j721e_hs_evm_a72_defconfig
    UBOOT_MACHINE_R5=j721e_hs_evm_r5_defconfig
    
  • Certain steps below require the TI security development tools package, which has been included in the Linux SDK. It is recommended to set the environment variable TI_SECURE_DEV_PKG to this location as shown below.

    export TI_SECURE_DEV_PKG=${PSDK_LINUX_PATH}/board-support/core-secdev-k3
    

8.8.7.2. Build Using Prebuilt ATF/OPTEE/MCU1_0 Images

Using prebuilt images of ATF (Arm Trusted Firmware), OPTEE (Open Portable Trusted Execution Environment), and MCU1_0 (Micro Controller Unit), we can quickly build binaries that can be used to boot a HS device.

Build R5F SPL, A72 SPL and A72 u-boot

  • U-boot can be built in the same way as shown in the section above.

  • After a successful u-boot build, the boot files that will need to be copied to the ‘BOOT’ partition in the SD card will be located below. Important Note: The files must be copied to the ‘BOOT’ partition with the same file name as shown in the command below

    cp ${PSDK_LINUX_PATH}/board-support/u-boot_hs_build/r5/tiboot3.bin /media/$(USER)/BOOT/tiboot3.bin
    cp ${PSDK_LINUX_PATH}/board-support/u-boot_hs_build/a72/tispl.bin_HS /media/$(USER)/BOOT/tispl.bin
    cp ${PSDK_LINUX_PATH}/board-support/u-boot_hs_build/a72/u-boot.img_HS  /media/$(USER)/BOOT/u-boot.img
    

Build SYSFW

  • SYSFW can be built in the same way as shown in the section above.

Build Linux DTB and DTBO

  • The Linux DTB and DTBO’s can be built in the same way as referenced in the section above.

Build Linux kernel and kernel modules

  • The Linux kernel and kernel modules can be built in the same way as referenced in the section above.

Installing the fitImage

  • If using an HS device, the fitImage will need to be installed. The fitImage is included in the prebuilt-images of the PSDK Linux. Install the fitImage using the command shown below

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

8.8.7.3. Rebuild Using Custom ATF/OPTEE/MCU1_0 Image

If any component listed above needs to be updated, then the following procedures can be referenced to rebuild the binaries needed to boot using the updated component.

Updating ATF/OPTEE/MCU1_0 images for u-boot

  • The u-boot build for HS devices references the prebuilt images for ATF/OPTEE/MCU1_0. These images have already been signed and included at the below paths

    ${PSDK_LINUX_PATH}/board-support/prebuilt-images/bl31.bin.signed
    ${PSDK_LINUX_PATH}/board-support/prebuilt-images/bl32.bin.signed
    ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ipc_echo_testb_mcu1_0_release_strip.xer5f.signed
    
  • If these images need to be rebuilt, the rebuilt images can be signed by using the TI_SECURE_DEV_PKG referenced above. For instance, the bl31.bin can be signed by running the below command

    $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh bl31.bin bl31.bin.signed
    
  • These rebuilt files must then be copied into the directory ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ and u-boot can be rebuilt using the new binaries by following the steps above.

SYSFW binary location

  • For HS devices, the SYSFW binaries are located at the below path

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

Updating Linux DTB and DTBO

  • If the Linux DTB and DTBO’s must be modified and rebuilt, the rebuilt DTB’s and DTBO’s need to be signed using the TI_SECURE_DEV_PKG referenced above. For example, the k3-j721e-common-proc-board.dtb can be signed by running the below command

    $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh k3-j721e-common-proc-board.dtb k3-j721e-common-proc-board.dtb.sec
    
  • The signed binaries should then be copied into the ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ folder so that it can be integrated into the fitImage as described in the last section.

Updating Linux kernel and kernel modules

  • If the Linux Image must be modified and rebuilt, the Image needs to be signed using the TI_SECURE_DEV_PKG referenced above. This can be done by running the below command

    $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh Image Image.sec
    
  • The signed Image.sec should then be copied into the ${PSDK_LINUX_PATH}/board-support/prebuilt-images/ folder so that it can be integrated into the fitImage as described in the last section, and they can be rebuilt by following the steps above.

Updating fitImage for HS Devices

  • The fitImage.its, which was used to generate the prebuilt fitImage, is included at the location ${PSDK_LINUX_PATH}/board-support/prebuilt-images/.

  • If the fitImage.its needs to be modified, this will require the u-boot-tools package. This can be downloaded by using the command shown below

    sudo apt install u-boot-tools
    
  • After installing the u-boot-tools and modifying the fitImage.its as required, the fitImage can be generated by running the below command

    mkimage -f fitImage.its -r fitImage
    
  • The fitImage can then be installed by using the command shown below

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