VisionSOM imx-android: Difference between revisions
From SomLabs Wiki
Created page with "{{PageHeader|iMX Android for VisionSOM modules}} __toc__ This tutorial explains how to build the iMX Android 10.0.0_2.3.0 system image for the VisionSOM modules. It uses the..." |
No edit summary |
||
Line 15: | Line 15: | ||
https://www.nxp.com/docs/en/supporting-information/android_Q10.0.0_2.3.0_docs.zip | https://www.nxp.com/docs/en/supporting-information/android_Q10.0.0_2.3.0_docs.zip | ||
== Host system prerequisites == | == Host system prerequisites == |
Revision as of 16:53, 14 January 2021
iMX Android for VisionSOM modules
This tutorial explains how to build the iMX Android 10.0.0_2.3.0 system image for the VisionSOM modules. It uses the following kernel and u-boot repositories:
- kernel (5.4.24): https://github.com/SoMLabs/somlabs-linux-imx/tree/somlabs_imx_android-10.0.0_2.3.0
- u-boot (2020.04): https://github.com/SoMLabs/somlabs-uboot-imx/tree/somlabs-imx_v2020.04_5.4.24_2.1.0
Introduction
This tutorial describes the building procedure based on the official NXP instructions that are available on the NXP website:
The full documentation package for the described Android version can be downloaded directly from the following link:
https://www.nxp.com/docs/en/supporting-information/android_Q10.0.0_2.3.0_docs.zip
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 "you@example.com" 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:
https://storage.googleapis.com/git-repo-downloads/repo
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 anx 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):
https://www.nxp.com/webapp/Download?colCode=Q10.0.0_2.3.0_ANDROID_SOURCE
Next we need to extract the archive, source the setup file and set required environmental variables:
tar -xf imx-android-10.0.0_2.3.0.tar.gz source imx-android-10.0.0_2.3.0/imx_android_setup.sh export MY_ANDROID=~/dev/imx-android/android_build export AARCH64_GCC_CROSS_COMPILE=~/dev/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-
This layer should be used in order to build the fsl-image-validation-imx image. It includes the SoMLabs demo application using the GTK and GStreamer libraries.
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_2.2 arm-trusted-firmware git clone https://github.com/SoMLabs/somlabs-uboot-imx.git -b somlabs-imx_v2020.04_5.4.24_2.1.0 uboot-imx git clone https://github.com/SoMLabs/somlabs-linux-imx.git -b somlabs_imx_android-10.0.0_2.3.0 kernel_imx git clone https://github.com/SoMLabs/somlabs-imx-mkimage.git -b somlabs-android-10.0.0_2.3.0 imx-mkimage cd $MY_ANDROID/device/fsl/imx8m git clone https://github.com/SoMLabs/imx_android_visionsom_8mm.git visionsom_8mm cd $MY_ANDROID/device/fsl git apply $MY_ANDROID/../device_fsl.patch cd $MY_ANDROID/hardware/broadcom/libbt git apply $MY_ANDROID/../broadcom_libbt.patch
By default the system is built for the VisionCB-8M-STD board with the 7" Powertip display. This configuration may be changed by replacing the chosen device tree file in $MY_ANDROID/device/fsl/imx8m/visionsom_8mm/BoardConfig.mk
... TARGET_BOARD_DTS_CONFIG := imx8mm:visionsom-8mm-cb-std-mipi7.dtb ...
Building the system image
Having all sources ready, we can go on to system image compilation:
cd $MY_ANDROID source build/envsetup.sh lunch visionsom_8mm-userdebug ./imx-make.sh -j16
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.
Installing the compiled system
The compiled system files are located in the output directory: $MY_ANDROID/out/target/product/visionsom_8mm/. We can install them on the SD card or the eMMC memory using the scripts provided by NXP:
- SD card:
sudo ./device/fsl/common/tools/fsl-sdcard-partition.sh -D out/target/product/visionsom_8mm/ -f imx8mm /dev/sdd
- eMMC:
sudo ./device/fsl/common/tools/uuu_imx_android_flash.sh -D out/target/product/visionsom_8mm/ -f imx8mm -a -e
In the second case we need the UUU version 1.3.124 (https://github.com/NXPmicro/mfgtools/releases). It needs to be available in the system PATH.