During development process, you would typically use plain m with no particular target to compile Android sources. (See Build your development images.) However, when you prepare for release, you must use the target dist to generate the proper release images. To do so, follow these steps:

1. Set up your environment and install the sources. If you have not already done so, see Set up your development workstation and Install Digi Embedded for Android.

2. Change to the directory where the source code is installed.

``$cd dea-11.0-r2`` 3. Initialize the build environment: ``$ source build/envsetup.sh``
4. Select a ConnectCore 8M Mini target to build:

• ccimx8mmdvk-user creates images with no root access, suitable for production.

• ccimx8mmdvk-userdebug like user images but with root access and debug capability.

For production, use user build type:

``````$lunch ccimx8mmdvk-user ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=11 TARGET_PRODUCT=ccimx8mmdvk TARGET_BUILD_VARIANT=user TARGET_BUILD_TYPE=release TARGET_ARCH=arm64 TARGET_ARCH_VARIANT=armv8-a TARGET_CPU_VARIANT=cortex-a53 TARGET_2ND_ARCH=arm TARGET_2ND_ARCH_VARIANT=armv7-a-neon TARGET_2ND_CPU_VARIANT=cortex-a9 HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-4.15.0-142-generic-x86_64-Ubuntu-18.04.5-LTS HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=RP1A.201005.004 OUT_DIR=out PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl external/mesa3d vendor/nxp-opensource/imx/power hardware/google/pixel vendor/partner_gms hardware/google/camera vendor/nxp-opensource/imx/camera ============================================$ ``````
5. Build the kernel and U-Boot images

``$./imx-make.sh bootloader kernel -j<Number_Of_Jobs>``  The command make can handle parallel tasks with a -jN argument, and it’s common to use a number of tasks N that’s between 1 and 2 times the number of hardware threads on the computer used for the build. This generates several artifacts inside the out/target/product/ccimx8mmdvk folder of the dea-11.0-r2 directory. The bootloader images are required to program your device: • u-boot-ccimx8mmdvk.imx: Bootloader image without Trusty. • u-boot-ccimx8mmdvk-trusty.imx: Bootloader image with Trusty. See Secure boot. 6. Use dist target to generate the release images: ``$ make -j<Number_Of_Jobs> dist``

It compiles the whole source tree, as a plain make does. Then it generates several zip files inside the out/dist folder of the dea-11.0-r2 directory:

• ccimx8mmdvk-target_files-<build_id>.zip contains all the target files (apk, binaries, libraries, etc.) that will go into the final release package.

You will use this file later on to get privately signed artifacts. The next step is to Sign for release.

• ccimx8mmdvk-ota-<build_id>.zip is an OTA update package that can be installed through recovery. It is a full update package with all the files needed by system, boot, vendor, and recovery partition.

You can use it during testing or development, but not as a final distributable artifact as it is signed with non-private keys.

• ccimx8mmdvk-apps-<build_id>.zip contains all the apks.

• ccimx8mmdvk-img-<build_id>.zip contains image files boot, dtbo, partition-table, super, vbmeta, and vendor_boot.

The images inside are using test-keys, use them only for development purposes.

• ccimx8mmdvk-symbols-<build_id>.zip contains all files in out/target/product/ccimx8mmdvk/symbols.

 All these files are signed using test-keys. These keys are insecure because they are distributed with the code. For this reason, these generated files should not be use for production. You must sign the ccimx8mmdvk-target_files-.zip file with your own private key to, later, generate your release images and/or update package. See Sign for release.