VisionSOM imx-android 12
From SomLabs Wiki
iMX Android for VisionSOM modules
This tutorial explains how to build the iMX Android 12.0.0_1.0.0 system image for the VisionSOM modules. It uses the following kernel and u-boot repositories:
- kernel (5.10.72): https://github.com/SoMLabs/somlabs-linux-imx/tree/somlabs_imx_android-12.0.0_1.0.0
- u-boot (2021.04): https://github.com/SoMLabs/somlabs-uboot-imx/tree/somlabs-imx_android-12.0.0_1.0.0
This tutorial describes the building procedure based on the official NXP instructions that are available on the NXP website:
Host system prerequisites
This tutorial was prepared for the Ubuntu 18.04.5 LTS host operating system. According to the official Android documentation (https://source.android.com/setup/build/requirements), all of the files required for system image compilation may require at least 250 GB. Additional 150 GB of the disk space may be needed for build files. The host system needs also at least 16 GB of available RAM.
The following packages need to be installed before the building process:
sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig uuid uuid-dev zlib1g-dev liblz-dev liblzo2-2 liblzo2-dev lzop git-core curl u-boot-tools mtd-utils android-tools-fsutils openjdk-8-jdk device-tree-compiler gdisk m4 libz-dev bison flex libssl-dev gcc-multilib
The source code will be obtained using git, so it needs to be configured by setting the user name and email with correctly set values:
git config --global user.email "firstname.lastname@example.org" git config --global user.name "Your Name"
It is also suggested to use the newest repo tool, that may be obtained from the following link:
It may be downloaded to the /usr/bin/ directory to be available in the system PATH.
In this tutorial we use the ~/dev/imx-android directory as the build base:
mkdir -p ~/dev/imx-android
Finally, we need the gcc compiler for the ARM64 architecture. We can obtain one from the ARM website:
We need to download it and extract to the ~/dev directory:
cd ~/dev/imx-android wget https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz tar -xf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz
Obtaining the system sources
First of all we need the iMX source package that may be downloaded from the NXP website (login is required):
Next we need to extract the archive, source the setup file and set required environmental variables:
tar -xf imx-android-12.0.0_1.0.0.tar.gz source imx-android-12.0.0_1.0.0/imx_android_setup.sh export MY_ANDROID=~/dev/imx-android/android_build export AARCH64_GCC_CROSS_COMPILE=~/dev/imx-android/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-
Obtaining the VisionSOM support
When all of the sources are downloaded we need to replace the default components with the ones provided by SoMLabs:
cd $MY_ANDROID/vendor/nxp-opensource rm -rf kernel_imx uboot-imx imx-mkimage arm-trusted-firmware mkdir $MY_ANDROID/vendor/somlabs cd $MY_ANDROID/vendor/somlabs git clone https://github.com/SoMLabs/somlabs-imx-atf.git -b somlabs-imx-atf_android-12.0.0_1.0.0 arm-trusted-firmware git clone https://github.com/SoMLabs/somlabs-uboot-imx.git -b somlabs-imx_android-12.0.0_1.0.0 uboot-imx git clone https://github.com/SoMLabs/somlabs-linux-imx.git -b somlabs_imx_android-12.0.0_1.0.0 kernel_imx git clone https://github.com/SoMLabs/somlabs-imx-mkimage.git -b somlabs-android-12.0.0_1.0.0 imx-mkimage git clone https://github.com/SoMLabs/imx_android_visionsom_8mm_demo_app.git -b android-12.0.0_1.0.0 somlabsdemo cd $MY_ANDROID/device/nxp git clone https://github.com/SoMLabs/imx_android_visionsom_8mm.git -b android-12.0.0_1.0.0 visionsom_8mm
Finally go to the imx-vpu-hantro-daemon sources and fix the kernel path in Android.bp file:
cd $MY_ANDROID/vendor/nxp/imx-vpu-hantro-daemon sed -i "s/nxp-opensource\/kernel_imx/somlabs\/kernel_imx/g" Android.bp
Building the system image
Having all sources ready, we can go on to system image compilation. The following device configurations are available:
- visioncb_8mm_adv_dsi-user VisionCB-8M-ADV carrier board with SL-TFT7-TP-720-1280-MIPI display
- visioncb_8mm_adv_dsi-userdebug VisionCB-8M-ADV carrier board with SL-TFT7-TP-720-1280-MIPI display with debug enabled
- visioncb_8mm_adv_hdmi-user VisionCB-8M-ADV carrier board with HDMI display connected
- visioncb_8mm_adv_hdmi-userdebug VisionCB-8M-ADV carrier board with HDMI display connected with debug enabled
- visioncb_8mm_std_dsi-user VisionCB-8M-STD carrier board with SL-TFT7-TP-720-1280-MIPI display
- visioncb_8mm_std_dsi-userdebug VisionCB-8M-STD carrier board with SL-TFT7-TP-720-1280-MIPI display with debug enabled
- visioncb_8mm_std_hdmi-user VisionCB-8M-STD carrier board with SL-MIPI-LVDS-HDMI-CNV converter
- visioncb_8mm_std_hdmi-userdebug VisionCB-8M-STD carrier board with SL-MIPI-LVDS-HDMI-CNV converter with debug enabled
Each configuration supports the VisionSOM-8MM modules with at least 2GB RAM memory and 16GB or 32GB eMMC storage.
The system image may be compiled using the following commands. The visioncb_8mm_std_dsi-userdebug configuration name may be changed to one of the previously mentioned options. By changing the -j16 option we can assign more processor cores to the compilation jobs. More information about available configuration options can be found in the iMX Android system documentation.
cd $MY_ANDROID source build/envsetup.sh lunch visioncb_8mm_std_dsi-userdebug ./imx-make.sh -j16
Installing the compiled system
The compiled system files are located in the output directory: $MY_ANDROID/out/target/product/. We can install them on the eMMC memory using the scripts provided by NXP. The path in the arguments list depends on the hardware configuration selected during the system build.
- 16GB eMMC:
sudo ./device/nxp/common/tools/uuu_imx_android_flash.sh -c 14 -D out/target/product/visioncb_8mm_std_dsi/ -f imx8mm -a -e
- 32GB eMMC:
sudo ./device/nxp/common/tools/uuu_imx_android_flash.sh -c 28 -D out/target/product/visioncb_8mm_std_dsi/ -f imx8mm -a -e
For the eMMC memory programming we also need the UUU version 1.4.193 (https://github.com/NXPmicro/mfgtools/releases). It needs to be available in the system PATH.