A x86 based Linux system with installed cross-compile toolchain / SDK Android development is required for i.MX 8-based congatec designs. It is possible to use a virtual machine but a dedicated system is preferrable. Furthermore, the host should have a serial port to access the serial console and an SD card reader.
The i.MX 8-based congatec designs require a 64-bit Ubuntu 16.04 system as the host for Android development.
Setting up and building Android
1. Installation in Ubuntu 16.04 64 bit [Clean install]
2. Some packages are needed:
Code Block |
---|
$ sudo apt-get update
$ sudo apt-get install 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
$ sudo apt-get install openjdk-8-jdk |
3. Config the local git:
Code Block |
---|
$ git config --global user.email "youremail"
$ git config --global user.name "Your name" |
4. A SSH key must be generated
In order to fetch te software from the congatec git server, after login into git.congatec.com go to the link https://git.congatec.com/-/profile/keys and follow the instructions there to generate and link a key with the computer will fetch and build the Yocto BSP.
5. Download and unpack the Android NXP
Download the release package https://www.nxp.com/webapp/Download?colCode=P9.0.0_2.3.4_ANDROID_SOURCE&appType=license
Code Block |
---|
$ cd ~ (or any other directory you like)
$ tar xzvf imx-p9.0.0_2.3.4.tar.gz |
6. Getting i.MX Android NXP
Code Block |
---|
$ mkdir ~/bin
$ curl <https://storage.googleapis.com/git-repo-downloads/repo> > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=${PATH}:~/bin
$ source ~/imx-p9.0.0_2.3.4/imx_android_setup.sh
# By default, the imx_android_setup.sh script will create the source code build environment in the folder ~/android_build
# ${MY_ANDROID} will be refered as the i.MX Android source code root directory in all i.MX Android release documentation.
$ export MY_ANDROID=~/android_build |
7. Fetch congatec source code
7.1. Android kernel
Code Block |
---|
$ cd $MY_ANDROID
$ cd vendor/nxp-opensource/kernel_imx/
$ git remote add cgtimx8__imx_p9.0.0_2.3.4 git@git.congatec.com:imx8_android_early_access/imx8_kernel_internal.git
$ git fetch cgtimx8__imx_p9.0.0_2.3.4
$ git checkout --track cgtimx8__imx_p9.0.0_2.3.4/cgtimx8__imx_p9.0.0_2.3.4 |
7.2. Android bootloader
Code Block |
---|
$ cd $MY_ANDROID
$ cd vendor/nxp-opensource/uboot-imx/
$ git remote add cgtimx8__imx_p9.0.0_2.3.4 git@git.congatec.com:imx8_android_early_access/imx8_uboot_internal.git
$ git fetch cgtimx8__imx_p9.0.0_2.3.4
$ git checkout --track cgtimx8__imx_p9.0.0_2.3.4/cgtimx8__imx_p9.0.0_2.3.4 |
7.3. Device configuration files
Code Block |
---|
$ cd $MY_ANDROID
$ cd device/fsl
$ git remote add cgtimx8__imx_p9.0.0_2.3.4 git@git.congatec.com:imx8_android_early_access/imx8_device.git
$ git fetch cgtimx8__imx_p9.0.0_2.3.4
$ git checkout --track cgtimx8__imx_p9.0.0_2.3.4/cgtimx8__imx_p9.0.0_2.3.4 |
7.4. Nxp-opensource imx files
Code Block |
---|
$ cd $MY_ANDROID
$ cd vendor/nxp-opensource/imx
$ git remote add cgtimx8__imx_p9.0.0_2.3.4 git@git.congatec.com:imx8_android_early_access/imx.git
$ git fetch cgtimx8__imx_p9.0.0_2.3.4
$ git checkout --track cgtimx8__imx_p9.0.0_2.3.4/cgtimx8__imx_p9.0.0_2.3.4 |
7.5. Hardware Bluetooth files
Code Block |
---|
$ cd $MY_ANDROID
$ cd hardware/nxp
$ mkdir bt
$ cd bt
$ git init .
$ git remote add cgtimx8__imx_p9.0.0_2.3.4 git@git.congatec.com:imx8_android_early_access/bt.git
$ git fetch cgtimx8__imx_p9.0.0_2.3.4
$ git checkout --track cgtimx8__imx_p9.0.0_2.3.4/cgtimx8__imx_p9.0.0_2.3.4 |
7.6. Hardware Wlan files
Code Block |
---|
$ cd $MY_ANDROID
$ cd hardware/nxp
$ mkdir wlan
$ cd wlan
$ git init .
$ git remote add cgtimx8__imx_p9.0.0_2.3.4 git@git.congatec.com:imx8_android_early_access/wlan.git
$ git fetch cgtimx8__imx_p9.0.0_2.3.4
$ git checkout --track cgtimx8__imx_p9.0.0_2.3.4/cgtimx8__imx_p9.0.0_2.3.4 |
7.7. Libwifi hal files
Code Block |
---|
$ cd $MY_ANDROID
$ cd frameworks/opt/net/wifi/libwifi_hal
$ git remote add cgtimx8__imx_p9.0.0_2.3.4 git@git.congatec.com:imx8_android_early_access/libwifi_hal.git
$ git fetch cgtimx8__imx_p9.0.0_2.3.4
$ git checkout --track cgtimx8__imx_p9.0.0_2.3.4/cgtimx8__imx_p9.0.0_2.3.4 |
7.8. NXP imx-firmware files
Code Block |
---|
$ cd $MY_ANDROID
$ cd vendor/nxp/imx-firmware
$ git remote add cgtimx8__imx_p9.0.0_2.3.4 git@git.congatec.com:imx8_android_early_access/imx-firmware.git
$ git fetch cgtimx8__imx_p9.0.0_2.3.4
$ git checkout --track cgtimx8__imx_p9.0.0_2.3.4/cgtimx8__imx_p9.0.0_2.3.4 |
7.9. Hardware interfaces files
Code Block |
---|
$ cd $MY_ANDROID
$ cd hardware/interfaces
$ git remote add cgtimx8__imx_p9.0.0_2.3.4 git@git.congatec.com:imx8_android_early_access/interfaces.git
$ git fetch cgtimx8__imx_p9.0.0_2.3.4
$ git checkout --track cgtimx8__imx_p9.0.0_2.3.4/cgtimx8__imx_p9.0.0_2.3.4 |
8. Build the images
One way to make up for the limited RAM is using a bigger swap. Google recommends at least 16GB of RAM/swap so it’s not uncommon to create a 16GB swap when working in VM, to do this please use the following commands.
Code Block |
---|
$ sudo fallocate -l 16g /mnt/16GB.swap
$ sudo chmod 600 /mnt/16GB.swap
$ sudo mkswap /mnt/16GB.swap
$ sudo swapon /mnt/16GB.swap |
Set the environment and build the images
Code Block |
---|
$ cd $MY_ANDROID
$ source build/envsetup.sh
$ lunch cgtsmx8-eng
$ make |
9. Transfer the images to the SD card (/dev/sdX check your device)
After building is complete, you can access the target files with the following command:
Code Block |
---|
$ cd out/target/product/cgtsmx8/ |
9.1 Bootcontainer
In order to use the bootloader according the target variant follow the next steps to fetch boot containers, remove the boot headers generated by the build
Code Block |
---|
$ sudo git clone git@git.congatec.com:imx8_android_early_access/imx8_boot_container_binary.git |
Check the CPU silicon, and memory of the target module.
conga-SMX8-X 4GB B silicon
Code Block |
---|
$ ln -s imx8_boot_container_binary/u-boot-imx8qxp-cgtsx8x-4GB.imx u-boot-imx8qxp-cgtsx8x.imx |
conga-SMX8-X 2GB B silicon
Code Block |
---|
$ ln -s imx8_boot_container_binary/u-boot-imx8qxp-cgtsx8x-2GB.imx u-boot-imx8qxp-cgtsx8x.imx |
conga-QMX8-X 4GB B silicon
Code Block |
---|
$ ln -s imx8_boot_container_binary/u-boot-imx8qxp-cgtqx8x-4GB.imx u-boot-imx8qxp-cgtqx8x.imx |
conga-QMX8-X 2GB B silicon
Code Block |
---|
$ ln -s imx8_boot_container_binary/u-boot-imx8qxp-cgtqx8x-2GB.imx u-boot-imx8qxp-cgtqx8x.imx |
9.2 Tranfer the images to the SDcard
9.2.1. conga-SMX8-X Y
Code Block |
---|
$ sudo ./fsl-sdcard-partition.sh -f imx8qxp-cgtsx8x -o 32 -c 7 /dev/sdX |
9.2.2. conga-QMX8-X A
Code Block |
---|
$ sudo ./fsl-sdcard-partition.sh -f imx8qxp-cgtqx8x -o 32 -c 7 /dev/sdX |
10. Hardware configuration
Bootcontainer is programmed into the SDcard, therefore the module needs be configured as follows:
conga-SMX8-X Y
Select on conga-SEVA
M17 ON-ON
M18 OFF-OFF
conga-QMX8-X A
Select on-module switch
SW1 ON-ON-OFF-OFF