Add modules and product processes to the Android system.
Add Android Module
I. Basic Knowledge:(1) In the Android system, compilation is based on a module (rather than a file), and each module has a unique name. (2) to compile a module into the Android system, each module requires a dedicated Make file, that is, "Android. mk file;
Ii. Compile the hello. c Module
1. Write hello. c in the directory hardware/test.
2. In the hardw/test directory, write Android. mk
Steps for writing Android. mk:
(1) set the compiling path of the current module to the current folder path LOCAL_PATH :=$ (call my-dir) (2) Clear (possibly set by other modules) variables used in the compilation environment
Include $ (CLEAR_VARS) (3) block compilation Variables
LOCAL_SRC_FILES: = file to be compiled // all source code files contained in the current module LOCAL_MODULE: = Name of the generated module // name of the current module, which should be unique, the names should be special to prevent the same; LOCAL_CFLAGS: = compiled parameter // C/C ++ compiler parameter LOCAL_MODULE_TAGS: = tag // must have tags, the tag value may be debug, eng, user, development, or optional. optional is the default tag and the tag is provided for the compilation type.
(4) module type include $ (BUILD _ module type): BUILD_EXECUTABLE: Compile the executable file (ELF) BUILD_STATIC_LIBRARY on the target machine to compile the static library on the target machine (*. a is used during compilation) BUILD_SHARED_LIBRARY is used to compile the dynamic library file on the target machine (*. so) BUILD_JAVA_LIBRARY compile the java Dynamic library BUILD_STATIC_JAVA_LIBRARY on the target machine to compile the java static library BUILD_PACKAGE on the target machine to compile the java package on the target machine.
3. Return to the top-level directory of the source code and execute source build/envsetup. sh.
Purpose: (1) Add the compilation command to the current terminal (such as lunch and module compilation command m/mm/mmm) (2) Add the product name-compile type to the lunch menu;
4. Run the lunch command. You can select the nuclear_top product of quanzhi A13 provided by Android and select the corresponding product name-compilation type;
5. Compile the module, specify the directory to use mmm, and the current directory to use mm
Add Android products to idea
Refer to the nuclear-top product to implement our own product catalog
Nucler-top indicates the device nuclear_top indicates the product
1. Find the corresponding manufacturer in the device directory and create a directory of our own products, such as Joki_device.
Note:<1> the selected manufacturer is farsight (Huaqing), that is, to create a directory of our own products under the directory of this manufacturer. <2> note the product directory created, the device name must be used as the product directory name. <3> Use"Joki"Indicates the product name;
2. Enter Joki_device in the product directory and add the vendorsetup. sh file to add the product name-compile type to the lunch menu
(You can copy vendorsetup. sh under nuclear-top to your product directory and modify the product name and compilation type ;)
Modification content:
Note:<1> Joki-eng indicates the product name expressed by Joki. eng indicates that the compilation type is the project version, that is, the compilation version of the development stage; <2> execute source build/envsetup. sh script, vendorsetup. THE sh script is executed to add the product name and compilation type to the lunch menu;
3. Add the product information file: product name. mk, such as Joki. mk (not necessarily the product name, as long as it is consistent with the information file name specified by AndroidProducts. mk)(Copy nuclear_top.mk under nuclear-top to your product directory and change it to your product name Joki. mk)
Description: <1> two parameters that must be modified: PRODUCT_NAME (Product Name): JokiPRODUCT_DEVICE (Product Device ): joki_device (the device name must be the same as the created product directory name)
4. Add the AndroidProducts. mk file to specify the location of the product information file;(You can copy AndroidProducts. mk under nuclear-top to your product directory)
Modification content:Note:The second line indicates that the product information file Joki. mk is in the current directory.
5. Add the configuration file BoardConfig. mk for the device.
(You can copy BoardConfig. mk under nuclear-top to your product directory)
Do not modify content
After the file is added, configure and compile it.
6. Execute source build/envsetup. sh.
Purpose:<1> Add the configuration compilation command to the control terminal. (For example, croot or lunch) <2> All vendorsetup is executed. sh script to add "Product Model-compilation type" to the lunch menu
7. Execute the lunch command and configure it (because the above script is executed, we can see our "Product Model-compilation type" in the lunch menu ")
Purpose:<1> select the product and compilation type to be compiled. (select 5) <2> check whether the selected product exists and exists. Obtain the product information based on the product information, check whether the device information of the product exists and exists to obtain the device information; <3> Find the version configuration file of the selected product <4> check whether the Selected Compilation type is correct <5> Print the selected product information and device information.
8. Execute the make command for compilation. (The compilation takes a long time)