build.prop
一.概念
在Android设备shell终端可以看到/system目录下的build.prop文件,android的build.prop文件是在Android编译时刻收集的各种property(LCD density/语言/编译时间, etc.),编译完成之后,文件生成在out/target/product/<board>/system/目录下。在Android运行时刻可以通过property_get()[c/c++域] / SystemProperties_get*()[java域]读取这些属性值,参考Android——SystemProperties的应用
二.生成
build.prop的生成是由make系统解析build/core/makefile完成 :
- BUILDINFO_SH := build/tools/buildinfo.sh
- $(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
- @echo Target buildinfo: $@
- @mkdir -p $(dir $@)
- $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
- TARGET_DEVICE="$(TARGET_DEVICE)" \
- PRODUCT_NAME="$(TARGET_PRODUCT)" \
- PRODUCT_BRAND="$(PRODUCT_BRAND)" \
- PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \
- PRODUCT_DEFAULT_REGION="$(call default-locale-region,$(PRODUCT_LOCALES))" \
- PRODUCT_DEFAULT_WiFi_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
- PRODUCT_MODEL="$(PRODUCT_MODEL)" \
- PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
- PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
- BUILD_ID="$(BUILD_ID)" \
- BUILD_display_ID="$(BUILD_DISPLAY_ID)" \
- BUILD_NUMBER="$(BUILD_NUMBER)" \
- PLATFORM_VERSION="$(PLATFORM_VERSION)" \
- PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
- PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
- BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
- TARGET_bootloader_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
- BUILD_fingerprint="$(BUILD_FINGERPRINT)" \
- TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
- TARGET_cpu_ABI="$(TARGET_CPU_ABI)" \
- TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
- TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
- bash $(BUILDINFO_SH) > $@
- $(hide) if [ -f $(TARGET_DEVICE_DIR)/system.prop ]; then \
- cat $(TARGET_DEVICE_DIR)/system.prop >> $@; \
- fi
- $(if $(ADDITIONAL_BUILD_PROPERTIES), \
- $(hide) echo >> $@; \
- echo "#" >> $@; \
- echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
- echo "#" >> $@; )
- $(hide) $(foreach line,$(ADDITIONAL_BUILD_PROPERTIES), \
- echo "$(line)" >> $@;)
- $(hide) build/tools/post_process_props.py $@
- build_desc :=
1.目标INSTALLED_BUILD_PROP_TARGET就是
[html] view plain copy print?
- INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
可以看到定义一些变量的值比如PRODUCT_DEFAULT_LANGUAGE,会在后面脚本中用到。然后调用build/tools/buildinfo.sh这个脚本
[html] view plain copy print?
- bash $(BUILDINFO_SH) > $@
[html] view plain copy print?
- echo "# begin build properties"
- echo "# autogenerated by buildinfo.sh"
- echo "ro.build.id=$BUILD_ID"
- echo "ro.build.display.id=$BUILD_DISPLAY_ID"
- echo "ro.build.version.incremental=$BUILD_NUMBER"
- echo "ro.build.version.sdk=$PLATFORM_SDK_VERSION"
- echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME"
- echo "ro.build.version.release=$PLATFORM_VERSION"
- echo "ro.build.date=`date`"
- echo "ro.build.date.utc=`date +%s`"
- echo "ro.build.type=$TARGET_BUILD_TYPE"
- echo "ro.build.user=$USER"
- echo "ro.build.host=`hostname`"
- echo "ro.build.tags=$BUILD_VERSION_TAGS"
- echo "ro.product.model=$PRODUCT_MODEL"
- echo "ro.product.brand=$PRODUCT_BRAND"
- echo "ro.product.name=$PRODUCT_NAME"
- echo "ro.product.device=$TARGET_DEVICE"
- echo "ro.product.board=$TARGET_BOOTLOADER_BOARD_NAME"
- echo "ro.product.cpu.abi=$TARGET_CPU_ABI"
- if [ -n "$TARGET_CPU_ABI2" ] ; then
- echo "ro.product.cpu.abi2=$TARGET_CPU_ABI2"
- fi
- echo "ro.product.manufacturer=$PRODUCT_MANUFACTURER"
- if [ -n "$PRODUCT_DEFAULT_LANGUAGE" ] ; then
- echo "ro.product.locale.language=$PRODUCT_DEFAULT_LANGUAGE"
- fi
- if [ -n "$PRODUCT_DEFAULT_REGION" ] ; then
- echo "ro.product.locale.region=$PRODUCT_DEFAULT_REGION"
- fi
- echo "ro.wifi.channels=$PRODUCT_DEFAULT_WIFI_CHANNELS"
- echo "ro.board.platform=$TARGET_BOARD_PLATFORM"
- echo "# ro.build.product is obsolete; use ro.product.device"
- echo "ro.build.product=$TARGET_DEVICE"
- echo "# Do not try to parse ro.build.description or .fingerprint"
- echo "ro.build.description=$PRIVATE_BUILD_DESC"
- echo "ro.build.fingerprint=$BUILD_FINGERPRINT"
- echo "ro.build.characteristics=$TARGET_AAPT_CHARACTERISTICS"
- echo "# end build properties"
buildinfo.sh脚本完了之后,会把$(TARGET_DEVICE_DIR)/system.prop的内容和
[html] view plain copy print?
- # Add the product-defined properties to the build properties.
- ADDITIONAL_BUILD_PROPERTIES := \
- $(ADDITIONAL_BUILD_PROPERTIES) \
- $(PRODUCT_PROPERTY_OVERrides)
ADDITIONAL_BUILD_PROPERTIES的属性 追加到build.prop。
至此,生成build.prop完毕!
三.属性
# begin build properties(开始建立系统属性)
# autogenerated by buildinfo.sh(目前这部分由build.info自动生成)
ro.build.id=IML74K(版本id)
ro.build.display.id=T40-MG-S2-V1.0(版本号)
ro.build.version.incremental=eng.root.20130428.234356(版本增量)
ro.build.version.sdk=15(sdk版本)
ro.build.version.codename=REL(版本代号)
ro.build.version.release=4.0.3(android版本)
ro.build.date=2013年04月28日星期日23:46:27 CST(编译时间)
ro.build.date.utc=1367163987(编译时间的utc表示)
ro.build.type=eng(编译类型:eng/user)
ro.build.user=root(编译者)
ro.build.host=Alex-Natty-Dell(编译主机名)
ro.build.tags=debug,test-keys
ro.product.model=S2(手机型号)--
ro.product.brand=Spreadtrum(手机品牌)
ro.product.name=sp6825eb_7661plus(手机正式名称)
ro.product.device=sp6825eb_7661(采用的设备)
ro.product.board=sp6825eb_7661(采用的主板)
ro.product.cpu.abi=armeabi-v7a(cpu的版本)
ro.product.cpu.abi2=armeabi(CPU品牌)
ro.product.manufacturer=Spreadtrum(手机制造商)
ro.wifi.channels=(WIFI连接的渠道)
ro.board.platform=sc8825(主板平台)
ro.sf.lcd_density=240(显示密度)ro.sf.hwrotation = 180(上层数据旋转180度)
ro.gpu=mali(图像处理器采用mali)
ro.opengles.version=131072((OpenGL for Embedded Systems))
ro.device.support.mmc=1
hwui.render_dirty_regions=false
ro.hwui.text_cache_width=2048
persist.ttydev=ttyVUART0
ro.device.support.vt=0(是否支持可视电话)
ro.device.support.gps=0(是否支持gps)
keyguard.no_require_sim=true (手机卡保护设置.true:无需SIM卡也可操作手机)
ro.com.android.dataroaming=false (漫游设置)
persist.msms.phone_count=2(双卡)
persist.blcr.enable=0
persist.msms.phone_default=0(双卡默认第一张卡)
dalvik.vm.heapsize=128m(虚拟内存大小:16m/24m/32m/48m等)
ro.com.android.dateformat=MM-dd-yyyy(默认时间格式:yyyy-MM-dd等)
ro.config.ringtone=BeatPlucker.ogg(默认铃声设置,文件在/system/media/audio/ringtones 把喜欢的铃声放这里,比如123.MP3放入ringtones文件夹中,这里代码改为ro.config.ringtone=123.mp3)
ro.config.notification_sound=pixiedust.ogg(默认提示音:/system/media/audio/notifications)
ro.config.alarm_alert=Alarm_Classic.ogg(默认闹铃音:/system/media/audio/alarms)
ro.product.locale.language=zh(手机默认语言,如:en/zh)
ro.product.locale.region=CN(地区语言,如:US/CN)
(产品具体mk文件(如prod_sp6825_7661base.mk)作用域自此结束)
ro.kernel.android.checkjni=1
ro.setupwizard.mode=optional(安装向导模式)
net.bt.name=Android
dalvik.vm.stack-trace-file=/data/anr/traces.txt(本参数控制Dalvik虚拟机的堆栈记录调试文件。用于系统调试,一般用户对其调整无意义)
ro.logAPPslow=0
ro.build.product.lowmem=0
ro.floatkey.show=false(true:支持小绿点功能,点击界面上的小绿点可以跳出menu/home/back三个虚拟键)
persist.sys.kb.auto=1
device.support.face.smile=1(是否支持笑脸拍照和人脸识别)
device.support.pano=1(相机是否支持全景拍照)