I.MX6 Android 5.1 快速合成系统

/****************************************************************************
 *                     I.MX6 Android 5.1 快速合成系统
 * 说明:
 *     Android源代码编译系统是一件很痛苦的事,主要是在修改了一些很小的东西,但
 * 要重新编译,要等很久才能编译完,如使用了mmm编译完,只是要打包一下system.img
 * 就行了,没必要去做那么多检查编译工作,所以这里跟一下系统合成原来,再精简
 * 一下,做一个快速合成系统的工具:a51m(shell 脚本)。
 *
 *                                         2016-11-10 深圳 南山平山村 曾剑锋
 ***************************************************************************/

                \\\\\\\\\\\\\\\\\-*-目录-*-//////////////////
                |  一、Android 5.1 生成U-Boot信息解析
                |  二、Android 5.1 完整生成img镜像信息
                |  三、Android 5.1 生成内核信息解析
                |  四、解读 Target boot image
                |  五、解读 Making recovery image
                |  六、解读 Target system fs image
                |  七、a51m脚本
                --------------------------------------------

一、Android 5.1 生成U-Boot信息解析:
    1. 命令行输出信息如下:
        for ubootplat in imx6q:mx6qsabresdandroid_config imx6dl:mx6dlsabresdandroid_config imx6qp:mx6qpsabresdandroid_config; do \
                UBOOT_PLATFORM=`echo $ubootplat | cut -d':' -f1`; \
                UBOOT_CONFIG=`echo $ubootplat | cut -d':' -f2`; \
                echo ; \
                echo ; \
                make -C bootable/bootloader/uboot-imx/ distclean ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-; \
                make -C bootable/bootloader/uboot-imx/ $UBOOT_CONFIG ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-; \
                make -C bootable/bootloader/uboot-imx/ ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-; \
                install -D bootable/bootloader/uboot-imx/u-boot.imx out/target/product/sabresd_6dq/u-boot-$UBOOT_PLATFORM.imx; \
                install -D bootable/bootloader/uboot-imx/u-boot.imx out/target/product/sabresd_6dq/u-boot.imx; \
            done
    2. 整理并解读代码如下:
        for ubootplat in imx6q:mx6qsabresdandroid_config imx6dl:mx6dlsabresdandroid_config imx6qp:mx6qpsabresdandroid_config; do
            # 获取平台类型
            UBOOT_PLATFORM=`echo $ubootplat | cut -d':' -f1`;
            # 获取配置文件名
            UBOOT_CONFIG=`echo $ubootplat | cut -d':' -f2`;
            echo ;
            echo ;
            # 清空之前的编译
            make -C bootable/bootloader/uboot-imx/ distclean ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-;
            # 重新配置
            make -C bootable/bootloader/uboot-imx/ $UBOOT_CONFIG ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-;
            # 编译
            make -C bootable/bootloader/uboot-imx/ ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-;
            # 拷贝
            install -D bootable/bootloader/uboot-imx/u-boot.imx out/target/product/sabresd_6dq/u-boot-$UBOOT_PLATFORM.imx;
            # 拷贝
            install -D bootable/bootloader/uboot-imx/u-boot.imx out/target/product/sabresd_6dq/u-boot.imx;
        done

