I.MX6 mkuserimg.sh 使用

时间:2021-08-29 00:10:18
/***********************************************************************
 *                  I.MX6 mkuserimg.sh 使用
 * 说明:
 *     每次都要对Android源码进行模块化编译的时候,经常会遇到要重新制作
 * system.img的问题,而普通的方式等待时间实在让人难以接受,而通过这个
 * mkuserimg.sh来直接完成对system目录的打包正符合要求。
 *
 *                                   2016-6-28 深圳 南山平山村 曾剑锋
 **********************************************************************/

一、参考文档:
    make_ext4fs制作system.img
        http://www.360doc.com/content/13/0419/13/12052771_279450163.shtml

二、解读shell命令:
    mkuserimg.sh out/target/product/sabresd_6dq/system out/target/product/sabresd_6dq/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 293601280

三、步骤:
    1. 293601280 / 1024 / 1024 = 280M
    2. mkuserimg.sh out/target/product/sabresd_6dq/system out/target/product/sabresd_6dq/system.img ext4 system 293601280

四、reimg.sh
    echo "begin to make system.img"
    source build/envsetup.sh
    lunch sabresd_6dq-eng
    mkuserimg.sh out/target/product/sabresd_6dq/system out/target/product/sabresd_6dq/system.img ext4 system 293601280

五、运行现象:
    myzr@myzr:~/myandroid$ ./reimg.sh 
    begin to make image
    including device/asus/grouper/vendorsetup.sh
    including device/asus/tilapia/vendorsetup.sh
    including device/fsl/imx5x/vendorsetup.sh
    including device/fsl/imx6/vendorsetup.sh
    including device/generic/armv7-a-neon/vendorsetup.sh
    including device/generic/armv7-a/vendorsetup.sh
    including device/generic/mips/vendorsetup.sh
    including device/generic/x86/vendorsetup.sh
    including device/lge/mako/vendorsetup.sh
    including device/samsung/maguro/vendorsetup.sh
    including device/samsung/manta/vendorsetup.sh
    including device/samsung/toroplus/vendorsetup.sh
    including device/samsung/toro/vendorsetup.sh
    including device/ti/panda/vendorsetup.sh
    including sdk/bash_completion/adb.bash
    
    ============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=4.2.2
    TARGET_PRODUCT=sabresd_6dq
    TARGET_BUILD_VARIANT=eng
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    TARGET_ARCH_VARIANT=armv7-a-neon
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_OS_EXTRA=Linux-3.2.0-29-generic-x86_64-with-Ubuntu-12.04-precise
    HOST_BUILD_TYPE=release
    BUILD_ID=1.1.0-rc3
    OUT_DIR=out
    ============================================
    
    + echo 'in mkuserimg.sh PATH=/usr/java/jdk1.6.0_45/bin:/home/myzr/myandroid/out/host/linux-x86/bin:/home/myzr/myandroid/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin:/home/myzr/myandroid/prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.6/bin:/home/myzr/myandroid/development/emulator/qtools:/home/myzr/myandroid/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin:/home/myzr/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:/home/myzr/myandroid/development/scripts:/home/myzr/myandroid/bootable/bootloader/uboot-imx/tools:/usr/local/netpbm/bin:/usr/java/jdk1.6.0_45/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/java/jdk1.6.0_45/jre/bin:/opt/FriendlyARM/toolschain/4.4.3/bin:/home/myzr/Downloads/node-v4.4.5-linux-x64/bin'
    in mkuserimg.sh PATH=/usr/java/jdk1.6.0_45/bin:/home/myzr/myandroid/out/host/linux-x86/bin:/home/myzr/myandroid/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin:/home/myzr/myandroid/prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.6/bin:/home/myzr/myandroid/development/emulator/qtools:/home/myzr/myandroid/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin:/home/myzr/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:/home/myzr/myandroid/development/scripts:/home/myzr/myandroid/bootable/bootloader/uboot-imx/tools:/usr/local/netpbm/bin:/usr/java/jdk1.6.0_45/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/java/jdk1.6.0_45/jre/bin:/opt/FriendlyARM/toolschain/4.4.3/bin:/home/myzr/Downloads/node-v4.4.5-linux-x64/bin
    + ENABLE_SPARSE_IMAGE=
    + '[' out/target/product/sabresd_6dq/system = -s ']'
    + '[' 5 -ne 4 -a 5 -ne 5 -a 5 -ne 6 ']'
    + SRC_DIR=out/target/product/sabresd_6dq/system
    + '[' '!' -d out/target/product/sabresd_6dq/system ']'
    + OUTPUT_FILE=out/target/product/sabresd_6dq/system.img
    + EXT_VARIANT=ext4
    + MOUNT_POINT=system
    + SIZE=293601280
    + FC=
    + case $EXT_VARIANT in
    + '[' -z system ']'
    + '[' -z 293601280 ']'
    + '[' -n '' ']'
    + MAKE_EXT4FS_CMD='make_ext4fs   -l 293601280 -a system out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/system'
    + echo make_ext4fs -l 293601280 -a system out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/system
    make_ext4fs -l 293601280 -a system out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/system
    + make_ext4fs -l 293601280 -a system out/target/product/sabresd_6dq/system.img out/target/product/sabresd_6dq/system
    Creating filesystem with parameters:
        Size: 293601280
        Block size: 4096
        Blocks per group: 32768
        Inodes per group: 5984
        Inode size: 256
        Journal blocks: 1120
        Label: 
        Blocks: 71680
        Block groups: 3
        Reserved block group size: 23
    Created filesystem with 1185/17952 inodes and 49793/71680 blocks
    + '[' 0 -ne 0 ']'
    myzr@myzr:~/myandroid$