imx8开发之~源码编译

首先要下载相关的工具链

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 文件如下:
imx8开发之~源码编译_第1张图片
编译 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

你可能感兴趣的:(android)