二、Android 5.1 完整生成img镜像信息:
    Target ram disk: out/target/product/sabresd_6dq/ramdisk.img
    Target boot image: out/target/product/sabresd_6dq/boot.img
    for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do \
                    DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`; \
                    DTS_BOARD=`echo $dtsplat | cut -d':' -f2`; \
                    BOOT_IMAGE_BOARD=out/target/product/sabresd_6dq/boot-$DTS_PLATFORM.img; \
                    out/host/linux-x86/bin/mkbootimg  --kernel out/target/product/sabresd_6dq/kernel --ramdisk out/target/product/sabresd_6dq/ramdisk.img --cmdline "console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M" --base 0x14000000 --second out/target/product/sabresd_6dq/$DTS_BOARD  --output out/target/product/sabresd_6dq/boot.img; \
            out/host/linux-x86/bin/boot_signer /boot out/target/product/sabresd_6dq/boot.img build/target/product/security/verity.pk8 build/target/product/security/verity.x509.pem out/target/product/sabresd_6dq/boot.img; \
                      size=$(for i in out/target/product/sabresd_6dq/boot.img; do stat --format "%s" "$i" | tr -d '\n'; echo +; done; echo 0); total=$(( $( echo "$size" ) )); printname=$(echo -n "out/target/product/sabresd_6dq/boot.img" | tr " " +); img_blocksize=4224; twoblocks=$((img_blocksize * 2)); onepct=$(((((17301504 / 100) - 1) / img_blocksize + 1) * img_blocksize)); reserve=$((twoblocks > onepct ? twoblocks : onepct)); maxsize=$((17301504 - reserve)); echo "$printname maxsize=$maxsize blocksize=$img_blocksize total=$total reserve=$reserve"; if [ "$total" -gt "$maxsize" ]; then echo "error: $printname too large ($total > [17301504 - $reserve])"; false; elif [ "$total" -gt $((maxsize - 32768)) ]; then echo "WARNING: $printname approaching size limit ($total now; limit $maxsize)"; fi ; \
                    cp -f out/target/product/sabresd_6dq/boot.img $BOOT_IMAGE_BOARD; \
            done
    out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8189223 reserve=173184
    out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8189223 reserve=173184
    out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8189223 reserve=173184
    out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8191271 reserve=173184
    ----- Making recovery image ------
    Copying baseline ramdisk...
    Modifying ramdisk contents...
    for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do \
            DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`; \
            DTS_BOARD=`echo $dtsplat | cut -d':' -f2`; \
            RECOVERY_IMAGE_BOARD=out/target/product/sabresd_6dq/recovery-$DTS_PLATFORM.img; \
            out/host/linux-x86/bin/mkbootimg  --kernel out/target/product/sabresd_6dq/kernel  --ramdisk out/target/product/sabresd_6dq/ramdisk-recovery.img --cmdline "console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M" --base 0x14000000 --second out/target/product/sabresd_6dq/$DTS_BOARD  --output out/target/product/sabresd_6dq/recovery.img; \
            if [ true = true ]; then \
            out/host/linux-x86/bin/boot_signer /recovery out/target/product/sabresd_6dq/recovery.img build/target/product/security/verity.pk8 build/target/product/security/verity.x509.pem out/target/product/sabresd_6dq/recovery.img; \
            fi;\
              size=$(for i in out/target/product/sabresd_6dq/recovery.img; do stat --format "%s" "$i" | tr -d '\n'; echo +; done; echo 0); total=$(( $( echo "$size" ) )); printname=$(echo -n "out/target/product/sabresd_6dq/recovery.img" | tr " " +); img_blocksize=4224; twoblocks=$((img_blocksize * 2)); onepct=$(((((17301504 / 100) - 1) / img_blocksize + 1) * img_blocksize)); reserve=$((twoblocks > onepct ? twoblocks : onepct)); maxsize=$((17301504 - reserve)); echo "$printname maxsize=$maxsize blocksize=$img_blocksize total=$total reserve=$reserve"; if [ "$total" -gt "$maxsize" ]; then echo "error: $printname too large ($total > [17301504 - $reserve])"; false; elif [ "$total" -gt $((maxsize - 32768)) ]; then echo "WARNING: $printname approaching size limit ($total now; limit $maxsize)"; fi ; \
            cp -f out/target/product/sabresd_6dq/recovery.img $RECOVERY_IMAGE_BOARD; \
        done
    out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8797484 reserve=173184
    out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8797484 reserve=173184
    out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8797484 reserve=173184
    out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8799532 reserve=173184
    ----- Made recovery image: out/target/product/sabresd_6dq/recovery.img --------
    Installed file list: out/target/product/sabresd_6dq/installed-files.txt
    Target system fs image: out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img
    make_ext4fs -s -T -1 -S out/target/product/sabresd_6dq/root/file_contexts -l 374476800 -a system out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/sabresd_6dq/system
    Creating filesystem with parameters:
        Size: 374476800
        Block size: 4096
        Blocks per group: 32768
        Inodes per group: 7632
        Inode size: 256
        Journal blocks: 1428
        Label:
        Blocks: 91425
        Block groups: 3
        Reserved block group size: 23
    Created filesystem with 1304/22896 inodes and 79090/91425 blocks
    Running:  mkuserimg.sh -s out/target/product/sabresd_6dq/system out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 374476800 out/target/product/sabresd_6dq/root/file_contexts
    build_verity_tree -A aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity.img
    system/extras/verity/build_verity_metadata.py 374476800 /tmp/tmpMr__Ct_verity_images/verity_metadata.img c05456d1171333727af2a3f82feb59856e56229fe81c75c90fd2a1359893a438 aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 /dev/block/mmcblk3p5 out/host/linux-x86/bin/verity_signer build/target/product/security/verity.pk8
    append2simg out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity_metadata.img
    append2simg out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity.img
    Construct recovery from boot
    mkdir -p out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/
    PATH=out/host/linux-x86/bin:$PATH
    out/host/linux-x86/bin/imgdiff out/target/product/sabresd_6dq/boot.img out/target/product/sabresd_6dq/recovery.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p
    chunk 0: type 0 start 0 len 7274506
    chunk 1: type 2 start 7274506 len 1480704
    chunk 2: type 0 start 8142159 len 49112
    Construct patches for 3 chunks...
    patch   0 is 205 bytes (of 7274506)
    patch   1 is 435259 bytes (of 867653)
    patch   2 is 594 bytes (of 49112)
    chunk   0: normal   (         0,    7274506)         205
    chunk   1: deflate  (   7274506,    1476108)      435259  (null)
    chunk   2: normal   (   8750614,      48918)         594
    Install system fs image: out/target/product/sabresd_6dq/system.img
    out/target/product/sabresd_6dq/system.img+out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=385389312 blocksize=4224 total=323391834 reserve=3894528

    #### make completed successfully (53:14 (mm:ss)) ####

