• 二、命令解析


    1.extract-bsp()-->

        cp $LINUXOUT_DIR/bImage kernel

        cp -rf $LINUXOUT_MODULE_DIR modules/modules

    2.lunch()-->

        print_lunch_menu()-->

        //解析用户输入(数字索引),确定用户选择的产品类型,编译类型等

        export TARGET_PRODUCT=$product       #uranus_nansu,aosp_dragon,...

        export TARGET_BUILD_VARIANT=$variant  #eng user userdebug

        export TARGET_BUILD_TYPE=release

        cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core

          command make --no-print-directory -f build/core/config.mk dumpvar-report_config

    3.build/core/config.mk-->

        include $(BUILD_SYSTEM)/pathmap.mk

        CLEAR_VARS:= $(BUILD_SYSTEM)/clear_vars.mk

        XXXXXXXXXX:= $(BUILD_SYSTEM)/yyyyyyyyyy.mk

        include $(BUILD_SYSTEM)/envsetup.mk-->

            include $(BUILD_SYSTEM)/product_config.mk-->

                include $(BUILD_SYSTEM)/product.mk   #all product-ralated function definetion

                include $(BUILD_SYSTEM)/device.mk    #all device-ralated function definetion

                all_product_configs := $(get-all-product-makefiles)   # Read in all of the product definitions specified by the AndroidProducts.mk files in the tree.

                all_product_makefiles :=$(FUNC all_product_configs)        # 通过$all_product_configs获得$all_product_makefiles

                # 通过$all_product_configs以及$TARGET_PRODUCT获得$current_product_makefile,如devicesoftwinneruranus-nansuuranus_nansu.mk

                current_product_makefile := $(filter all_product_configs, TARGET_PRODUCT) # 通过$all_product_configs以及$TARGET_PRODUCT获得$current_product_makefile

                (call import-products, $(current_product_makefile))   #check to make sure that products have all the necessary vars defined, SET PRODUCTS

                    PRODUCTS := device/softwinner/uranus-nansu/uranus_nansu.mk

                TARGET_DEVICE := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEVICE) #uranus-nansu

           

            board_config_mk := (TARGET_DEVICE)/BoardConfig.mk  #devicesoftwinneruranus-nansuBoardConfig.mk

            include $(board_config_mk)

            TARGET_DEVICE_DIR :=$(patsubst %/,%,$(dir $(board_config_mk)))  #devicesoftwinneruranus-nansu

            TARGET_xxx := yyyyyy

            /*至此,所有的环节变量(全局)都已经赋值和确定*/

        include $(BUILD_SYSTEM)/dumpvar.mk   #打印输出部分全局变量值

    4.make()-->前面所有过程都只是配置产品,设置环境变量,真正编译过程在这里正式开始。

        DEFAULT_GOAL := droid   # This is the default target.  It must be the first declared target.

            droid: droid_targets-->

                droid_targets: apps_only              #TARGET_BUILD_APPS = y

                droid_targets: droidcore dist_files   #TARGET_BUILD_APPS = y

        .PHONY: droidcore

        droidcore: files                   #prebuilt,$(modules_to_install),$(INSTALLED_ANDROID_INFO_TXT_TARGET),真正内容最多的是:modules_to_install变量,其包含了当前配置下所有会被安装的模块(一个模块是否会被安装依赖于该产品的配置文件,模块的标签等信息)

        systemimage                        #$(PRODUCT_OUT)/system.img

        $(INSTALLED_BOOTIMAGE_TARGET)      #$(PRODUCT_OUT)/boot.img

        $(INSTALLED_RECOVERYIMAGE_TARGET) #$(PRODUCT_OUT)/recovery.img

        $(INSTALLED_USERDATAIMAGE_TARGET) #$(PRODUCT_OUT)/userdata.img

        $(INSTALLED_CACHEIMAGE_TARGET)     #$(PRODUCT_OUT)/cache.img

        $(INSTALLED_VENDORIMAGE_TARGET)    #$(PRODUCT_OUT)/vendor.img

        $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) #$(PRODUCT_OUT)/system_other.img

        $(INSTALLED_FILES_FILE)            #$(PRODUCT_OUT)/installed-files.txt,编译完成后会将安装的文件列表更新到盖文件,提供过查看该文件,可以确定某次优化/增加的模块是否已经移除/加入

        $(INSTALLED_FILES_FILE_VENDOR)     #$(PRODUCT_OUT)/installed-files-vendor.txt

        $(INSTALLED_FILES_FILE_SYSTEMOTHER) #$(PRODUCT_OUT)/installed-files-system-other.txt

       

        $(call dist-for-goals, droidcore,

        $(INTERNAL_UPDATE_PACKAGE_TARGET)   #$(PRODUCT_OUT)/$(TARGET_PRODUCT)-img-$(FILE_NAME_TAG) //uranus_nansu-img-20191128.zip

        $(INTERNAL_OTA_PACKAGE_TARGET)      #$(PRODUCT_OUT)/$(TARGET_PRODUCT)-ota-$(FILE_NAME_TAG) //uranus_nansu-ota-20191128.zip

        $(BUILT_OTATOOLS_PACKAGE)           #$(PRODUCT_OUT)/otatools.zip

        $(SYMBOLS_ZIP)                      #$(PRODUCT_OUT)/$(TARGET_PRODUCT)-symbols-$(FILE_NAME_TAG) //uranus_nansu-symbols-20191128.zip

        $(INSTALLED_FILES_FILE)             #$(PRODUCT_OUT)/installed-files.txt

        $(INSTALLED_FILES_FILE_VENDOR)      #$(PRODUCT_OUT)/installed-files-vendor.txt

        $(INSTALLED_FILES_FILE_SYSTEMOTHER) #$(PRODUCT_OUT)/installed-files-system-other.txt

        $(INSTALLED_BUILD_PROP_TARGET)      #$(TARGET_OUT)/build.prop

        $(BUILT_TARGET_FILES_PACKAGE)       #$(intermediates)/$(TARGET_PRODUCT)-target_files-$(FILE_NAME_TAG) //uranus_nansu-target_files-20191128.zip

        $(INSTALLED_ANDROID_INFO_TXT_TARGET) #$(PRODUCT_OUT)/android-info.txt

        $(INSTALLED_RAMDISK_TARGET)         #$(PRODUCT_OUT)/ramdisk.img

       )

      

       ifneq ($(ANDROID_BUILD_EMBEDDED),true)

       ifneq ($(TARGET_BUILD_PDK),true)

        $(call dist-for-goals, droidcore,

          $(APPS_ZIP)                       #$(PRODUCT_OUT)/$(TARGET_PRODUCT)-apps-$(FILE_NAME_TAG) //uranus_nansu-apps-20191128.zip

          #会将system/app,system/priv/app/目录中*.apk全部打包到zip文件中;

        )

       endif

       注意:dist-for-goals()只有在$(filter dist,$(MAKECMDGOALS))返回真时才会有定义,即执行的make含有dist参数才会存在定义(make dist).

       换而言之,droidcore后面依赖的这些文件/模块只有在编译发布时才会添加进来。主要是将这些依赖文件按指定格式(比如zip)拷贝至:out/dir/目录。

      

        .PHONY: dist_files

        ifeq ($(EMMA_INSTRUMENT),true)      #只有($(EMMA_INSTRUMENT)为true,以及make dist时,才会赋值dist_files

        $(EMMA_META_ZIP) : $(INSTALLED_SYSTEMIMAGE)

        $(call dist-for-goals, dist_files, $(EMMA_META_ZIP))

        endif

       

        $(PRODUCTS)=device/softwinner/uranus-nansu/uranus_nansu.mk-->

        $(call inherit-product, device/softwinner/uranus-common/uranus_64_bit.mk)

            TARGET_ARCH:=

            TARGET_2ND_ARCH:=

        $(call inherit-product, build/target/product/full_base.mk)

            # Get some sounds

            $(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)

            # Get the TTS language packs

            $(call inherit-product-if-exists, external/svox/pico/lang/all_pico_languages.mk)

            # Get a list of languages.

            $(call inherit-product, $(SRC_TARGET_DIR)/product/locales_full.mk)

            # Get everything else from the parent package

            $(call inherit-product, $(SRC_TARGET_DIR)/product/generic_no_telephony.mk)

                $(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)

                $(call inherit-product-if-exists, external/hyphenation-patterns/patterns.mk)

                $(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)

                $(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)

                $(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)-->

                    $(call inherit-product, $(SRC_TARGET_DIR)/product/core_base.mk)-->

                        $(call inherit-product, $(SRC_TARGET_DIR)/product/core_minimal.mk)-->

                            $(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk) #Provides a functioning ART environment without Android frameworks

                            $(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)-->

                                $(call inherit-product, $(SRC_TARGET_DIR)/product/embedded.mk) # This is a build configuration for a very minimal build of the Open-Source part of the tree.

        $(call inherit-product, device/softwinner/uranus-common/uranus-common.mk)-->

            $(call inherit-product, device/softwinner/common/common.mk)-->

                $(call inherit-product, vendor/aw/public/prebuild/bin/tools/tools.mk)

                $(call inherit-product, vendor/aw/public/package/display/display.mk)

        $(call inherit-product-if-exists, device/softwinner/uranus-t1/modules/modules.mk)

       

       

    5.常见make命令

        /*其他常用的make 目标*/

        make clean  执行清理,等同于:rm -rf out/。

        make sdk    编译出 Android 的 SDK。

        make clean-sdk  清理 SDK 的编译产物。

        make update-api 更新 API。在 framework API 改动之后,需要首先执行该命令来更新 API,公开的 API 记录在 frameworks/base/api 目录下。

        make dist   执行 Build,并将 MAKECMDGOALS 变量定义的输出文件拷贝到 /out/dist 目录。

        make all    编译所有内容,不管当前产品的定义中是否会包含。

        make help   帮助信息,显示主要的 make 目标。

        make snod   从已经编译出的包快速重建系统镜像。

        make libandroid_runtime 编译所有 JNI framework 内容。

        make framework  编译所有 Java framework 内容。

        make services   编译系统服务和相关内容。

        make <local_target> 编译一个指定的模块,local_target 为模块的名称。

        make clean-<local_target>   清理一个指定模块的编译结果。

        make dump-products  显示所有产品的编译配置信息,例如:产品名,产品支持的地区语言,产品中会包含的模块等信息。

        make PRODUCT-xxx-yyy    编译某个指定的产品。

        make bootimage  生成 boot.img

        make recoveryimage  生成 recovery.img

        make userdataimage  生成 userdata.img

        make cacheimage 生成 cache.img

       

  • 相关阅读:
    Delphi 访问https /SSL、OpenSSL
    Delphi UTF编码/解码 UTF8Encode、UTF8Decode、URLEncode、URLDecode
    编译器架构Compiler Architecture(下)
    编译器架构Compiler Architecture(上)
    Xilinx Zynq FPGA Boards板
    如何为应用选择最佳的FPGA(下)
    如何为应用选择最佳的FPGA(上)
    FPGA与ASIC:它们之间的区别以及使用哪一种?
    ASIC设计-终极指南
    77GHz 和24GHz Radar性能解析
  • 原文地址:https://www.cnblogs.com/fbli/p/13367041.html
Copyright © 2020-2023  润新知