When Android integrates a new product, lunch's product name and device name considerations

Source: Internet
Author: User


Android System lunch A current product approximate process consists of the following sections:

1. Lunch determine target_product. The vendorsetup.sh script, which is generally located in Vendor/device/build/target/product, has user/eng/userdebug defined respectively.

2. The reasonableness of developing check product.

By loading the androidproduct.mk file in Vendor/device/build/target/product, record the individual. mk files it includes and the path to which it is located, as the current all_product_makefile.

By selecting the Target_product filter to Current_prodcut_makefile.

197 Current_product_makefile: =198 all_product_makefiles: =199 $ (foreach F, $ (all_product_configs), $     $ (eval _cpm _words: = $ (subst:, $ (space), $ (f))) 201     $ (eval _cpm_word1: = $ (Word 1,$ (_cpm_words))) 202     $ (eval _cpm_word2: = $ ( Word 2,$ (_cpm_words))) 203     $ (if $ (_cpm_word2), 204         $ (eval all_product_makefiles + = $ (_cpm_word2)) 205         $ (if $ (Filter $ (target_product), $ (_cpm_word1)), 206             $ (eval current_product_makefile + = $ (_CPM_WORD2)), 207         $ ( Eval All_product_makefiles + = $ (f)) 208         $ (if $ (filter $ (target_product), $ (basename $ (Notdir $ (f))), 209< c11/>$ (eval Current_product_makefile + + $ (f)))) _cpm_words: =211 _cpm_word1: =212 _cpm_word2: =213 current_ Product_makefile: = $ (Strip $ (current_product_makefile)) 214 All_product_makefiles: = $ (Strip $ (all_product_makefiles) )
Take the basename after the path Notdir xxx.mk is located.

3 by import-product The current makefile file, it is possible to have all, usually is. This import process, basically parsing this MK file, and based on _product_var_list to generate a new list variable.

  _product_var_list: =     product_name     product_model     product_locales     product_aapt_config     product_aapt_pref_config  product_packages     Product_packages_debug     product_packages_eng     product_packages_tests \
These variables need to be defined and assigned under our product folder, where the relevant assignment determines whether the product can pass the lunch product check.

4. A new variable name is formed when the Var list is generated for the associated MK file:

product.device/"Vendor"/*/"Device_name"/xxx.mk.product_name = our custom product name.

The * number can represent the existence of XXX.MK in multi-level folders. That is,/*/will voluntarily cross the multilevel folder to find the desired target file.

5. Resolve-short-product-name

The Resolve-short-product-name function is defined in the Build/core/product.mk file.

The essence of this function is to match target_product with the value of the variable that we have previously generated in the var list with product_name fields, based on xxx.mk. Finally assuming a match. Return the path that belongs to this xxx.mk file as the return value in this variable.

This process assumes no matches, which means that although the file structure we created is normal, the product_name specified in the product-related XXX.MK file do not match the values we lunch declared. It means that the product chosen by this lunch is unreasonable and needs to be chosen again. Or, this product name needs to be changed.

The Target_product function of lunch selection is the first to locate the XXX,MK file structure is normal. such as lunch fish. You generally need to define the FISH,MK file.

But finally, the target_product further function is to match the value of Product_Name in the detailed fish,mk, before passing the match process.


6. The above process is finally designed to identify the Target_device through product to find the DEVICE

The most direct embodiment of device is that the Product_device value defined in this XXX,MK is required as a folder name, Because you might be looking for device-related boardconfig.mk in envsetup.mk, you need to find-maxdepath 4-path */$ (target_device) under Device and vendor folders. BORADCONFIG,MK(Target_device, the value is determined by the Product_device defined in XXX,MK).


Summarize:

The description of the above description can be broadly described in defining a vendor to be published under the product, we should first define a device_name as the current product of a large folder, in this folder to define a XXX,MK file, In this xxx.mk, you need to specify Product_device and folder names to match, and then define Product_Name. Then go to lunch to define the same name, can have User/eng and other types are optional. After dealing with these, you need to name xxx The product_name that is target_product corresponding value.

This is required to successfully extract and target_product the same MK file as the current file in the all Product makefile file.

/device/gzz/fish/under Basic files:

1. Define a XXX.MK first. XXX needs to be decided by product_name. That is, the two agree:

Product_Name: = my_fish
Product_device: = Fish

Device name is the same

2. switch file name is called My_fish. Mk To ensure product name is consistent

3. ANDROIDPRODUCT.MK:

Product_makefiles: = $ (local_dir)/my_fish. mk

4. Vendorsetup,sh

Add_lunch_combo my_fish-eng, ensure product name is consistent

5. Other related, such as boardconfig.mk.


It is necessary to note that the defined product and device name can be inconsistent, the latter as the output compiled in out/target/product/fish/.


Lunch is processed from bottom to top, Target_prodcutmy_fish assumes that it cannot match my_fish.mk file from all product makefile, lunch fails.

Assume that the My_fish.mk file is parsed and the Var list is generated. Match My_fish again, assuming Product_Name is inconsistent with my_fish, match fails.

Match succeeds and the device name is found to determine taeget_device from product_device like here fish. Assume that the folder name is not fish. The no device config failure is reported.

Therefore, all aspects need to be consistent. Talent enough through a lunch search, Android is very good to ensure that the system is compiled, the entire compilation environment is OK, and is the product you need.











When Android integrates a new product, lunch's product name and device name considerations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.