三、Android 5.1 生成内核信息解析:
    1. 命令行输出信息如下:
        Target ram disk: out/target/product/sabresd_6dq/ramdisk.img
        Target boot image: out/target/product/sabresd_6dq/boot.img
        install -D kernel_imx/arch/arm/boot/zImage  out/target/product/sabresd_6dq/kernel
        for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do \
                DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`; \
                DTS_BOARD=`echo $dtsplat | cut -d':' -f2`; \
                install -D kernel_imx/arch/arm/boot/dts/$DTS_BOARD out/target/product/sabresd_6dq/$DTS_BOARD; \
            done
        make -C kernel_imx modules ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi- LOADADDR=0x10008000
    2. 整理并解读代码如下:
        for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do
            DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`;
            DTS_BOARD=`echo $dtsplat | cut -d':' -f2`;
            install -D kernel_imx/arch/arm/boot/dts/$DTS_BOARD out/target/product/sabresd_6dq/$DTS_BOARD;
        done
    3. 由上可知out/target/product/sabresd_6dq/kernel是kernel_imx/arch/arm/boot/zImage文件,同时编译生成的dts在arch/arm/boot/dts目录下面。

四、解读 Target boot image:
    1. 命令行输出信息如下:
        Target ram disk: out/target/product/sabresd_6dq/ramdisk.img
        Target boot image: out/target/product/sabresd_6dq/boot.img
        for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do \
                        DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`; \
                        DTS_BOARD=`echo $dtsplat | cut -d':' -f2`; \
                        BOOT_IMAGE_BOARD=out/target/product/sabresd_6dq/boot-$DTS_PLATFORM.img; \
                        out/host/linux-x86/bin/mkbootimg  --kernel out/target/product/sabresd_6dq/kernel --ramdisk out/target/product/sabresd_6dq/ramdisk.img --cmdline "console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M" --base 0x14000000 --second out/target/product/sabresd_6dq/$DTS_BOARD  --output out/target/product/sabresd_6dq/boot.img; \
                out/host/linux-x86/bin/boot_signer /boot out/target/product/sabresd_6dq/boot.img build/target/product/security/verity.pk8 build/target/product/security/verity.x509.pem out/target/product/sabresd_6dq/boot.img; \
                          size=$(for i in out/target/product/sabresd_6dq/boot.img; do stat --format "%s" "$i" | tr -d '\n'; echo +; done; echo 0); total=$(( $( echo "$size" ) )); printname=$(echo -n "out/target/product/sabresd_6dq/boot.img" | tr " " +); img_blocksize=4224; twoblocks=$((img_blocksize * 2)); onepct=$(((((17301504 / 100) - 1) / img_blocksize + 1) * img_blocksize)); reserve=$((twoblocks > onepct ? twoblocks : onepct)); maxsize=$((17301504 - reserve)); echo "$printname maxsize=$maxsize blocksize=$img_blocksize total=$total reserve=$reserve"; if [ "$total" -gt "$maxsize" ]; then echo "error: $printname too large ($total > [17301504 - $reserve])"; false; elif [ "$total" -gt $((maxsize - 32768)) ]; then echo "WARNING: $printname approaching size limit ($total now; limit $maxsize)"; fi ; \
                        cp -f out/target/product/sabresd_6dq/boot.img $BOOT_IMAGE_BOARD; \
                done
        out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8189223 reserve=173184
        out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8189223 reserve=173184
        out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8189223 reserve=173184
        out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8191271 reserve=173184
    2. 由上可知,ramdisk合成没有给出信息:
        1. 参考文档:
            1. ramdisk.img及boot.img的生成过程
                http://blog.csdn.net/zhijianjingling00/article/details/16841683
            2. 修改build/core/Makefile:
                ......
                # We just build this directly to the install location.
                INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
                $(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
                        $(call pretty,"Target ram disk: $@")
                        $(MKBOOTFS) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@    # 去掉前面的"$(hide)"
                ......
            3. 得到输出信息:
                out/host/linux-x86/bin/mkbootfs out/target/product/sabresd_6dq/root | out/host/linux-x86/bin/minigzip > out/target/product/sabresd_6dq/ramdisk.img
    2. 整理并解读代码如下:
        # for循环迭代以下四种情况:
        #      1. dtsplat:imx6q:imx6q-sabresd.dtb
        #      2. dtsplat:imx6dl:imx6dl-sabresd.dtb
        #      3. dtsplat:imx6q-ldo:imx6q-sabresd-ldo.dtb
        #      4. dtsplat:imx6qp:imx6qp-sabresd.dtb
        for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do
            # 截取dtsplat中的冒号前面的那部分字符,也就是:
            #     1. imx6q;
            #     2. imx6dl;
            #     3. imx6q-ldo;
            #     4. imx6qp;
            DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`;
            # 截取dtsplat中的冒号后面的那部分字符,也就是:
            #     1. imx6q-sabresd.dtb;
            #     2. imx6dl-sabresd.dtb;
            #     3. imx6q-sabresd-ldo.dtb;
            #     4. imx6qp-sabresd.dtb;
            DTS_BOARD=`echo $dtsplat | cut -d':' -f2`;
            # 合成当前次要生成的boot.img文件名
            BOOT_IMAGE_BOARD=out/target/product/sabresd_6dq/boot-$DTS_PLATFORM.img;
            # 使用mkbootimg合成boot.img文件,除了dts文件,其他的都是明确的
            out/host/linux-x86/bin/mkbootimg  --kernel out/target/product/sabresd_6dq/kernel --ramdisk out/target/product/sabresd_6dq/ramdisk.img --cmdline "console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M" --base 0x14000000 --second out/target/product/sabresd_6dq/$DTS_BOARD  --output out/target/product/sabresd_6dq/boot.img;
            # 这里不是很明确到底要在做什么
            out/host/linux-x86/bin/boot_signer /boot out/target/product/sabresd_6dq/boot.img build/target/product/security/verity.pk8 build/target/product/security/verity.x509.pem out/target/product/sabresd_6dq/boot.img;
            # 接下来这段更多的是校验文件大小是否超出16M,
            size=$(
                    for i in out/target/product/sabresd_6dq/boot.img; do
                        stat --format "%s" "$i" | tr -d '\n';
                        echo +;
                    done;
                    echo 0
                );
            total=$(( $( echo "$size" ) ));
            printname=$(echo -n "out/target/product/sabresd_6dq/boot.img" | tr " " +);
            img_blocksize=4224;
            twoblocks=$((img_blocksize * 2));
            onepct=$(((((17301504 / 100) - 1) / img_blocksize + 1) * img_blocksize));
            reserve=$((twoblocks > onepct ? twoblocks : onepct));
            maxsize=$((17301504 - reserve));
            echo "$printname maxsize=$maxsize blocksize=$img_blocksize total=$total reserve=$reserve";
            if [ "$total" -gt "$maxsize" ]; then
                echo "error: $printname too large ($total > [17301504 - $reserve])";
                false;
            elif [ "$total" -gt $((maxsize - 32768)) ]; then
                echo "WARNING: $printname approaching size limit ($total now; limit $maxsize)";
            fi ;
            # 以上检查都正常,拷贝文件
            cp -f out/target/product/sabresd_6dq/boot.img $BOOT_IMAGE_BOARD;
        done
    3. 和上面的shell脚本对比,输出信息正常:
        out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8189223 reserve=173184
        out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8189223 reserve=173184
        out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8189223 reserve=173184
        out/target/product/sabresd_6dq/boot.img maxsize=17128320 blocksize=4224 total=8191271 reserve=173184

