Android Users Guide
Android Users Guide
Document information
Information Content
Keywords Android, i.MX, android-13.0.0_1.0.0
Abstract This document provides the technical information related to the i.MX 8 series
devices.
NXP Semiconductors
AUG
Android User's Guide
1 Overview
This document provides the technical information related to the i.MX 8 series devices. It
provides instructions for:
• Configuring a Linux OS build machine.
• Downloading, patching, and building the software components that create the Android
system image.
• Building from sources and using pre-built images.
• Copying the images to boot media.
• Hardware and software configurations for programming the boot media and running the
images.
For more information about building the Android platform, see source.android.com/docs/
setup/build/building.
2 Preparation
gdisk \
m4 \
zlib1g-dev \
bison \
flex make \
libssl-dev \
gcc-multilib \
libghc-gnutls-dev \
swig \
liblz4-tool \
liblz4-tool \
libdw-dev \
dwarves \
bc cpio tar lz4 rsync \
ninja-build clang
Note:
Configure Git before use. Set the name and email as follows:
•
git config --global user.name "First Last"
•
git config --global user.email "[email protected]"
If you want to build Android in Docker container, you can skip this step of installing
preceding packages and see Section Section 3.4 to build Docker image, which has full
i.MX Android build environment.
$ mkdir ~/bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo >
~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=${PATH}:~/bin
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
$ source ~/imx-android-13.0.0_1.0.0/imx_android_setup.sh
# By default, after preceding command finishes execution,
current working directory changed to the i.MX Android source
code root directory.
# ${MY_ANDROID} will be refered as the i.MX Android source code
root directory in all i.MX Andorid release documentation.
$ export MY_ANDROID=`pwd`
Note:
In the imx_android_setup.sh script, a .xml file that contains the code repository
information is specified. To make the code synchronized by this script the same as
the release state, code repository revision is specified with the release tag in this file.
The release tag is static and is not moved after the code is published, so no matter
when imx_android_setup.sh is executed, the working area of the code repositories
synchronized by this script are the same as release state and images being built are the
same as prebuilt images.
If a critical issue bugfix is published, another .xml file is published to reflect
those changes on the source code. Then customers need to modify the
imx_android_setup.sh. For this release, make the following changes on the script.
The wireless-regdb repository may fail to be synchronized with the following log:
If this issue is encountered, execute the following command on the host as a fix:
well as preparation steps. Customers could follow these steps to do the preparation work
and build the images.
First, the source build/envsetup.sh command is executed to import shell functions
that are defined in ${MY_ANDROID}/build/envsetup.sh.
Then, the lunch <ProductName-BuildMode> command is executed to set up the
build configuration.
The "Product Name" is the Android device name found in directory ${MY_ANDROID}/
device/nxp/. Search for the keyword PRODUCT_NAME under this directory for the
product names. The following table lists the i.MX product names.
The "Build Mode" is used to specify what debug options are provided in the final image.
The following table lists the build modes.
then added to do these steps to simplify the build work. After U-Boot/kernel are compiled,
any build commands in standard Android can be used.
imx-make.sh can also start the soong_ui with the make function in ${MY_ANDROID}/
build/envsetup.sh to build the Android images after U-Boot/kernel is compiled, so
customers can still build the i.MX Android images with only one command with this script.
i.MX Android platform needs some preparation for the first time when building the
images. The image build steps are as follows:
1. Prepare the build environment for U-Boot and Linux kernel.
This step is mandatory because there is no GCC cross-compile tool chain in the one
in AOSP codebase.
An approach is provided to use the self-installed GCC cross-compile tool chain.
a. Download the tool chain for the A-profile architecture on developer.arm.com/
downloads/-/gnu-a page. It is recommended to use the 9.2 version for this
release. You can download gcc-arm-9.2-2019.12-x86_64-aarch64-
none-elf.tar.xz or gcc-arm-9.2-2019.12-x86_64-aarch64-none-
linux-gnu.tar.xz. The first one is dedicated for compiling bare-metal
programs, and the second one can also be used to compile the application
programs.
b. Decompress the file into a path on local disk, for example, to /opt/. Export a
variable named AARCH64_GCC_CROSS_COMPILE to point to the tool as follows:
# if "gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf.tar.xz"
is used
$ sudo tar -xvJf gcc-arm-9.2-2019.12-x86_64-aarch64-none-
elf.tar.xz -C /opt
$ export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-
arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/aarch64-none-
elf-
# if "gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-
gnu.tar.xz" is used
$ sudo tar -xvJf gcc-arm-9.2-2019.12-x86_64-aarch64-none-
linux-gnu.tar.xz -C /opt
$ export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-
arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-
none-linux-gnu-
c. Follow below steps to set external clang tools for kernel building.
sudo git clone https://android.googlesource.com/platform/
prebuilts/clang/host/linux-x86 /opt/prebuilt-android-clang
cd /opt/prebuilt-android-clang
sudo git checkout 0fc0715d9392ca616605c07750211d7ca71f4e36
export CLANG_PATH=/opt/prebuilt-android-clang
The preceding export commands can be added to /etc/profile. When the host
boots up, AARCH64_GCC_CROSS_COMPILE and CLANG_PATH are set and can be
directly used.
Note:
• If you want to build Android in Docker container, you can skip this step of installing
GCC cross-compile and clang tools on the host. See Section Section 3.4 to build
Docker image which has full i.MX Android build environment.
2. Change to the top-level build directory.
$ cd ${MY_ANDROID}
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
3. Set up the environment for building. This only configures the current terminal.
$ source build/envsetup.sh
4. Execute the Android lunch command. In this example, the setup is for the
production image of i.MX 8M Mini EVK Board/Platform device with userdebug type.
$ lunch evk_8mm-userdebug
5. Execute the imx-make.sh script to generate the image.
$ ./imx-make.sh -j4 2>&1 | tee build-log.txt
The output of make command is written to standard output and build-log.txt. If there
are any errors when building the image, error logs can be found in the build-log.txt
file for checking.
To change BUILD_ID and BUILD_NUMBER, update build_id.mk in the
${MY_ANDROID}/device/nxp/ directory. For details, see the Android™ Frequently
Asked Questions.
The following outputs are generated by default in ${MY_ANDROID}/out/target/
product/evk_8mm:
• root/: root file system, it is used to generate system.img together with files in
system/.
• system/: Android system binary/libraries. It is used to generate system.img together
with files in root/.
• recovery/: root file system, integrated into vendor_boot.img as a part of the
ramdisk and used by the Linux kernel when the system boots up.
• vendor_ramdisk/: Integrated into vendor_boot.img as part of the ramdisk and
used by the Linux kernel when the system boots up.
• ramdisk/: integrated into boot image as part of the ramdisk and used by linux kernel
when system boot up. Because GKI is enabled on i.MX 8M Mini EVK, this is integrated
into the boot-imx.img.
• ramdisk.img: Ramdisk image generated from ramdisk/. Not directly used.
• dtbo-imx8mm.img: Board's device tree binary. It is used to support MIPI-to-HDMI
output on the i.MX 8M Mini EVK LPDDR4 board.
• dtbo-imx8mm-m4.img: Board's device tree binary. It is used to support MIPI-to-HDMI
output and audio playback based on Cortex-M4 FreeRTOS on the i.MX 8M Mini EVK
LPDDR4 board.
• dtbo-imx8mm-mipi-panel.img: Board's device tree binary. It is used to support
rm67199 MIPI Panel output on the i.MX 8M Mini EVK LPDDR4 board.
• dtbo-imx8mm-mipi-panel-rm67191.img: Board's device tree binary. It is used to
support rm67191 MIPI Panel output on the i.MX 8M Mini EVK LPDDR4 board.
• dtbo-imx8mm-ddr4.img: Board's device tree binary. It is used to support MIPI-to-
HDMI output on the i.MX 8M Mini EVK DDR4 board.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
• boot.img: A composite image which includes the AOSP generic kernel Image and
boot parameters.
• boot-imx.img: A composite image which includes the kernel Image built from i.MX
Kernel tree and boot parameters.
• init_boot.img: Generic ramdisk.
• vendor_boot.img: A composite image, which includes vendor ramdisk and boot
parameters.
• rpmb_key_test.bin: Prebuilt test RPMB key. Can be used to set the RPMB key as
fixed 32 bytes 0x00.
• testkey_public_rsa4096.bin: Prebuilt AVB public key. It is extracted from the
default AVB private key.
Note:
• To build the U-Boot image separately, see Section 3.4.
• To build the kernel uImage separately, see Section 3.5.
• To build boot.img, see Section 3.6.
• To build dtbo.img, see Section 3.7.
The main differences among the three modes are listed as follows:
• eng: development configuration with additional debugging tools
– Installs modules specified by PRODUCT_PACKAGES_ENG and/or
PRODUCT_PACKAGES_DEBUG.
– Installs modules according to the product definition files.
– ro.secure=0
– ro.debuggable=1
– ro.kernel.android.checkjni=1
– adb is enabled by default.
• user: limited access; suited for production
– Installs modules tagged with user.
– Installs modules according to the product definition files.
– ro.secure=1
– ro.debuggable=0
– adb is disabled by default.
• userdebug: like user but with root access and debuggability; preferred for debugging
– Installs modules specified by PRODUCT_PACKAGES_DEBUG.
– Installs modules according to the product definition files.
– ro.debuggable=1
– adb is enabled by default.
To build of Android images, an example for the i.MX 8M Mini EVK LPDDR4 target is:
$ cd ${MY_ANDROID}
$ source build/envsetup.sh #set env
$ lunch evk_8mm-userdebug
$ ./imx-make.sh -j4
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ lunch evk_8mm-userdebug
$ ./imx-make.sh bootloader kernel -j4
$ make -j4
Then build the images. The GMS package is then installed into the target images.
Note:
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
product.mk means the build target make file. For example, for i.MX 8M Mini EVK
Board, the product.mk is named device/nxp/imx8m/evk_8mm/evk_8mm.mk.
Note:
• If it fails to use the apt command to install packages in the process of Docker image
build, configure the HTTP proxy. First, copy your host apt.conf with cp /etc/apt/
apt.conf ${Dockerfile_path}/apt.conf, or create a stripped down version.
Then, remove the symbol "#" from the related content in Dockerfile.
• If it fails to install clang tools in the process of Docker image build, remove the symbol
"#" from the related content in Dockerfile, and try to build it again.
• If you manage Docker as a non-root user, preface the docker command with sudo,
such as sudo docker build ... and sudo docker run ....
• You can use the command docker images to see the existing Docker image and use
docker ps -a to see the existing container. For other docker commands, see Docker
Docs web.
• The Android build content above is taking the i.MX 8M Mini EVK board as an example.
To build other board images or single image, refer to the other content of this section.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
The following are the default Android build commands to build the kernel image:
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ lunch evk_8mm-userdebug
$ ./imx-make.sh kernel -c -j4
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
5 Programming Images
The images from the prebuilt release package or created from source code contain the
U-Boot bootloader, system image, GPT image, vendor image, and vbmeta image. At a
minimum, the storage devices on the development system (MMC/SD or NAND) must
be programmed with the U-Boot bootloader. The i.MX 8 series boot process determines
what storage device to access based on the switch settings. When the bootloader is
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
loaded and begins execution, the U-Boot environment space is then read to determine
how to proceed with the boot process. For U-Boot environment settings, see Section
Section 6.
The following download methods can be used to write the Android System Image:
• UUU to download all images to the eMMC or SD card.
• imx-sdcard-partition.sh to download all images to the SD card.
• fastboot_imx_flashall script to download all images to the eMMC or SD storage.
Note:
For the preceding table, in the "Partition Type/Index" column and "Start offset" column,
the contents in brackets is specific for dual-bootloader condition.
To create these partitions, use UUU described in the Android Quick Start Guide
(AQSUG), or use format tools in the prebuilt directory.
The script below can be used to partition an SD Card and download images to them as
shown in the partition table above:
$ sudo ${MY_ANDROID}/device/nxp/common/tools/imx-sdcard-
partition.sh -f <soc_name> /dev/sdX
# <soc_name> can be imx8mm,imx8mn,imx8mp,imx8mq, imx8ulp,
imx8qm,imx8qxp.
Note:
• If the SD card is 16 GB, use sudo ${MY_ANDROID}/device/nxp/common/tools/
imx-sdcard-partition.sh -f <soc_name> /dev/sdX to flash images in the
current working directory.
• If the SD card is 32 GB, use sudo ${MY_ANDROID}/device/nxp/common/tools/
imx-sdcard-partition.sh -f <soc_name> -c 28 /dev/sdX to flash images
in the current working directory.
• /dev/sdX, the X is the disk index from 'a' to 'z', which may be different on each Linux
PC.
• Unmount all the SD card partitions before running the script.
• Put related bootloader, boot image, system image, product image, and vbmeta image
in your current directory, or use -D <directory_containing_images> to specify
the directory path in which there are the images to be flashed.
• This script needs simg2img tool to be installed on your PC. The simg2img is a tool
that converts sparse system image to raw system image on the host PC running Linux
OS. The android-tools-fsutils package includes the simg2img command for
Ubuntu Linux.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
With the help of fastboot_imx_flashall scripts, you do not need to use fastboot to
flash Android images one-by-one manually. These scripts automatically flash all images
with only one command.
With virtual A/B feature enabled, your host fastboot tool version should be equal to or
later than 30.0.4. You can download the host fastboot tool from the Android website or
build it with the Android project. Based on Section Section 3.2, follow the steps below to
build fastboot:
$ cd ${MY_ANDROID}
$ make -j4 fastboot
After the build process finishes building fastboot, the directory to find the fastboot is as
follows:
• Linux version binary file: ${MY_ANDROID}/out/host/linux-x86/bin
• Windows version binary file: ${MY_ANDROID}/out/host/windows-x86/bin
The way to use these scripts is follows:
• Linux shell script usage: sudo fastboot_imx_flashall.sh <option>
• Windows batch script usage: fastboot_imx_flashall.bat <option>
Options:
-h Displays this help message
-f soc_name Flashes the Android image file with
soc_name
-a Only flashes the image to slot_a
-b Only flashes the image to slot_b
-c card_size Optional setting: 7 / 14 / 28
If it is not set, use partition-
table.img (default).
If it is set to 7, use partition-
table-7GB.img for 8 GB SD card.
If it is set to 14, use partition-
table-14GB.img for 16 GB SD card.
If it is set to 28, use partition-
table-28GB.img for 32 GB SD card.
Make sure that the corresponding file
exists on your platform.
-m Flashes the MCU image.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
Note:
• -f option is mandatory. The SoC name can be imx8mm, imx8mn, imx8mp, imx8mq,
imx8qm, or imx8qxp.
• Boot the device to U-Boot fastboot mode, and then execute these scripts. The device
should be unlocked first.
Example:
Options explanation:
• -f imx8mm: Flashes images for i.MX 8M Mini EVK Board.
• -a: Only flashes slot a.
• -e: Erases user data after all image files are flashed.
• -D /imx_android/evk_8mm/: Images to be flashed are in the directory of /
imx_android/evk_8mm/.
• -u trusty-dual: Flashes spl-imx8mm-trusty-dual.bin and bootloader-
imx8mm-trusty-dual.img.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
To enter U-Boot fastboot mode, for example, make the board enter U-Boot command
mode, and execute the following command on the console:
> fastboot 0
To enter userspace fastboot mode, two commands are provided as follows for different
conditions. You may need root permission on Linux OS:
To use fastboot tool on the host to operate on a specific partition, choose the proper
fastboot implemented on the device, which can recognize the partition to be operated on.
For example, to flash the system.img to the partition of system_a, make the board enter
userspace fastboot mode, and execute the following command on the host:
6 Booting
This chapter describes booting from MMC/SD.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
To test booting from SD, change the board Boot_Mode switch to SW1101 0110110010
(1-10 bit) and SW1102 0001101000 (1-10 bit).
To test booting from eMMC, change the board Boot_Mode switch to SW1101
0110110010 (1-10 bit) and SW1102 0001010100 (1-10 bit).
The default environment is in boot.img. To use the default environment in boot.img,
do not set bootargs environment in U-Boot.
To clear the bootargs environment being set and saved before, use the following
command:
Note:
bootargs environment is an optional setting for boota. The boot.img includes a
default bootargs, which is used if there is no bootargs defined in U-Boot.
• To boot from SD, change the board Boot_Mode switch to SW1101 1100 (from 1-4 bit).
• To boot from eMMC, change the board Boot_Mode switch to SW1101 0100 (from 1-4
bit).
The default environment is in boot.img. To use the default environment in boot.img,
do not set bootargs environment in U-Boot.
To clear the bootargs environment being set and saved before, use the following
command:
Note:
bootargs environment is an optional setting for boota. The boot.img includes a
default bootargs, which is used if there is no bootargs defined in U-Boot.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
• To boot from SD, change the board Boot_Mode switch SW4 to 0011 (from 1-4 bit).
• To boot from eMMC, change the board Boot_Mode switch SW4 to 0010 (from 1-4 bit).
The default environment is in boot.img. To use the default environment in boot.img,
do not set bootargs environment in U-Boot.
To clear the bootargs environment being set and saved before, use the following
command:
Note:
bootargs environment is an optional setting for boota. The boot.img includes a
default bootargs, which is used if if there is no bootargs defined in U-Boot.
To test booting from SD, change the board Boot_Mode switch to 10 (1-2 bit) and SW801
1100 (1-4 bit).
To test booting from eMMC, change the board Boot_Mode switch to 10 (1-2 bit) and
SW801 0010 (1-4 bit).
The default environment is in boot.img. To use the default environment in boot.img,
do not set bootargs environment in U-Boot.
To clear the bootargs environment being set and saved before, use the following
command:
Note:
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
To test booting from SD, change the board Boot_Mode switch to 001100 (1-6 bit).
To test booting from eMMC, change the board Boot_Mode switch to 000100 (1-6 bit).
The default environment is in boot.img. To use the default environment in boot.img,
do not set bootargs environment in U-Boot.
To clear the bootargs environment being set and saved before, use the following
command:
Note:
bootargs environment is an optional setting for boota. The boot.img includes a
default bootargs, which is used if if there is no bootargs defined in U-Boot.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
To test booting from SD, change the board Boot_Mode switch to 1100 (1-4 bit).
To test booting from eMMC, change the board Boot_Mode switch to 0100 (1-4 bit).
The default environment is in boot.img. To use the default environment in boot.img,
do not set bootargs environment in U-Boot.
To clear the bootargs environment being set and saved before, use the following
command:
Note:
bootargs environment is an optional setting for boota. The boot.img includes a
default bootargs, which is used if if there is no bootargs defined in U-Boot.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
$ lunch evk_8mm-userdebug
$ ./imx-make.sh bootloader kernel -j4
$ make target-files-package -j4
After building is complete, you can find the target files in the following path:
${MY_ANDROID}/out/target/product/evk_8mm/obj/PACKAGING/
target_files_intermediates/evk_8mm-ota-**.zip
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ lunch evk_8mm-userdebug
$ ./imx-make.sh bootloader kernel -j4
$ make otapackage -j4
After building is complete, you can find the OTA packages in the following path:
${MY_ANDROID}/out/target/product/evk_8mm/evk_8mm-ota-**.zip
$ cd ${MY_ANDROID}
$ out/host/linux-x86/bin/ota_from_target_files -i PREVIOUS-
target_files.zip NEW-target_files.zip incremental-ota.zip
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
The dual-bootloader feature is the default configuration and it's useful as it can provide a
secure way to update the bootloader image. But if the single-bootloader image is used,
to build the OTA package, some configurations need to be made. Taking i.MX 8M Mini as
an example, add the following changes to ${MY_ANDROID}/device/nxp:
-BOARD_PACK_RADIOIMAGES += bootloader.img
-INSTALLED_RADIOIMAGE_TARGET += $(PRODUCT_OUT)/bootloader.img
diff --git a/imx8m/evk_8mm/BoardConfig.mk b/imx8m/evk_8mm/
BoardConfig.mk
index c6f94c82f..66414a65d 100644
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
--- a/imx8m/evk_8mm/BoardConfig.mk
+++ b/imx8m/evk_8mm/BoardConfig.mk
@@ -67,7 +67,6 @@ BOARD_PREBUILT_DTBOIMAGE := $(OUT_DIR)/
target/product/$(PRODUCT_DEVICE)/dtbo-imx
BOARD_USES_METADATA_PARTITION := true
BOARD_ROOT_EXTRA_FOLDERS += metadata
-AB_OTA_PARTITIONS += bootloader
# -------@block_security-------
ENABLE_CFI=false
AB_OTA_POSTINSTALL_CONFIG += \
RUN_POSTINSTALL_vendor=true \
POSTINSTALL_PATH_vendor=bin/imx_ota_postinstall \
FILESYSTEM_TYPE_vendor=ext4 \
POSTINSTALL_OPTIONAL_vendor=false
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ lunch evk_8mm-userdebug
$ ./imx-make.sh bootloader kernel -j4
$ make otapackage -j4 IMX_OTA_POSTINSTALL=1
This postinstall mechanism is not mutually exclusive with full update package or
incremental update package. It can be used with both of them.
In the demonstration, imx_ota_postinstall corresponds to a shell script, and the
source code is under the ${MY_ANDROID}/vendor/nxp-opensource/imx/ota_
postinstall/ directory. It is used to update the bootloader0 partition, which does
not have a/b slot.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
Note: You should be aware of the risk that the update of the bootloader0 partition
may fail and there is no way to roll back.
During the execution of this command, it invokes the dd command to write the file /
postinstall/etc/bootloader0.img to the appropriate offset of the boot device.
You can modify the configuration source code to decide which file is copied to the vendor
partition and named as bootloader0.img. Taking i.MX 8M Mini EVK as an example,
the following code lines in the release code can copy the U-Boot image with Trusty OS
to vendor partition and name it as bootloader0.img. If dual-bootloader feature is
enabled, the SPL image should be copied. If the board is closed, the image should be
signed first.
PRODUCT_COPY_FILES += \
$(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/
obj/UBOOT_COLLECTION/u-boot-imx8mm-trusty.imx:
$(TARGET_COPY_OUT_VENDOR)/etc/bootloader0.img
See the i.MX Android Security User's Guide (ASUG) about how to sign the
bootloader0 image with CST. In the default configuration, an SPL image is copied to be
bootloader0.img because dual-bootloader is recomended.
You can implement your own postinstall command and perform the operations as needed
during the OTA process.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
text field, and "REBOOT_REQUIRED" in the Updater state text field. Finally, reboot
the board to finish the whole OTA update.
Note:
The OTA package includes the DTBO image, which stores the board's DTB. There may
be many DTS for one board. For example, in ${MY_ANDROID}/device/nxp/imx8m/
evk_8mm/BoardConfig.mk:
TARGET_BOARD_DTS_CONFIG ?= imx8mm-ddr4:imx8mm-ddr4-evk.dtb
TARGET_BOARD_DTS_CONFIG += imx8mm:imx8mm-evk-usd-wifi.dtb
TARGET_BOARD_DTS_CONFIG += imx8mm-mipi-panel:imx8mm-evk-
rm67199.dtb
TARGET_BOARD_DTS_CONFIG += imx8mm-mipi-panel-rm67191:imx8mm-
evk-rm67191.dtb
TARGET_BOARD_DTS_CONFIG += imx8mm-m4:imx8mm-evk-rpmsg.dtb
There is one variable to specify which DTBO image is stored in the OTA package:
BOARD_PREBUILT_DTBOIMAGE := out/target/product/evk_8mm/dtbo-
imx8mm.img
Therefore, the default OTA package can only be applied for evk_8mm with single MIPI-
DSI-to-HDMI display. To generate an OTA package for evk_8mm with rm67199 MIPI
panel display, modify this BOARD_PREBUILT_DTBOIMAGE as follows:
BOARD_PREBUILT_DTBOIMAGE := out/target/product/evk_8mm/dtbo-
imx8mm-mipi-panel.img
To generate an OTA package for evk_8mm with rm67191 MIPI panel display, modify this
BOARD_PREBUILT_DTBOIMAGE as follows:
BOARD_PREBUILT_DTBOIMAGE := out/target/product/evk_8mm/dtbo-
imx8mm-mipi-panel-rm67191.img
8 Customized Configuration
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
Note:
Because not all UVC cameras can have 1080P, 30FPS resolution setting, it is
recommended that media_profiles_480p.xml is used for any board's configuration,
which defines the UVC as the rear camera or front camera.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
8.1.3 Making cameras work on i.MX 8M Plus EVK with non-default images
The default image for i.MX 8M Plus EVK supports os08a20 + os08a20 and the cameras
can work after the image is flashed and boot up. To make cameras work with non-default
images, execute the following additional commands:
• Basler (CSI1) + OV5640 (CSI2) or only Basler (CSI1) on the host
# flash the image
sudo ./fastboot_imx_flashall.sh -f imx8mp -a -e -d basler-
ov5640 // or "-d basler" for Only basler(CSI1)
# set bootargs
# In serial console, enter into uboot command mode, run below
commads:
# If enable basler 4k size, also add
androidboot.camera.ispsensor.maxsize=4k.
setenv append_bootargs androidboot.camera.layout=basler-ov5640
saveenv
boota
• Only OV5640 (CSI1) on the host
# flash the image
sudo ./fastboot_imx_flashall.sh -f imx8mp -a -e -d ov5640
# set bootargs
# In serial console, enter into uboot command mode, run below
commad:
setenv append_bootargs androidboot.camera.layout=only-ov5640
saveenv
boota
Note:
-d ov5640 can be replaced by one of below:
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
# set bootargs
# In serial console, enter into uboot command mode, run below
commads:
# If enable os08a20 4k size, also add
androidboot.camera.ispsensor.maxsize=4k.
setenv append_bootargs androidboot.camera.layout=os08a20-
ov5640
saveenv
boota
• Basler (CSI1) + Basler (CSI2)
# flash the image
sudo ./fastboot_imx_flashall.sh -f imx8mp -a -e -d dual-basler
# set bootargs
# In serial console, enter into uboot command mode, run below
commad:
setenv append_bootargs androidboot.camera.layout=dual-basler
saveenv
boota
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
Perform the following steps to play audio in powersaving mode with the MCU image:
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
BOARD_KERNEL_CMDLINE += androidboot.lcd_density=240
The display density value can be changed by modifying the related lines mentioned
above in files under ${MY_ANDROID}/device/nxp/ and recompiling the code or
setting in U-Boot command line as bootargs during boot up.
Note:
• For the i.MX 8M Mini EVK board, the source folder is ${MY_ANDROID}/device/nxp/
imx8m/evk_8mm/BoardConfig.mk.
• For the i.MX 8M Nano EVK board, the source folder is ${MY_ANDROID}/device/
nxp/imx8m/evk_8mn/BoardConfig.mk.
• For the i.MX 8M Plus EVK board, the source folder is ${MY_ANDROID}/device/
nxp/imx8m/evk_8mp/BoardConfig.mk.
• For the i.MX 8MQuad EVK board, the source folder is ${MY_ANDROID}/device/
nxp/imx8m/evk_8mq/BoardConfig.mk.
• For the i.MX 8ULP EVK board, the source folder is ${MY_ANDROID}/device/nxp/
imx8ulp/evk_8ulp/BoardConfig.mk.
• For the i.MX 8QuadMax/8QuadXPlus MEK board, the source folder is ${MY_
ANDROID}/device/nxp/imx8q/mek_8q/BoardConfig.mk.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
The display port and input port are bound together based on the input device location
and display-ID. /vendor/etc/input-port-associations.xml is used to do this
work when the system is running, but the input device location and display-ID changes
with the change of connection forms of these ports with corresponding input and display
devices, which means the input location and display-ID need to be retrieved before the
connection is fixed.
The source file of /vendor/etc/input-port-associations.xml is in the
repository under the ${MY_ANDROID}/device/nxp/ directory.
Take i.MX 8M Plus EVK as an example:
1. Use the following commands to obtain the display port number:
dumpsys SurfaceFlinger --display-id
Display 4693505326422272 (HWC display 0): port=0 pnpId=DEL
displayName="DELL P2314T"
Display 4693505326422273 (HWC display 1): port=1 pnpId=DEL
displayName="DELL P2314T"
Display 4692921138614786 (HWC display 2): port=2 pnpId=DEL
displayName="DELL S2740L"
2. Use the following commands to obtain the touch input location:
getevent -i | grep location
location: "usb-xhci-hcd.0.auto-1.3.4/input0"
location: "usb-xhci-hcd.0.auto-1.2.4/input0"
location: "usb-xhci-hcd.0.auto-1.1.4/input0"
3. Bind the display port and input location as follows and modify the configuration file.
This file needs to be modified according to actual connection. One display port can
be bound with multiple input ports.
<ports>
<port display="0" input="usb-xhci-hcd.0.auto-1.1.4/
input0" />
<port display="1" input="usb-xhci-hcd.0.auto-1.2.4/
input0" />
<port display="2" input="usb-xhci-hcd.0.auto-1.3.4/
input0" />
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
</ports>
To make the modifications take effect, modify the source file under the
${MY_ANDROID}/device/nxp/ directory and rebuild the images. Keep the connection
of display devices and input devices unchanged and reflash the images. Or you can
disable DM-verity on the board and then use the adb push command to push the file to
the vendor partition to overwrite the original one.
<resources>
<bool name="profile_supported_a2dp">false</bool>
<bool name="profile_supported_a2dp_sink">true</bool>
</resources>
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
For i.MX 8QuadMax, to enable USB 2.0 for the u-boot-imx8qm.imx, make the
following changes under ${MY_ANDROID}/vendor/nxp-opensource/uboot-imx:
For i.MX 8QuadXPlus, to enable USB 2.0 for the u-boot-imx8qxp.imx, make the
following changes under ${MY_ANDROID}/vendor/nxp-opensource/uboot-imx:
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
#undef CONFIG_BOOTCOMMAND
More than one defconfig files are used to build U-Boot images for one platform. Make
the same changes on defconfig files as above to enable USB 2.0 for other U-Boot
images. You can use the following command under the ${MY_ANDROID}/vendor/nxp-
opensource/uboot-imx/ directory to list all the related defconfig files:
The USB Gadget functions in the U-Boot stage include fastboot and SPL Serial
Download Protocol (SDP).
The VID/PID values for fastboot are 0x1fc9/0x0152, they are configured with two
defconfig items as follows. They can be found in the defconfig file.
CONFIG_USB_GADGET_VENDOR_NUM=0x1fc9
CONFIG_USB_GADGET_PRODUCT_NUM=0x0152
The VID/PID values for SPL SDP are 0x1fc9/0x0151. The VID value is the same
as before, and the PID value is changed to 0x0151 with the following function. The
corresponding source code file is ${MY_ANDROID}/vendor/nxp-opensource/
uboot-imx/arch/arm/mach-imx/spl.c.
The UUU tool relies on the VID/PID value, the reference values can be found in the UUU
source code config.cpp. Therefoe, if the values are changed, UUU may not work. But the
U-Boot image used with UUU is not flashed to the board, so the one in prebuilt images
can be used during development if the VID/PID values need to be changed.
The are many VID/PID value sets on the Android platform. They are set in the USB
Gadget HAL with the following function. The corresponding source code file is ${MY_
ANDROID}/vendor/nxp-opensource/imx/usb/UsbGadget.cpp. Search the name
of the following function in the source code file. Different PID/VID values are used when
the Gadget provides different functions. Change the values based on your requirement.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
The USB Gadget functions in Recovery include adb and fastbootd. The VID/PID
values are set in ${MY_ANDROID}/bootable/recovery/etc/init.rc. The
following lines can be found in the file:
Then, build the images, and the tee-imx8mm.bin file are integrated into bootloader-
imx8mm-trusty-secure-unlock-dual.img, and bootloader-imx8mm-trusty-
dual.img.
Flash the spl-imx8mm-trusty-dual.bin and bootloader-imx8mm-trusty-
dual.img files to the target device.
Note:
• For i.MX 8M Nano EVK, it uses the same Trusty target as i.MX 8M Mini EVK.
Use make imx8mm to build the Trusty OS image, and copy the file lk.bin to
${MY_ANDROID}/vendor/nxp/fsl-proprietary/uboot-firmware/tee-
imx8mn.bin.
• For i.MX 8M Plus EVK, use make imx8mp to build the Trusty OS image, and copy
the file lk.bin to ${MY_ANDROID}/vendor/nxp/fsl-proprietary/ uboot-
firmware/tee-imx8mp.bin.
• For i.MX 8M Quad EVK, use make imx8m to build the Trusty OS image, and copy
the final lk.bin to ${MY_ANDROID}/vendor/nxp/fsl-proprietary/uboot-
firmware/imx8m/tee-imx8mq.bin.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
• For i.MX 8ULP EVK, use make imx8ulp to build the Trusty OS image, and copy
the final lk.bin to ${MY_ANDROID}/vendor/nxp/fsl-proprietary/uboot-
firmware/imx8ulp/tee-imx8ulp.bin.
• For i.MX 8QuadMax MEK, use make imx8qm to build the Trusty OS image, and copy
the final lk.bin to ${MY_ANDROID}/vendor/nxp/fsl-proprietary/uboot-
firmware/imx8q_car/tee-imx8qm.bin.
• For i.MX 8QuadXPlus MEK, use make imx8qxp to build the Trusty OS image, and
copy the final lk.bin to ${MY_ANDROID}/vendor/nxp/fsl-proprietary/
uboot-firmware/imx8q_car/tee-imx8qx.bin.
• ${TRUSTY_REPO_ROOT} is the root directory of the Trusty OS codebase.
• ${MY_ANDROID} is the root directory of the Android codebase.
– echo -n -e
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' >>
rpmb_key_test.bin
The \xHH means eight-bit character whose value is the hexadecimal value 'HH'. You
can replace "00" above with the key you want to set.
• Note:
For more details, see the i.MX Android Security User's Guide (ASUG).
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
The OpenSSL provides some commands to generate the private key. For example,
you can use the following commands to generate the RSA-4096 private key
test_rsa4096_private.pem:
The public key can be extracted from the private key. The avbtool in ${MY_ANDROID}/
external/avb supports such commands. You can get the public key
test_rsa4096_public.bin with the commands:
By default, the Android build system uses the algorithm SHA256_RSA4096 with
the private key from ${MY_ANDROID}/external/avb/test/data/testkey_
rsa4096.pem. This can be overwritten by setting the BOARD_AVB_ALGORITHM and
BOARD_AVB_KEY_PATH to use different algorithm and private key:
BOARD_AVB_ALGORITHM := <algorithm-type>
BOARD_AVB_KEY_PATH := <key-path>
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
Boot validates the public key first, and then uses the public key to authenticate the signed
vbmeta image.
The public key must be stored in the Trusty OS backed RPMB for Android if Trusty OS is
enabled. Perform the following steps to set the public key.
Make your board enter fastboot mode and enter the following commands on the host
side:
The public key test_rsa4096_public.bin should be extracted from the private key
you have specified. But if you do not specify any private key, you should set the public
key as prebuilt testkey_public_rsa4096.bin, which is extracted to form the
default private key testkey_rsa4096.pem.
${MY_ANDROID}/external/avb/test/data/testkey_rsa2048.pem
Custom keys should be used for production. See Section Section 8.6.2.1 to generate the
custom private key. The AVB boot key and algorithm can be overridden by setting the
following configurations:
BOARD_AVB_BOOT_ALGORITHM := <algorithm-type>
BOARD_AVB_BOOT_KEY_PATH := <key-path>
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
The SCFW porting kit contains prebuilt binaries, libraries, and configuration files. For
the board configuration file, take i.MX 8QuadXPlus MEK as an example, it is scfw_
export_mx8qx_b0/platform/board/mx8qx_mek/board.c. Based on this file,
some changes are made for Android and the file is stored in ${MY_ANDROID}/vendor/
nxp/fsl-proprietary/uboot-firmware/imx8q/board-imx8qxp.c.
You can copy board.c in vendor/nxp/fsl-proprietary to SCFW porting kit,
modify it, and then build the SCFW.
The following are steps to build Android SCFW (taking i.MX 8QuadXPlus as example):
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
1. Download GCC tool from the arm Developer GNU-RM Downloads page. It is
suggested to download the version of "6-2017-q2-update" as it is verified.
2. Unzip the GCC tool to /opt/scfw_gcc.
3. Export TOOLS="/opt/scfw-gcc".
4. Copy the board configuration file from ${MY_ANDROID}/vendor/nxp/fsl-p
roprietary/uboot-firmware/imx8q/board-imx8qxp.c to the porting kit.
cp ${MY_ANDROID}/vendor/nxp/fsl-proprietary/uboot-firmware/
imx8q/board-imx8qxp.c scfw_export_mx8qx_b0/platform/board/
mx8qx_mek/board.c
5. Build SCFW.
cd scfw_export_mx8qx_b0 # enter the directory just
uncompressed for i.MX 8QuadXPlus MEK
make clean
make qx R=B0 B=mek
6. Copy the SCFW binary to the uboot-firmware folder.
cp build_mx8qx_b0/scfw_tcm.bin ${MY_ANDROID}/vendor/nxp/fsl-
proprietary/uboot-firmware/imx8q/mx8qx-scfw-tcm.bin
7. Build the bootloader.
cd ${MY_ANDROID}
./imx-make.sh bootloader -j4
Note:
To build SCFW for i.MX 8QuadMax MEK, use qm to replace qx in the steps above.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
BOARD_SUPER_PARTITION_SIZE := 4294967296
BOARD_NXP_DYNAMIC_PARTITIONS_SIZE := 4284481536
Refer to the following patch to change the super partition size to 4 GB:
else
- BOARD_SUPER_PARTITION_SIZE := 4294967296
- BOARD_NXP_DYNAMIC_PARTITIONS_SIZE := 4284481536
+ BOARD_SUPER_PARTITION_SIZE := 3758096384
+ BOARD_NXP_DYNAMIC_PARTITIONS_SIZE := 3747610624
endif
ifeq ($(IMX_NO_PRODUCT_PARTITION),true)
BOARD_NXP_DYNAMIC_PARTITIONS_PARTITION_LIST := system
system_ext vendor
Then, the images can be pushed to the board with the adb push command. Before the
further debugging work, be aware of the following notices:
• Do not erase the "userdata" partition after adb disable-verity is executed.
With the dynamic partition feature enabled in i.MX Android images, and the size is not
specified for system, system_ext, vendor, and product partitions when building
the images. overlayfs is used when remounting the read-only filesystems. An upper
directory that can be written in overlayfs is needed in this condition. When the adb
push command is executed, the files are pushed to the upper directory of overlayfs,
while the original read-only filesystems are not modified.
i.MX Android images use only one partition named "super" to store images in logical
partitions, and ext4 filesystem is used for the userdata partition, which is mounted on
/data. When executing the adb disable-verity command, an image is allocated
under /data/gsi/remount/scratch.img.0000. Its size is half the size of the
"super" partition and should not be greater than 2 GB. The layout information of this
image is stored in /metadata/gsi/remount/lpmetadata in the format logical
partition metadata.
When rebooting the system, at the first stage of the init program, the information in /
metadata/gsi/remount/lpmetadata is used to create a logical partition named
"scratch", and it is mounted on /mnt/scratch. This is used as the upper directory in
overlayfs used in remount. When the adb push command is executed to modify the
originally read-only filesystems, files are written to the "scratch" partition.
At the first stage of the init program, the userdata partition is not mounted. The code
judges whether the backing image of the scratch partition exists in the userdata
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
Similar to the condition of images for MEK boards, the images for i.MX 8M Plus EVK
board support different Cameras, which require different configurations. The different
configuration files have the same name, and need to be accessed from the same
directory of /vendor/etc/configs/isp, so overlayfs is used and mounted on this
directory for some camera usgages, and this directory is still read-only after remount.
The mount commands can be found in ${MY_ANDROID}/device/nxp/imx8m/evk_
8mp/init.rc.
# default is for dual os08a20
on property:ro.boot.camera.layout=""
mount overlay overlay /vendor/etc/configs/isp ro
lowerdir=/vendor/vendor_overlay_sensor/os08a20/vendor/etc/
configs/isp:/vendor/etc/configs/isp,override_creds=off
on property:ro.boot.camera.layout=os08a20-ov5640
setprop ro.media.xml_variant.profiles _8mp-ispsensor-
ov5640
mount overlay overlay /vendor/etc/configs/isp ro
lowerdir=/vendor/vendor_overlay_sensor/os08a20/vendor/etc/
configs/isp:/vendor/etc/configs/isp,override_creds=off
on property:ro.boot.camera.layout=dual-basler
mount overlay overlay /vendor/etc/configs/isp ro
lowerdir=/vendor/vendor_overlay_sensor/basler/vendor/etc/
configs/isp:/vendor/etc/configs/isp,override_creds=off
Files need to be pushed to the following directories based on the camera you are
debugging with:
– /vendor/vendor_overlay_sensor/basler/vendor/etc/configs/isp
– /vendor/vendor_overlay_sensor/os08a20/vendor/etc/configs/isp
The limitations described in the preceding part for MEK images also exist in the images
for i.MX 8M Plus EVK board:
– To delete a file under /vendor/etc/configs/isp, you can only rebuild the image
and flash the vendor image again.
– The overlayfs is mounted with a command in an init .rc file. The init .rc
files are all parsed by init before the overlayfs is mounted. Therefore, to modify
init .rc files under /vendor/etc/configs/isp, you can only rebuild the
image and flash the vendor image again.
If only one kind of camera usage is needed, the overlayfs mount commands can be
removed from the init.rc file and put the corresponding config files directly under /
vendor/etc/configs/isp.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
|| [ ${TARGET_PRODUCT} = "evk_8ulp" ] \
|| [ ${TARGET_PRODUCT} = "evk_8mm" ] || [ ${TARGET_PRODUCT} =
"evk_8mq" ]; then
mv ${OUT}/boot.img ${OUT}/boot-imx.img
make bootimage
fi
To build boot-imx.img, run ./imx-make.sh or TARGET_IMX_KERNEL=true make
bootimage && mv ${OUT}/boot.img ${OUT}/boot-imx.img.
• Kernel defconfig
Kernel .config is generated by one generic gki_defconfig along with one board
specific config, like imx8mm_gki.fragment.
• Driver modules
As GKI requires, all vendor drivers need to be built as module. Their configurations are
set to m in above-mentioned board specific configuration file.
In addition, explicitly install those modules on board by adding them to the following two
Android predefined macros. For example, see ${MY_ANDROID}/device/nxp/imx8m
/evk_8mm/SharedBoardConfig.mk:
– BOARD_VENDOR_RAMDISK_KERNEL_MODULES
Modules under this macro are copied to ${MY_ANDROID}/out/target/
product/evk_8mm/vendor_ramdisk/lib/modules, and then built as
vendor_boot.img.
They are installed to the kernel in the first stage of initialization. In general, put
essential modules here and be careful of the sequence.
– BOARD_VENDOR_KERNEL_MODULES
Modules under this macro are copied to ${MY_ANDROID}/out/target/product/
evk_8mm/vendor/lib/modules, and then built as vendor.img.
They are installed later than vendor_ramdisk, after the Android file system is
ready.
+$(KERNEL_OUT)/crypto/lzo.ko \
+$(KERNEL_OUT)/crypto/lzo-rle.ko \
+$(KERNEL_OUT)/drivers/block/zram/zram.ko \
$(KERNEL_OUT)/drivers/soc/imx/soc-imx8m.ko \
Note: If other driver modules depend on them, put them before others.
3. Fix symbol issues.
If some symbols are not exported but used by the added driver modules, perform the
following steps to export them:
a. Export symbols with EXPORT_SYMBOL_GPL(xxx).
Note: If symbols are in core kernel code (which means not in loadable modules),
such changes must upstream to the AOSP GKI Kernel tree.
b. Add symbols to the AOSP GKI Kernel tree android/abi_gki_aarch64.xml.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
BUILD_CONFIG=common/build.config.gki.aarch64 build/
build_abi.sh LTO=thin --update -j8
Then, common/android/abi_gki_aarch64.xml is updated.
3. Build Android boot.img locally.
cp gki/out/android13-5.15/common/arch/arm64/boot/Image \
${MY_ANDROID}/out/target/product/evk_8mm/kernel
cd ${MY_ANDROID}
TARGET_IMX_KERNEL=true make bootimage
# Then the boot.img built locally will export those symbols
4. If you want AOSP released GKI image to export these symbols, upstream the two
files to AOSP:
android/abi_gki_aarch64_imx android/abi_gki_aarch64.xml
./imx-make.sh bootimage
or
make bootimage
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
11 Revision History
Revision history
Revision number Date Substantive changes
P9.0.0_1.0.0-beta 11/2018 Initial release
P9.0.0_1.0.0-ga 01/2019 i.MX 8M, i.MX 8QuadMax, i.MX 8QuadXPlus GA
release.
P9.0.0_2.0.0-ga 04/2019 i.MX 8M, i.MX 8QuadMax, i.MX 8QuadXPlus GA
release.
P9.0.0_2.0.0-ga 08/2019 Updated the location of the SCFW porting kit.
android-10.0.0_1.0.0 02/2020 i.MX 8M Mini, i.MX 8M Quad, i.MX 8QuadMax, and i.
MX 8QuadXPlus GA release.
android-10.0.0_1.0.0 03/2020 Deleted the Android 10 image.
android-10.0.0_2.1.0 04/2020 i.MX 8M Plus Alpha and i.MX 8QuadXPlus Beta
release.
android-10.0.0_2.0.0 05/2020 i.MX 8M Mini, i.MX 8M Nano, i.MX 8M Quad, i.MX
8QuadMax, and i.MX 8QuadXPlus GA release.
android-10.0.0_2.3.0 07/2020 i.MX 8M Plus EVK Beta1 release, and all the other i.
MX 8 GA release.
android-11.0.0_1.0.0 12/2020 i.MX 8M Plus EVK Beta release, and all the other i.
MX 8 GA release.
android-11.0.0_2.0.0 04/2021 i.MX 8M Mini, i.MX 8M Nano, i.MX 8M Plus, and i.MX
8M Quad GA release.
android-11.0.0_2.2.0 07/2021 i.MX 8M Mini, i.MX 8M Nano, i.MX 8M Plus, and i.MX
8M Quad GA release.
android-11.0.0_2.4.0 10/2021 i.MX 8ULP EVK Alpha release, i.MX 8M Mini, i.MX
8M Nano, i.MX 8M Plus, and i.MX 8M Quad GA
release.
android-11.0.0_2.6.0 01/2022 i.MX 8ULP EVK Beta release, i.MX 8M Mini, i.MX 8M
Nano, i.MX 8M Plus, and i.MX 8M Quad GA release.
android-12.0.0_1.0.0 03/2022 i.MX 8ULP EVK Beta release, i.MX 8M Mini, i.MX 8M
Nano, i.MX 8M Plus, and i.MX 8M Quad GA release.
android-12.0.0_2.0.0 07/2022 i.MX 8ULP EVK Beta release, i.MX 8M Mini, i.MX 8M
Nano, i.MX 8M Plus, and i.MX 8M Quad GA release.
android-12.1.0_1.0.0 10/2022 i.MX 8ULP EVK Beta release, i.MX 8M Mini, i.MX
8M Nano, i.MX 8M Plus, i.MX 8M Quad, i.MX 8Quad
Max, and i.MX 8QuadXPlus GA release.
android-13.0.0_1.0.0 01/2023 i.MX 8ULP EVK Beta release, i.MX 8M Mini, i.MX
8M Nano, i.MX 8M Plus, i.MX 8M Quad, i.MX 8Quad
Max, and i.MX 8QuadXPlus GA release.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
12 Legal information
12.1 Definitions Terms and conditions of commercial sale — NXP Semiconductors
products are sold subject to the general terms and conditions of commercial
sale, as published at http://www.nxp.com/profile/terms, unless otherwise
Draft — A draft status on a document indicates that the content is still agreed in a valid written individual agreement. In case an individual
under internal review and subject to formal approval, which may result agreement is concluded only the terms and conditions of the respective
in modifications or additions. NXP Semiconductors does not give any agreement shall apply. NXP Semiconductors hereby expressly objects to
representations or warranties as to the accuracy or completeness of applying the customer’s general terms and conditions with regard to the
information included in a draft version of a document and shall have no purchase of NXP Semiconductors products by customer.
liability for the consequences of use of such information.
Export control — This document as well as the item(s) described herein
may be subject to export control regulations. Export might require a prior
12.2 Disclaimers authorization from competent authorities.
Limited warranty and liability — Information in this document is believed Suitability for use in non-automotive qualified products — Unless
to be accurate and reliable. However, NXP Semiconductors does not give this data sheet expressly states that this specific NXP Semiconductors
any representations or warranties, expressed or implied, as to the accuracy product is automotive qualified, the product is not suitable for automotive
or completeness of such information and shall have no liability for the use. It is neither qualified nor tested in accordance with automotive testing
consequences of use of such information. NXP Semiconductors takes no or application requirements. NXP Semiconductors accepts no liability for
responsibility for the content in this document if provided by an information inclusion and/or use of non-automotive qualified products in automotive
source outside of NXP Semiconductors. equipment or applications.
In no event shall NXP Semiconductors be liable for any indirect, incidental, In the event that customer uses the product for design-in and use in
punitive, special or consequential damages (including - without limitation - automotive applications to automotive specifications and standards,
lost profits, lost savings, business interruption, costs related to the removal customer (a) shall use the product without NXP Semiconductors’ warranty
or replacement of any products or rework charges) whether or not such of the product for such automotive applications, use and specifications, and
damages are based on tort (including negligence), warranty, breach of (b) whenever customer uses the product for automotive applications beyond
contract or any other legal theory. NXP Semiconductors’ specifications such use shall be solely at customer’s
own risk, and (c) customer fully indemnifies NXP Semiconductors for any
Notwithstanding any damages that customer might incur for any reason
liability, damages or failed product claims resulting from customer design and
whatsoever, NXP Semiconductors’ aggregate and cumulative liability
use of the product for automotive applications beyond NXP Semiconductors’
towards customer for the products described herein shall be limited in
standard warranty and NXP Semiconductors’ product specifications.
accordance with the Terms and conditions of commercial sale of NXP
Semiconductors.
Translations — A non-English (translated) version of a document, including
the legal information in that document, is for reference only. The English
Right to make changes — NXP Semiconductors reserves the right to
version shall prevail in case of any discrepancy between the translated and
make changes to information published in this document, including without
English versions.
limitation specifications and product descriptions, at any time and without
notice. This document supersedes and replaces all information supplied prior
Security — Customer understands that all NXP products may be subject to
to the publication hereof.
unidentified vulnerabilities or may support established security standards or
specifications with known limitations. Customer is responsible for the design
Suitability for use — NXP Semiconductors products are not designed,
and operation of its applications and products throughout their lifecycles
authorized or warranted to be suitable for use in life support, life-critical or
to reduce the effect of these vulnerabilities on customer’s applications
safety-critical systems or equipment, nor in applications where failure or
and products. Customer’s responsibility also extends to other open and/or
malfunction of an NXP Semiconductors product can reasonably be expected
proprietary technologies supported by NXP products for use in customer’s
to result in personal injury, death or severe property or environmental
applications. NXP accepts no liability for any vulnerability. Customer should
damage. NXP Semiconductors and its suppliers accept no liability for
regularly check security updates from NXP and follow up appropriately.
inclusion and/or use of NXP Semiconductors products in such equipment or
applications and therefore such inclusion and/or use is at the customer’s own Customer shall select products with security features that best meet rules,
risk. regulations, and standards of the intended application and make the
ultimate design decisions regarding its products and is solely responsible
for compliance with all legal, regulatory, and security related requirements
Applications — Applications that are described herein for any of these
concerning its products, regardless of any information or support that may be
products are for illustrative purposes only. NXP Semiconductors makes no
provided by NXP.
representation or warranty that such applications will be suitable for the
specified use without further testing or modification. NXP has a Product Security Incident Response Team (PSIRT) (reachable
at [email protected]) that manages the investigation, reporting, and solution
Customers are responsible for the design and operation of their
release to security vulnerabilities of NXP products.
applications and products using NXP Semiconductors products, and NXP
Semiconductors accepts no liability for any assistance with applications or
customer product design. It is customer’s sole responsibility to determine
whether the NXP Semiconductors product is suitable and fit for the
customer’s applications and products planned, as well as for the planned
12.3 Trademarks
application and use of customer’s third party customer(s). Customers should
Notice: All referenced brands, product names, service names, and
provide appropriate design and operating safeguards to minimize the risks
trademarks are the property of their respective owners.
associated with their applications and products.
NXP Semiconductors does not accept any liability related to any default, NXP — wordmark and logo are trademarks of NXP B.V.
damage, costs or problem which is based on any weakness or default
in the customer’s applications or products, or the application or use by
customer’s third party customer(s). Customer is responsible for doing all
necessary testing for the customer’s applications and products using NXP
Semiconductors products in order to avoid a default of the applications
and the products or of the application or use by customer’s third party
customer(s). NXP does not accept any liability in this respect.
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
Contents
1 Overview .............................................................. 2 7.2.1 Using update_engine_client to update the
2 Preparation .......................................................... 2 Android platform .............................................. 44
2.1 Setting up your computer .................................. 2 7.2.2 Using a customized application to update
2.2 Unpacking the Android release package ........... 3 the Android platform ........................................ 45
3 Building the Android Platform for i.MX ............. 3 8 Customized Configuration ............................... 47
3.1 Getting i.MX Android release source code ........ 3 8.1 Camera configuration ...................................... 47
3.2 Building Android images ....................................4 8.1.1 Configuring the rear and front cameras ........... 48
3.2.1 Configuration examples of building i.MX 8.1.2 Configuring camera sensor parameters ...........48
devices ...............................................................9 8.1.3 Making cameras work on i.MX 8M Plus
3.2.2 Build mode selection ......................................... 9 EVK with non-default images .......................... 49
3.2.3 Building with GMS package .............................10 8.2 Audio configuration .......................................... 50
3.3 Building an Android image With Docker .......... 11 8.2.1 Enabling low-power audio ............................... 50
3.4 Building U-Boot images ................................... 12 8.2.2 Supporting a new sound card ..........................51
3.5 Building a kernel image ................................... 12 8.2.3 Enabling powersave mode .............................. 53
3.6 Building boot.img ............................................. 13 8.3 Display configuration ....................................... 54
3.7 Building dtbo.img ............................................. 13 8.3.1 Configuring the logical display density .............55
4 Running the Android Platform with a 8.3.2 Enabling multiple-display function ................... 55
Prebuilt Image ................................................... 14 8.3.2.1 Binding the display port with the input port ...... 56
5 Programming Images ....................................... 26 8.3.2.2 Launching applications on different displays ....57
5.1 System on eMMC/SD ...................................... 27 8.4 Wi-Fi/Bluetooth configuration ...........................57
5.1.1 Storage partitions .............................................27 8.4.1 Enabling or disabling Bluetooth profile .............57
5.1.2 Downloading images with UUU ....................... 29 8.5 USB configuration ............................................57
5.1.3 Downloading images with fastboot_imx_ 8.5.1 Enabling USB 2.0 in U-Boot for i.MX
flashall script ....................................................30 8QuadMax/8QuadXPlus MEK ......................... 57
5.1.4 Downloading a single image with fastboot ....... 31 8.5.2 Changing the VID/PID values of the USB
6 Booting ...............................................................32 Gadget ............................................................. 59
6.1 Booting from SD/eMMC ...................................32 8.5.2.1 USB Gadget in U-Boot .................................... 59
6.1.1 Booting from SD/eMMC on the i.MX 8M 8.5.2.2 USB Gadget on the Android platform .............. 59
Mini EVK board ............................................... 32 8.5.2.3 USB Gadget in Recovery ................................ 60
6.1.2 Booting from SD/eMMC on the i.MX 8M 8.6 Trusty OS/security configuration ......................60
Nano board ......................................................33 8.6.1 Initializing the secure storage for Trusty OS .... 61
6.1.3 Booting from SD/eMMC on the i.MX 8M 8.6.2 Provisioning the AVB key ................................ 62
Plus EVK board ............................................... 33 8.6.2.1 Generating the AVB key to sign images .......... 62
6.1.4 Booting from SD/eMMC on the i.MX 8M 8.6.2.2 Storing the AVB public key to a secure
Quad EVK board ............................................. 34 storage ............................................................. 63
6.1.5 Booting from eMMC on the i.MX 8ULP EVK 8.6.3 AVB boot key ...................................................63
board ................................................................35 8.6.4 Key attestation .................................................63
6.1.6 Booting from SD/eMMC on the i.MX 8.7 SCFW configuration .........................................64
8QuadMax MEK board .................................... 35 8.8 Miscellaneous configurations ...........................65
6.1.7 Booting from SD/eMMC on the i.MX 8.8.1 Changing the boot command line in
8QuadXPlus MEK board ................................. 35 boot.img ........................................................... 65
6.2 Boot-up configurations .....................................36 8.8.2 Modifying the super partition ........................... 66
6.2.1 U-Boot environment .........................................36 8.9 Notices before the debugging work ................. 67
6.2.2 Kernel command line (bootargs) ......................37 9 Generic Kernel Image (GKI) Development ...... 70
6.2.3 DM-verity configuration ....................................40 9.1 GKI introduction ............................................... 70
7 Over-The-Air (OTA) Update .............................. 40 9.2 Changes after GKI enabled ............................. 70
7.1 Building OTA update packages ....................... 40 9.3 How to add new drivers ...................................71
7.1.1 Building target files .......................................... 40 9.4 How to build GKI locally .................................. 72
7.1.2 Building a full update package ........................ 41 9.5 How to export new symbols ............................ 73
7.1.3 Building an incremental update package ......... 41 9.6 How to update the GKI image ......................... 74
7.1.4 Building an OTA package for single- 10 Note About the Source Code in the
bootloader image ............................................. 42 Document ...........................................................74
7.1.5 Building an OTA package with postinstall 11 Revision History ................................................75
command ......................................................... 43 12 Legal information .............................................. 76
7.2 Implementing OTA update ............................... 44
AUG All information provided in this document is subject to legal disclaimers. © 2023 NXP B.V. All rights reserved.
Please be aware that important notices concerning this document and the product(s)
described herein, have been included in section 'Legal information'.