How can I configure the AOSP build number?

I am building AOSP, v4.4.2. I want to specify part of the line "Build number" (in accordance with the settings β†’ About the tablet).

About tablet page

I know that this can be done for the kernel using the CONFIG_LOCALVERSION defconfig value. But I want to change the "Build number" and not the "Kernel version" (which I was able to do successfully).

Currently, the relevant parts of my AOSP assembly are as follows:

 # Source build variables . build/envsetup.sh # Specify the build target: # * user -> limited access; suited for production (no ADB) # * userdebug -> like "user" but with root access and debuggability; preferred for debugging # * eng -> development configuration with additional debugging tools (with ADB) lunch mydevice-eng # Build it! time m 2>&1 | tee build.out 

What should I change to indicate the build number?

+5
source share
2 answers

The Makefile determines how the assembly number (concatenated) is created for the assembly.


custom builds

For the user to create (build target, as indicated in the tape), the build number will simply be $(BUILD_ID) $(BUILD_KEYS) , unless DISPLAY_BUILD_NUMBER set to true.

eng / userdebug builds

For other builds (i.e. eng / userdebug) much more information is added:

 build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER) $(BUILD_VERSION_TAGS) 

The Makefile source is available here: https://android.googlesource.com/platform/build/+/android-4.4.2_r1/core/Makefile#106


Configure build options in the make file

As @eldarerathis mentioned, the BUILD_ID value in build/core/build_id.mk is determined by what part of the assembly line is defined, however this can be overridden in another make ( *.mk ).

When lunch starts, the BUILD_ID value will be printed for verification. If this value is different from the value found in the build_id.mk file, then find where to install it and reconfigure it. For example, if as part of lunch output includes "4.4.2_1.0.0-ga":

 ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=4.4.2 ... HOST_BUILD_TYPE=release BUILD_ID=4.4.2_1.0.0-ga OUT_DIR=out ============================================ 

... then search for "4.4.2_1.0.0-ga" to find it:

 me@mybox :~/AOSP$find . -name "*.mk" | xargs grep "4.4.2_1.0.0-ga" 

Then update the .mk file containing the BUILD_ID . Set other build options.

BUILD_NUMBER , PLATFORM_VERSION and BUILD_ID are located at: build/core/version_defaults.mk . Values ​​are set only if the assembly is initiated without setting them.

Setting assembly parameters as a parameter during assembly

Alternatively (and, in my opinion, desirable), these parameters can be set as part of the build command line as follows:

 me@mybox :~/AOSP$ time m BUILD_ID="MyBuildv1.2" BUILD_NUMBER=12345 2>&1 | tee build.out 
+8
source

The BUILD_ID value in build/core/build_id.mk is where it is defined:

 # BUILD_ID is usually used to specify the branch name # (like "MAIN") or a branch name and a release candidate # (like "CRB01"). It must be a single word, and is # capitalized by convention. export BUILD_ID=KOT49H 

This value is written to your assembly properties, and Settings reads it from there, so you just need to change this export to whatever you want. The commentary is merely informative; you should not follow the conventions outlined there. In the main branch, they are defined as AOSP at present.

Another flag available: DISPLAY_BUILD_NUMBER ( example ). It is optional and probably not needed in your situation, but here is a description of how it works, if used:

 # DISPLAY_BUILD_NUMBER should only be set for development branches, # If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for # a more descriptive BUILD_ID_DISPLAY, otherwise BUILD_ID_DISPLAY # is the same as BUILD_ID DISPLAY_BUILD_NUMBER := true 
+7
source

Source: https://habr.com/ru/post/1212052/


All Articles