五、解读 Making recovery image :
    1. 命令行输出信息如下:
        ----- Making recovery image ------
        Copying baseline ramdisk...
        Modifying ramdisk contents...
        for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do \
                DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`; \
                DTS_BOARD=`echo $dtsplat | cut -d':' -f2`; \
                RECOVERY_IMAGE_BOARD=out/target/product/sabresd_6dq/recovery-$DTS_PLATFORM.img; \
                out/host/linux-x86/bin/mkbootimg  --kernel out/target/product/sabresd_6dq/kernel  --ramdisk out/target/product/sabresd_6dq/ramdisk-recovery.img --cmdline "console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M" --base 0x14000000 --second out/target/product/sabresd_6dq/$DTS_BOARD  --output out/target/product/sabresd_6dq/recovery.img; \
                if [ true = true ]; then \
                out/host/linux-x86/bin/boot_signer /recovery out/target/product/sabresd_6dq/recovery.img build/target/product/security/verity.pk8 build/target/product/security/verity.x509.pem out/target/product/sabresd_6dq/recovery.img; \
                fi;\
                  size=$(for i in out/target/product/sabresd_6dq/recovery.img; do stat --format "%s" "$i" | tr -d '\n'; echo +; done; echo 0); total=$(( $( echo "$size" ) )); printname=$(echo -n "out/target/product/sabresd_6dq/recovery.img" | tr " " +); img_blocksize=4224; twoblocks=$((img_blocksize * 2)); onepct=$(((((17301504 / 100) - 1) / img_blocksize + 1) * img_blocksize)); reserve=$((twoblocks > onepct ? twoblocks : onepct)); maxsize=$((17301504 - reserve)); echo "$printname maxsize=$maxsize blocksize=$img_blocksize total=$total reserve=$reserve"; if [ "$total" -gt "$maxsize" ]; then echo "error: $printname too large ($total > [17301504 - $reserve])"; false; elif [ "$total" -gt $((maxsize - 32768)) ]; then echo "WARNING: $printname approaching size limit ($total now; limit $maxsize)"; fi ; \
                cp -f out/target/product/sabresd_6dq/recovery.img $RECOVERY_IMAGE_BOARD; \
            done
        out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8797484 reserve=173184
        out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8797484 reserve=173184
        out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8797484 reserve=173184
        out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8799532 reserve=173184
        ----- Made recovery image: out/target/product/sabresd_6dq/recovery.img --------
    2. 整理并解读代码如下:
        # for循环迭代以下四种情况:
        #      1. dtsplat:imx6q:imx6q-sabresd.dtb
        #      2. dtsplat:imx6dl:imx6dl-sabresd.dtb
        #      3. dtsplat:imx6q-ldo:imx6q-sabresd-ldo.dtb
        #      4. dtsplat:imx6qp:imx6qp-sabresd.dtb
        for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do
            # 截取dtsplat中的冒号前面的那部分字符,也就是:
            #     1. imx6q;
            #     2. imx6dl;
            #     3. imx6q-ldo;
            #     4. imx6qp;
            DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`;
            # 截取dtsplat中的冒号后面的那部分字符,也就是:
            #     1. imx6q-sabresd.dtb;
            #     2. imx6dl-sabresd.dtb;
            #     3. imx6q-sabresd-ldo.dtb;
            #     4. imx6qp-sabresd.dtb;
            DTS_BOARD=`echo $dtsplat | cut -d':' -f2`;
            # 合成当前次要生成的recovery.img文件名
            RECOVERY_IMAGE_BOARD=out/target/product/sabresd_6dq/recovery-$DTS_PLATFORM.img;
            # 使用mkbootimg合成recovery.img文件,除了dts文件,其他的都是明确的,请对比boot.img合成的命令,几乎一样
            # out/host/linux-x86/bin/mkbootimg  --kernel out/target/product/sabresd_6dq/kernel --ramdisk out/target/product/sabresd_6dq/ramdisk.img --cmdline "console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M" --base 0x14000000 --second out/target/product/sabresd_6dq/$DTS_BOARD  --output out/target/product/sabresd_6dq/boot.img;
            out/host/linux-x86/bin/mkbootimg  --kernel out/target/product/sabresd_6dq/kernel  --ramdisk out/target/product/sabresd_6dq/ramdisk-recovery.img --cmdline "console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M" --base 0x14000000 --second out/target/product/sabresd_6dq/$DTS_BOARD  --output out/target/product/sabresd_6dq/recovery.img;
            # 加入校验,这里不是很明确到底要在做什么
            if [ true = true ]; then
                out/host/linux-x86/bin/boot_signer /recovery out/target/product/sabresd_6dq/recovery.img build/target/product/security/verity.pk8 build/target/product/security/verity.x509.pem out/target/product/sabresd_6dq/recovery.img;
            fi;
            # 接下来这段更多的是校验文件大小是否超出16M,
            size=$(
                for i in out/target/product/sabresd_6dq/recovery.img; do
                    stat --format "%s" "$i" | tr -d '\n';
                    echo +;
                done;
                echo 0
            );
            total=$(( $( echo "$size" ) ));
            printname=$(echo -n "out/target/product/sabresd_6dq/recovery.img" | tr " " +);
            img_blocksize=4224;
            twoblocks=$((img_blocksize * 2));
            onepct=$(((((17301504 / 100) - 1) / img_blocksize + 1) * img_blocksize));
            reserve=$((twoblocks > onepct ? twoblocks : onepct));
            maxsize=$((17301504 - reserve));
            echo "$printname maxsize=$maxsize blocksize=$img_blocksize total=$total reserve=$reserve";
            if [ "$total" -gt "$maxsize" ]; then
                echo "error: $printname too large ($total > [17301504 - $reserve])";
                false;
            elif [ "$total" -gt $((maxsize - 32768)) ]; then
                echo "WARNING: $printname approaching size limit ($total now; limit $maxsize)";
            fi ;
            # 以上检查都正常,拷贝文件
            cp -f out/target/product/sabresd_6dq/recovery.img $RECOVERY_IMAGE_BOARD;
        done
    3. 和上面的shell脚本对比,输出信息正常:
        out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8797484 reserve=173184
        out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8797484 reserve=173184
        out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8797484 reserve=173184
        out/target/product/sabresd_6dq/recovery.img maxsize=17128320 blocksize=4224 total=8799532 reserve=173184

