Setting up Android 9 (Pie) for conga-SMX8M
1. Build environment - supported OS
Ubuntu 16.04 64 bit [Clean install]
Linux Mint; based on Ubuntu 18.04 Bionic 64 bit
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. Setup SSH (optional for contributors)
A SSH key must be generated in order to push software changes to 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 Android BSP.
5. Get Android src
Download and unpack the Android NXP release package (https://www.nxp.com/webapp/sps/download/license.jsp?colCode=P9.0.0_2.2.0_GA_ANDROID_SOURCE&appType=file1&DOWNLOAD_ID=null)
Code Block | ||
---|---|---|
| ||
$ cd ~ (or any other directory you like)
$ tar xzvf imx-p9.0.0_2.2.0-ga.tar.gz |
6. Getting i.MX Android NXP release source code
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.2.0-ga/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 |
6.1. Check vendor folder
Code Block | ||
---|---|---|
| ||
$cd $MY_ANDROID/vendor
$ls
nxp nxp-opensource |
Check if folder "vendor" contains subfolders "nxp" and "nxp-opensource".
Remove any other subfolders to prevent compilation errors.
Code Block | ||
---|---|---|
| ||
$find . ! -name 'nxp*' ! -name '.' -type d -exec rm -r -f {} + |
7. Fetch congatec source code
Congatec support are split to several repositories. All of them needs to be mannualy checked out in appropriate android folder.
7.1. Android kernel
Kernel Version | NXP Release Suffix | Congatec Branch | Congatec Release Tag |
---|---|---|---|
p9.0.0_4.14.98 | 2.2.0_ga | cgtimx8mm__imx_p9.0.0_4.14.98_2.2.0_ga | N/A |
Code Block | ||
---|---|---|
| ||
$ cd $MY_ANDROID
$ cd vendor/nxp-opensource/kernel_imx/
$ git remote add cgt <https://git.congatec.com/arm-nxp/imx8-family/kernel-imx8-family.git>
$ git fetch cgt --tags --prune |
7.1.a. Checkout latest version
Code Block | ||
---|---|---|
| ||
$ git checkout --track cgt/cgtimx8mm__imx_p9.0.0_4.14.98_2.2.0_ga |
7.1.b. Checkout particular version
Code Block | ||
---|---|---|
| ||
$ git checkout tags/<Congatec Release Tag> -b <your branch_name> |
7.2. Android bootloader
Uboot Version | NXP Release Suffix | Congatec Branch | Congatec Release Tag |
---|---|---|---|
p9.0.0_2018.3 | 2.2.0_ga | cgtimx8mm__imx_p9.0.0_v2018.03_4.14.98_2.2.0_ga | N/A |
Code Block | ||
---|---|---|
| ||
$ cd $MY_ANDROID
$ cd vendor/nxp-opensource/uboot-imx/
$ git remote add cgt <https://git.congatec.com/arm-nxp/imx8-family/uboot-imx8-family>
$ git fetch cgt --tags --prune |
7.2.a. Checkout latest version
Code Block | ||
---|---|---|
| ||
$ git checkout --track cgt/cgtimx8mm__imx_p9.0.0_v2018.03_4.14.98_2.2.0_ga |
7.2.b. Checkout particular version
Code Block | ||
---|---|---|
| ||
$ git checkout tags/<Congatec Release Tag> -b <your branch_name> |
7.3. Android mk-image utility
NXP Image Tool Version | NXP Release Suffix | Congatec Branch | Congatec Release Tag |
---|---|---|---|
N/A | 2.2.0_ga | cgtimx8mm__imx_p9.0.0_2.2.0_ga | N/A |
Code Block | ||
---|---|---|
| ||
$ cd $MY_ANDROID
$ cd vendor/nxp-opensource/imx-mkimage
$ git remote add cgt <https://git.congatec.com/arm-nxp/imx8-family/misc/mkimage-imx8-family>
$ git fetch cgt --tags --prune |
7.3.a. Checkout latest version
Code Block | ||
---|---|---|
| ||
$ git checkout --track cgt/cgtimx8mm__imx_p9.0.0_2.2.0_ga |
7.3.b. Checkout particular version
Code Block | ||
---|---|---|
| ||
$ git checkout tags/<Congatec Release Tag> -b <your branch_name> |
7.4. Device configuration files
Device Configuration Version | NXP Release Suffix | Congatec Branch | Congatec Release Tag |
---|---|---|---|
N/A | 2.2.0_ga | cgtimx8mm__imx_p9.0.0_2.2.0_ga | N/A |
Code Block | ||
---|---|---|
| ||
$ cd $MY_ANDROID
$ cd device/fsl
$ git remote add cgt <https://git.congatec.com/arm-nxp/imx8-family/android/device-imx8-family>
$ git fetch cgt --tags --prune |
7.4.a. Checkout latest version
Code Block | ||
---|---|---|
| ||
$ git checkout --track cgt/cgtimx8mm__imx_p9.0.0_2.2.0_ga |
7.4.b. Checkout particular version
Code Block | ||
---|---|---|
| ||
$ git checkout tags/<Congatec Release Tag> -b <your branch_name> |
7.5. Other hardware supporting packages
7.5.1 Qualcom Blue Tooth HAL
BT HAL Version | NXP Release Suffix | Congatec Branch | Congatec Release Tag |
---|---|---|---|
N/A | 2.2.0_ga | cgtimx8mm__imx_p9.0.0_2.2.0_ga | N/A |
Code Block | ||
---|---|---|
| ||
$ cd $MY_ANDROID
$ cd hardware/qcom/bt/
$ git remote add cgt <https://git.congatec.com/arm-nxp/imx8-family/android/hardware-qcom-bt-imx8-family>
$ git fetch cgt --tags --prune |
7.5.1.a. Checkout latest version
Code Block | ||
---|---|---|
| ||
$ git checkout --track cgt/cgtimx8mm__imx_p9.0.0_2.2.0_ga |
7.5.1.b. Checkout particular version
Code Block | ||
---|---|---|
| ||
$ git checkout tags/<Congatec Release Tag> -b <your branch_name> |
7.5.2 TinyALSA audio HAL
Audio HAL Version | NXP Release Suffix | Congatec Branch | Congatec Release Tag |
---|---|---|---|
N/A | 2.2.0_ga | cgtimx8mm__imx_p9.0.0 | N/A |
Code Block | ||
---|---|---|
| ||
$ cd $MY_ANDROID
$ cd vendor/nxp-opensource/imx
$ git remote add cgt <https://git.congatec.com/arm-nxp/imx8-family/android/cgt-vendor-imx>
$ git fetch cgt --tags --prune |
7.5.2.a. Checkout latest version
Code Block | ||
---|---|---|
| ||
$ git checkout --track cgt/cgtimx8mm__imx_p9.0.0 |
7.5.2.b. Checkout particular version
Code Block | ||
---|---|---|
| ||
$ git checkout tags/<Congatec Release Tag> -b <your branch_name> |
NOTE: for proper audio function it is necessary to have this or newer version of kernel and device repositories:
Code Block |
---|
KERNEL git hash: f1f0317f8338cf0834c62a4b42a4f664928d8b5f
DEVICE git hash: 50a4f6270c66bbc6d9a0ebc423aa289d64c929ec |
8. Update DTB to reflect your configuration
Current DTB is dedicated for device assembly variant"conga-SMX8-Mini/QC-4G eMMC16 DP" equiped with display port video output.
Android doesn't support dynmic change of DTB by UBoot as Linux does. Only possible method how to change video resolution is to change ".dts" file before Android system build. This paragraph describes how to perform it.
copy your dts file
myfile.dts
to$MY_ANDROID/vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dtb/congatec/
or select one of predefined dts file.Add your dtb build recipe to
$MY_ANDROID/vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dtb/congatec/Makefile
in formatdtb-$(CONFIG_ARCH_FSL_IMX8MM) += myfile.dtb
Update Boardconfig:
$MY_ANDROID/device/fsl/imx8m/cgtsx8m/BoardConfig.mk
; find line with variable definitionTARGET_BOARD_DTS_CONFIG ...
and update toTARGET_BOARD_DTS_CONFIG ?= myfile.dtb
9. Build the image
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 cgtsx8m-user
$ make |
10. Transfer the image to the SD card
####(/dev/sdX check your device configuration)
After building is complete, you can access the target files with the following command:
Code Block | ||
---|---|---|
| ||
$ cd out/target/product/cgtsx8m/ |
Code Block | ||
---|---|---|
| ||
sudo ./fsl-sdcard-partition.sh -f cgtsx8m -o 33 -c 7 /dev/sdX |
11. System boot
Sx8m boards are delivered with Linux bootloader flashed in the internal eMMC flash memory. To boot Android system it is necessary to erase internal bootloader.
Power up the board and wait for bootloader. Break the bootloader boot sequence and enter to bootloader shell. To erase internal bootloader type:
Code Block | ||
---|---|---|
| ||
$ sf probe
SF: Detected w25q64dw with page size 256 Bytes, .....
$ sf erase 0 0x800000
$ reset |
...
(c) 2020-2021, Robert Pasz, congatec GmbH