zoukankan      html  css  js  c++  java
  • i.mx6 Android5.1.1 build解析

    参考资料:理解 Android Build 系统

    把总结放前面:

    1. 常用编译命令

    2.常用命令:

    我们正常步骤为:

    1). source build/envsetup.sh

    2). lunch

    3). make -jx

    build/envsetup.sh

    打开build/envsetup.sh,发现里面全都是函数,折叠全部函数,一直拖到最后,发现代码

    if [ "x$SHELL" != "x/bin/bash" ]; then
        case `ps -o command -p $$` in
            *bash*)
                ;;
            *)
                echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results"
                ;;
        esac
    fi
    
    # Execute the contents of any vendorsetup.sh files we can find.
    #包含各种
    vendorsetup.s脚本文件进来,然后去执行

    for f in `test -d device && find -L device -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null`
             `test -d vendor && find -L vendor -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null`
    do
        echo "including $f"
        . $f
    done
    unset f addcompletions

     

    查看发现没错,查看lunch

    function lunch()
    {
        local answer
      #如果有第一个参数
        if [ "$1" ] ; then
            answer=$1
        else  #如果没有参数,就进入print_lunch_menu函数
            print_lunch_menu
            echo -n "Which would you like? [aosp_arm-eng] "
            read answer
        fi
    
        local selection=
    
        if [ -z "$answer" ]
        then
            selection=aosp_arm-eng
        elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$")
        then
            if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ]
            then
                selection=${LUNCH_MENU_CHOICES[$(($answer-1))]}
            fi
        elif (echo -n $answer | grep -q -e "^[^-][^-]*-[^-][^-]*$")
        then
            selection=$answer
        fi
    
        if [ -z "$selection" ]
        then
            echo
            echo "Invalid lunch combo: $answer"
            return 1
        fi
    
        export TARGET_BUILD_APPS=
    
        local product=$(echo -n $selection | sed -e "s/-.*$//")
        check_product $product
        if [ $? -ne 0 ]
        then
            echo
            echo "** Don't have a product spec for: '$product'"
            echo "** Do you have the right repo manifest?"
            product=
        fi
    
        local variant=$(echo -n $selection | sed -e "s/^[^-]*-//")
        check_variant $variant
        if [ $? -ne 0 ]
        then
            echo
            echo "** Invalid variant: '$variant'"
            echo "** Must be one of ${VARIANT_CHOICES[@]}"
            variant=
        fi
    
        if [ -z "$product" -o -z "$variant" ]
        then
            echo
            return 1
        fi
      #到处环境变量
        export TARGET_PRODUCT=$product
        export TARGET_BUILD_VARIANT=$variant
        export TARGET_BUILD_TYPE=release
    
        echo
    
        set_stuff_for_environment
        printconfig
    }
    function hmm() {
    cat <<EOF
    Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
    - lunch:   lunch <product_name>-<build_variant>
    - tapas:   tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
    - croot:   Changes directory to the top of the tree.
    - m:       Makes from the top of the tree.
    - mm:      Builds all of the modules in the current directory, but not their dependencies.
    - mmm:     Builds all of the modules in the supplied directories, but not their dependencies.
               To limit the modules being built use the syntax: mmm dir/:target1,target2.
    - mma:     Builds all of the modules in the current directory, and their dependencies.
    - mmma:    Builds all of the modules in the supplied directories, and their dependencies.
    - cgrep:   Greps on all local C/C++ files.
    - ggrep:   Greps on all local Gradle files.
    - jgrep:   Greps on all local Java files.
    - resgrep: Greps on all local res/*.xml files.
    - sgrep:   Greps on all local source files.
    - godir:   Go to the directory containing a file.
    
    Look at the source to view more functions. The complete list is:
    EOF
        T=$(gettop)
        local A
        A=""
        for i in `cat $T/build/envsetup.sh | sed -n "/^[ 	]*function /s/function ([a-z_]*).*/1/p" | sort | uniq`; do
          A="$A $i"
        done
        echo $A
    }
  • 相关阅读:
    初见QT---信号和槽(二)
    初见QT---信号和槽
    Python的那些事---数据分析(一)---NumPy基础
    初见QT---创建QPushButton按钮
    初见QT---QT creator常见快捷键使用
    PHP 反射 Reflection
    python 代码求阶乘
    Python中的计时器对象
    python websocket 再线聊天室的 Demo
    Tornado创建一个web服务
  • 原文地址:https://www.cnblogs.com/maogefff/p/7723027.html
Copyright © 2011-2022 走看看