首先要下載相關的工具鏈
In addition to the packages requested on the Android website, the following packages are also needed:
$ sudo apt-get install uuid uuid-dev
$ sudo apt-get install zlib1g-dev liblz-dev
$ sudo apt-get install liblzo2-2 liblzo2-dev
$ sudo apt-get install lzop
$ sudo apt-get install git-core curl
$ sudo apt-get install u-boot-tools
$ sudo apt-get install mtd-utils
$ sudo apt-get install android-tools-fsutils
$ sudo apt-get install openjdk-8-jdk
$ sudo apt-get install device-tree-compiler
$ sudo apt-get install gdisk
注意的是如果Ubuntu 系統中已經安裝了java7 ,現在編譯imx8 需要java8.記得java要切換到java 8.
編譯Android system
$ source build/envsetup.sh
$ lunch mek_8q-userdebug
$ make 2>&1 | tee build-log.txt
如果電腦配置不好,編譯時間比較漫長 ,大概5小時。如果又任何錯誤 可以查看 build-log.txt 獲得詳細信息
編譯完成後 生成img 文件如下:
編譯 ota 升級版命令 ,生成升級包就是上圖的標紅的文件
make otapackage
編譯uboot
You can use this command to generate u-boot.imx under the Android environment:
# U-Boot image for i.MX 8QuadMax/8QuadXPlus MEK board:
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ lunch mek_8q-userdebug
$ make bootloader -j4
生成kernelimg
Kernel image is automatically built when building the Android root file system.
The following are the default Android build commands to build the kernel image:
$ cd ${MY_ANDROID}/vendor/nxp-opensource/kernel_imx
$ echo $ARCH && echo $CROSS_COMPILE
Make sure that you have those two environment variables set. If the two variables are not set, set them as follows:
$ export ARCH=arm64
$ export CROSS_COMPILE=${MY_ANDROID}/prebuilts/gcc/linux-x86/aarch64/aarch64-linuxandroid-
4.9/bin/aarch64-linux-android-
android_defconfig.
# to build the kernel zImage for i.MX 8QuadMax/8QuadXPlus
$ make android_defconfig
$ make KCFLAGS=-mno-android
# to build the zImage which is used in MfgTOOL
# zImage is under mfgtools\Profiles\Linux\OS Firmware\firmware\
$ make defconfig
$ make KCFLAGS=-mno-android -j4
The kernel images are found in ${MY_ANDROID}/out/target/product/mek_8q/obj/KERNEL_OBJ/arch/arm64/boot/Image.
最後生成bootimage
# Boot image for i.MX 8MQuad EVK board
$ source build/envsetup.sh
$ lunch mek_8q-userdebug
$ make bootimage
Building dtbo.img
Dtbo image holds the board's device tree binary.
Use the following commands to generate dtbo.img under the Android environment:
# dtbo image for the i.MX 8QuadMax/8QuadXPlus MEK board
$ cd ${MY_ANDROID}
$ source build/envsetup.sh
$ lunch mek_8q-userdebug
$ make dtboimage -j4