六、解读 Target system fs image:
    1. 命令行输出信息如下:
        Target system fs image: out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img
        make_ext4fs -s -T -1 -S out/target/product/sabresd_6dq/root/file_contexts -l 374476800 -a system out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/sabresd_6dq/system
        Creating filesystem with parameters:
            Size: 374476800
            Block size: 4096
            Blocks per group: 32768
            Inodes per group: 7632
            Inode size: 256
            Journal blocks: 1428
            Label:
            Blocks: 91425
            Block groups: 3
            Reserved block group size: 23
        Created filesystem with 1304/22896 inodes and 79090/91425 blocks
        Running:  mkuserimg.sh -s out/target/product/sabresd_6dq/system out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 374476800 out/target/product/sabresd_6dq/root/file_contexts
        build_verity_tree -A aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity.img
        system/extras/verity/build_verity_metadata.py 374476800 /tmp/tmpMr__Ct_verity_images/verity_metadata.img c05456d1171333727af2a3f82feb59856e56229fe81c75c90fd2a1359893a438 aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 /dev/block/mmcblk3p5 out/host/linux-x86/bin/verity_signer build/target/product/security/verity.pk8
        append2simg out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity_metadata.img
        append2simg out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity.img
        Construct recovery from boot
        mkdir -p out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/
        PATH=out/host/linux-x86/bin:$PATH
        out/host/linux-x86/bin/imgdiff out/target/product/sabresd_6dq/boot.img out/target/product/sabresd_6dq/recovery.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p
        chunk 0: type 0 start 0 len 7274506
        chunk 1: type 2 start 7274506 len 1480704
        chunk 2: type 0 start 8142159 len 49112
        Construct patches for 3 chunks...
        patch   0 is 205 bytes (of 7274506)
        patch   1 is 435259 bytes (of 867653)
        patch   2 is 594 bytes (of 49112)
        chunk   0: normal   (         0,    7274506)         205
        chunk   1: deflate  (   7274506,    1476108)      435259  (null)
        chunk   2: normal   (   8750614,      48918)         594
        Install system fs image: out/target/product/sabresd_6dq/system.img
        out/target/product/sabresd_6dq/system.img+out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=385389312 blocksize=4224 total=323391834 reserve=3894528

        #### make completed successfully (53:14 (mm:ss)) ####
    2. 如上可知,最后生成out/target/product/sabresd_6dq/system.img部分内容好像被隐藏了。
    3. 为了看到整个程序执行信息,修改源代码:
        1. 参考文档:
            1. 参考文档:Android——编译体系中的【PRODUCT_COPY_FILES】【ALL_PREBUILT】【BUILD_PREBUILT】
                http://blog.csdn.net/jscese/article/details/40615801
            2. Android编译系统分析五:system.img的生成过程
                http://blog.csdn.net/u011913612/article/details/52503318
            3. Android系统镜像文件的打包过程分析
                http://blog.csdn.net/Luoshengyang/article/details/20501657
        2. 修改build/core/definitions.mk
            ......
            define copy-file-to-target
            @mkdir -p $(dir $@)
            $(hide) $(ACP) -fp $< $@            # 移除前面的"$(hide)"
            endef
            ......
        3. 修改build/core/Makefile
            ......
            INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
            ......
            systemimage_intermediates := \
            $(call intermediates-dir-for,PACKAGING,systemimage)
            BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
            ......
            $(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP)
                @echo "Install system fs image: $@"
                $(copy-file-to-target)
                # 为了看到这部分完整的处理流程,将"$(hide)"去掉
                # $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
                $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))

            systemimage: $(INSTALLED_SYSTEMIMAGE)
            ......
    4. 隐藏的处理信息如下:
        Install system fs image: out/target/product/sabresd_6dq/system.img
        out/host/linux-x86/bin/acp -fp out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/sabresd_6dq/system.img
        size=$(for i in out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p; do stat --format "%s" "$i" | tr -d '\n'; echo +; done; echo 0); total=$(( $( echo "$size" ) )); printname=$(echo -n "out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p" | tr " " +); img_blocksize=4224; twoblocks=$((img_blocksize * 2)); onepct=$(((((389283840 / 100) - 1) / img_blocksize + 1) * img_blocksize)); reserve=$((twoblocks > onepct ? twoblocks : onepct)); maxsize=$((389283840 - reserve)); echo "$printname maxsize=$maxsize blocksize=$img_blocksize total=$total reserve=$reserve"; if [ "$total" -gt "$maxsize" ]; then echo "error: $printname too large ($total > [389283840 - $reserve])"; false; elif [ "$total" -gt $((maxsize - 32768)) ]; then echo "WARNING: $printname approaching size limit ($total now; limit $maxsize)"; fi
        out/target/product/sabresd_6dq/system.img+out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=385389312 blocksize=4224 total=323391834 reserve=3894528
        # @   size=$(for i in out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p; do stat --format "%s" "$i" | tr -d '\n'; echo +; done; echo 0); total=$(( $( echo "$size" ) )); printname=$(echo -n "out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p" | tr " " +); img_blocksize=4224; twoblocks=$((img_blocksize * 2)); onepct=$(((((389283840 / 100) - 1) / img_blocksize + 1) * img_blocksize)); reserve=$((twoblocks > onepct ? twoblocks : onepct)); maxsize=$((389283840 - reserve)); echo "$printname maxsize=$maxsize blocksize=$img_blocksize total=$total reserve=$reserve"; if [ "$total" -gt "$maxsize" ]; then echo "error: $printname too large ($total > [389283840 - $reserve])"; false; elif [ "$total" -gt $((maxsize - 32768)) ]; then echo "WARNING: $printname approaching size limit ($total now; limit $maxsize)"; fi 

        #### make completed successfully (52:35 (mm:ss)) ####
    5. 整理并解读代码如下:
        1. 制作ext4fs文件系统:
            make_ext4fs -s -T -1 -S out/target/product/sabresd_6dq/root/file_contexts -l 374476800 -a system out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/sabresd_6dq/system
        2. 以下步骤基本上是没什么变量,所以也就不解析了:
            mkuserimg.sh -s out/target/product/sabresd_6dq/system out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 374476800 out/target/product/sabresd_6dq/root/file_contexts
            build_verity_tree -A aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity.img
            system/extras/verity/build_verity_metadata.py 374476800 /tmp/tmpMr__Ct_verity_images/verity_metadata.img c05456d1171333727af2a3f82feb59856e56229fe81c75c90fd2a1359893a438 aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 /dev/block/mmcblk3p5 out/host/linux-x86/bin/verity_signer build/target/product/security/verity.pk8
            append2simg out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity_metadata.img
            append2simg out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity.img
            mkdir -p out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/
            PATH=out/host/linux-x86/bin:$PATH
            out/host/linux-x86/bin/imgdiff out/target/product/sabresd_6dq/boot.img out/target/product/sabresd_6dq/recovery.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p
        3. 隐藏信息解读:
            # 直接将前面声场的system.img文件拷贝到输出目录中
            out/host/linux-x86/bin/acp -fp out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/sabresd_6dq/system.img
            # 统计两个文件的大小,并判断system.img文件是否正常,和前面类似,其实没有过多的解析必要
            size=$(
                for i in out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p; do
                    stat --format "%s" "$i" | tr -d '\n';
                    echo +;
                done;
                echo 0
            );
            total=$(( $( echo "$size" ) ));
            # 将两个文件中的空格换成+号
            printname=$(echo -n "out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p" | tr " " +);
            img_blocksize=4224;
            twoblocks=$((img_blocksize * 2));
            onepct=$(((((389283840 / 100) - 1) / img_blocksize + 1) * img_blocksize));
            reserve=$((twoblocks > onepct ? twoblocks : onepct));
            maxsize=$((389283840 - reserve));
            echo "$printname maxsize=$maxsize blocksize=$img_blocksize total=$total reserve=$reserve";
            if [ "$total" -gt "$maxsize" ]; then
                echo "error: $printname too large ($total > [389283840 - $reserve])";
                false;
            elif [ "$total" -gt $((maxsize - 32768)) ]; then
                echo "WARNING: $printname approaching size limit ($total now; limit $maxsize)";
            fi 

