1. 创建项目自定义buildinfo.sh文件
#!/bin/bash
echo "# add build properties"
echo "# Repeat the key value,"
echo
echo "# Product info start"
echo "ro.build.rom.internal.version=$USER_VERSION_INTERNAL_NAME"
2. 将buildinfo.sh 文件在编译过程中生成到system.prop
build\make\core\Makefile
$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(API_FINGERPRINT) $(POST_PROCESS_PROPS)
# buildinfo.sh
添加自定义buildinfo.sh, 其中"USER_VERSION_INTERNAL_NAME" 是buildinfo.sh 中用到的全局变量,需要提前声明
$(hide) USER_VERSION_INTERNAL_NAME="$(USER_VERSION_INTERNAL_NAME)" \
bash xxx/xxx/tools/buildinfo.sh >> $@
3. 编译后out\target\product\xxx\system\system.prop 中将添加一条记录