七、a51m脚本:
    #!/bin/bash

    # source build/envsetup.sh && lunch sabresd_6dq-user && make 2>&1 | tee build-log.txt

    if [ $# != 1 ]; then
        echo "USAGE:"
        echo "    a51m <ub | bi | fs> "
        echo "        1. ub: U-Boot compile."
        echo "        2. bi: boot.img compile."
        echo "        3. fs: system.img repack"
        echo
        exit -1
    fi

    # for U-Boot compile
    if [ $1 = "ub" ]; then
        for ubootplat in imx6q:mx6qsabresdandroid_config imx6dl:mx6dlsabresdandroid_config imx6qp:mx6qpsabresdandroid_config; do
            UBOOT_PLATFORM=`echo $ubootplat | cut -d':' -f1`;
            UBOOT_CONFIG=`echo $ubootplat | cut -d':' -f2`;
            echo ;
            echo ;
            make -C bootable/bootloader/uboot-imx/ distclean ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-;
            make -C bootable/bootloader/uboot-imx/ $UBOOT_CONFIG ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-;
            make -C bootable/bootloader/uboot-imx/ ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-; 

            echo -e "\tcp bootable/bootloader/uboot-imx/u-boot.imx out/target/product/sabresd_6dq/u-boot-$UBOOT_PLATFORM.imx; "
            cp bootable/bootloader/uboot-imx/u-boot.imx out/target/product/sabresd_6dq/u-boot-$UBOOT_PLATFORM.imx;
        done

        echo -e "\n\033[32mGenerate u-boot.imx Work Over.\033[0m\n"

        exit 0
    fi

    # for boot.img compile
    if [ $1 = "bi" ]; then
        make -C kernel_imx ARCH=arm CROSS_COMPILE=`pwd`/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi- LOADADDR=0x10008000
        echo -e "\n\033[32m[Copy zImage file to target]:\033[0m"
        echo -e "\tcp kernel_imx/arch/arm/boot/zImage  out/target/product/sabresd_6dq/kernel"
        cp kernel_imx/arch/arm/boot/zImage  out/target/product/sabresd_6dq/kernel

        echo -e "\n\033[32m[Copy dtb file to target]:\033[0m"
        for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do
            DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`;
            DTS_BOARD=`echo $dtsplat | cut -d':' -f2`;
            echo -e "\tcp kernel_imx/arch/arm/boot/dts/$DTS_BOARD out/target/product/sabresd_6dq/$DTS_BOARD"
            cp kernel_imx/arch/arm/boot/dts/$DTS_BOARD out/target/product/sabresd_6dq/$DTS_BOARD;
        done

        echo -e "\n\033[32m[Generate ramdisk.img file to target]:\033[0m"
        echo -e "\tout/host/linux-x86/bin/mkbootfs out/target/product/sabresd_6dq/root | out/host/linux-x86/bin/minigzip > out/target/product/sabresd_6dq/ramdisk.img"
        out/host/linux-x86/bin/mkbootfs out/target/product/sabresd_6dq/root | out/host/linux-x86/bin/minigzip > out/target/product/sabresd_6dq/ramdisk.img

        echo -e "\n\033[32m[Generate boot.img file to target]:\033[0m"
        for dtsplat in imx6q:imx6q-sabresd.dtb imx6dl:imx6dl-sabresd.dtb imx6q-ldo:imx6q-sabresd-ldo.dtb imx6qp:imx6qp-sabresd.dtb; do
            DTS_PLATFORM=`echo $dtsplat | cut -d':' -f1`;
            DTS_BOARD=`echo $dtsplat | cut -d':' -f2`;
            BOOT_IMAGE_BOARD=out/target/product/sabresd_6dq/boot-$DTS_PLATFORM.img;
            out/host/linux-x86/bin/mkbootimg  --kernel out/target/product/sabresd_6dq/kernel --ramdisk out/target/product/sabresd_6dq/ramdisk.img --cmdline "console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M" --base 0x14000000 --second out/target/product/sabresd_6dq/$DTS_BOARD  --output out/target/product/sabresd_6dq/boot.img;
        out/host/linux-x86/bin/boot_signer /boot out/target/product/sabresd_6dq/boot.img build/target/product/security/verity.pk8 build/target/product/security/verity.x509.pem out/target/product/sabresd_6dq/boot.img;
            echo -e "\tcp -f out/target/product/sabresd_6dq/boot.img $BOOT_IMAGE_BOARD"
            cp -f out/target/product/sabresd_6dq/boot.img $BOOT_IMAGE_BOARD;
        done

        echo -e "\n\033[32mGenerate boot.img Work Over.\033[0m\n"

        exit 0
    fi

    # for system.img repack
    if [ $1 = "fs" ]; then
        make_ext4fs -s -T -1 -S out/target/product/sabresd_6dq/root/file_contexts -l 374476800 -a system out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/sabresd_6dq/system
        mkuserimg.sh -s out/target/product/sabresd_6dq/system out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 374476800 out/target/product/sabresd_6dq/root/file_contexts
        mkdir -p /tmp/tmpMr__Ct_verity_images
        build_verity_tree -A aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity.img
        system/extras/verity/build_verity_metadata.py 374476800 /tmp/tmpMr__Ct_verity_images/verity_metadata.img c05456d1171333727af2a3f82feb59856e56229fe81c75c90fd2a1359893a438 aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 /dev/block/mmcblk3p5 out/host/linux-x86/bin/verity_signer build/target/product/security/verity.pk8
        append2simg out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity_metadata.img
        append2simg out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpMr__Ct_verity_images/verity.img
        mkdir -p out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/
        PATH=out/host/linux-x86/bin:$PATH
        out/host/linux-x86/bin/imgdiff out/target/product/sabresd_6dq/boot.img out/target/product/sabresd_6dq/recovery.img out/target/product/sabresd_6dq/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p
        out/host/linux-x86/bin/acp -fp out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/sabresd_6dq/system.img

        echo -e "\n\033[32mGenerate system.img Work Over.\033[0m\n"

        exit 0
    fi

    echo "USAGE:"
    echo "    a51m <ub | bi | fs> "
    echo "        1. ub: U-Boot compile."
    echo "        2. bi: boot.img compile."
    echo "        3. fs: system.img repack"
    echo 

 

时间: 2024-10-23 01:24:57

I.MX6 Android 5.1 快速合成系统的相关文章

I.MX6 Android /data 目录内容

/**************************************************************************** * I.MX6 Android /data 目录内容 * 说明: * 其实之前我也挺好奇/data目录最初到地方了那些内容,今天Lee正好有提到这个 * 于是跟一下其中到底包含了什么,结果是最初什么都没有. * * 2016-8-22 深圳 南山平山村 曾剑锋 *****************************************

I.MX6 android mkuserimg.sh

/************************************************************************** * I.MX6 android mkuserimg.sh * 说明: * 修改了android源代码中的一些内容之后,如果内容过多,不能确定到底修改 * 了system目录下的哪些文件,于是可能要重新make,但这实在是让人难以接受, * 因为等待的时间会很长,于是从make命令最后看到mkuserimg.sh是用来最后对文件 * 系统进行打包的

I.MX6 Android 永不休眠

/************************************************************************* * I.MX6 Android 永不休眠 * 说明: * 之前遇到这个需求,仅仅修改了那个-1,无效,另外还需要电源管理部分的 * 代码,现在再记录一下. * * 2017-2-15 深圳 南山平山村 曾剑锋 **********************************************************************

I.MX6 Android netperf

/***************************************************************************** * I.MX6 Android netperf * 说明: * 之前移植iperf3网络测试工具不成功,本来想再移植一个iperf2来试一下,但是 * 在检查Android源码系统的时候不小心看到netperf文件夹,查了点资料,貌似可以实 * 现iperf的功能,于是又省了点事. * * 2016-4-18 深圳 南山平山村 曾剑锋 **

I.MX6 Android iperf3 porting failed

/***************************************************************************** * I.MX6 Android iperf3 porting failed * 说明: * 本来想移植一下iperf3到Android系统上测试一下网卡,可能是版本高了点,最后 * 运行客户端的时候会报错,也找了一些解决办法,但还是未能解决. * * 2016-4-5 深圳 南山平山村 曾剑锋 ***********************

I.MX6 android BatteryService jni hacking

/**************************************************************************** * I.MX6 android BatteryService jni hacking * 声明: * 本文主要是为了知道Android的获取的电源管理的数据的jni是从Linux系统的 * 什么位置获取的,获取的机制是什么. * * 2016-2-22 深圳 南山平山村 曾剑锋 ********************************

I.MX6 Android frameworks services 文件架构

/******************************************************************************* * I.MX6 Android frameworks services 文件架构 * 说明: * 这部分内容后续可能需要多给一点注意力了,因为这部分在做系统移植的时候经常 * 需要通过这部分来进行调试. * 2016-3-19 深圳 南山平山村 曾剑锋 ******************************************

I.MX6 Android USB Touch eGTouchA.ini文件存放

/******************************************************************** * I.MX6 Android USB Touch eGTouchA.ini文件存放 * 声明: * 本文主要记录徐远志在移植eGTouch USB Touch Android驱动过程中遇到的 * eGTouchA.ini文件存放问题如何解决. * * 2016-2-25 深圳 南山平山村 曾剑锋 ******************************

I.MX6 Android 5 root

/********************************************************************************* * I.MX6 Android 5 root * 说明: * 学习一下Android 5的root方式. * * 2017-11-1 深圳 南山平山村 曾剑锋 ********************************************************************************/ 一.参考文