.variant.so"sofortheledmoduletheDreamvariants04*ofbase"ro.product.board","ro.board.platform"and..._ro.hardware">
当前位置:   article > 正文

系统属性文件 ro.hardware值

ro.hardware

一:

hardware/libhardware/hardware.c
01 /**
02  * There are a set of variant filename for modules. The form of the filename
03  * is "<MODULE_ID>.variant.so" so for the led module the Dream variants
04  * of base "ro.product.board", "ro.board.platform" and "ro.arch" would be:
05  *
06  * led.trout.so
07  * led.msm7k.so
08  * led.ARMV6.so
09  * led.default.so
10  */
11
12 static const char *variant_keys[] = {
13      "ro.hardware",    /* This goes first so that it can pick up a different
14                        file on the emulator. */
15     "ro.product.board",
16     "ro.board.platform",
17     "ro.arch"
18 };

这段代码和注释的意思是,硬件抽象层模块文件的命名规范为  <MODULE_ID>.variant.so 

其中,MODULE_ID表示模块的ID,variant表示四个系统属性

ro.hardware、ro.product.board、ro.board.platform 和ro.arch之一。

二:系统在加载硬件抽象层模块时,依次按照ro.hardware、ro.product.board、ro.board.platform和ro.arch的顺序来取它们的属性值。

如果其中的一个系统属性存在,那么就把它的值作为variant的值,然后再检查对应的文件是否存在,如果存在,那么就找到要加载的硬件抽象层模块文件了;否则,就继续查找下一个系统属性。如果这四个系统属性都不存在,或者对应于这四个系统属性的硬件抽象层模块文件都不存在,那么就使用 “<MODULE_ID>.default.so”   来作为要加载的硬件抽象层模块文件的名称。

系统属性ro.hardware是在系统启动时,由init进程负责设置的。它首先会读取/proc/cmdline  文件,检查里面有没有一个名称为  androidboot.hardware  的属性,如果有,就把它的值作为属性ro.hardware的值;

LPD-10W:/ # cat /proc/cmdline
rcupdate.rcu_expedited=1 console=ttyMSM0,115200n8 earlycon=msm_geni_serial,0xA84000
androidboot.hardware=qcom androidboot.console=ttyMSM0 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 service_locator.enable=1 swiotlb=2048 androidboot.configfs=true loop.max_part=7 androidboot.usbcontroller=a600000.dwc3 androidboot.boot_devices=soc/1d84000.ufshc buildvariant=userdebug androidboot.verifiedbootstate=orange androidboot.keymaster=1 androidboot.vbmeta.device=PARTUUID=ad0582b0-3862-c54f-0633-b8c7ed64b3ff androidboot.vbmeta.avb_version=1.0 androidboot.vbmeta.device_state=unlocked androidboot.vbmeta.hash_alg=sha256 androidboot.vbmeta.size=5952 androidboot.vbmeta.digest=ebe95e3ee34729ccc40a266f189e32124fc4f2baa109425e92d06b0b3e351ca2 androidboot.veritymode=disabled androidboot.bootdevice=1d84000.ufshc androidboot.boot_devices=soc/1d84000.ufshc androidboot.serialno=58395e7 androidboot.baseband=apq msm_drm.dsi_display0=dsi_leia_hx8252_1080p_video_display: androidboot.slot_suffix=_a rootwait ro init=/init androidboot.dtbo_idx=0 androidboot.dtb_idx=0

msm8937_32go:/ # cat /proc/cmdline
sched_enable_hmp=1 kpti=0 console=ttyMSM0,115200,n8 androidboot.console=ttyMSM0 androidboot.hardware=qcom user_debug=30 vmalloc=300M msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 earlycon=msm_hsl_uart,0x78B0000 buildvariant=userdebug androidboot.emmc=true androidboot.verifiedbootstate=orange androidboot.keymaster=1 androidboot.vbmeta.device=PARTUUID=83c498c2-5297-1ba0-790c-930a519325a4 androidboot.vbmeta.avb_version=1.0 androidboot.vbmeta.device_state=unlocked androidboot.vbmeta.hash_alg=sha256 androidboot.vbmeta.size=2944 androidboot.vbmeta.digest=c5708be867cf88969b2ec6a957b10b7c26c328bca2a11c5c2e429f9dc0db553d androidboot.veritymode=enforcing androidboot.serialno=2371d5b6 androidboot.baseband=msm mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_a41_rm69090_qvga_cmd:1:none:cfg:single_dsi androidboot.dtbo_idx=19 androidboot.dtb_idx=5
 

否则,就将  /proc/cpuinfo文件的内容读取出来,并且将里面的硬件信息解析出来,即将Hardware字段的内容作为属性ro.hardware的值。

LPD-10W:/ # cat /proc/cpuinfo                                                                                                           
Processor    : AArch64 Processor rev 13 (aarch64)
processor    : 0
BogoMIPS    : 38.40
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer    : 0x51
CPU architecture: 8
CPU variant    : 0x7
CPU part    : 0x803
CPU revision    : 12

processor    : 1
BogoMIPS    : 38.40
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer    : 0x51
CPU architecture: 8
CPU variant    : 0x7
CPU part    : 0x803
CPU revision    : 12

processor    : 2
BogoMIPS    : 38.40
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer    : 0x51
CPU architecture: 8
CPU variant    : 0x7
CPU part    : 0x803
CPU revision    : 12

processor    : 3
BogoMIPS    : 38.40
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer    : 0x51
CPU architecture: 8
CPU variant    : 0x7
CPU part    : 0x803
CPU revision    : 12

processor    : 4
BogoMIPS    : 38.40
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer    : 0x51
CPU architecture: 8
CPU variant    : 0x6
CPU part    : 0x802
CPU revision    : 13

processor    : 5
BogoMIPS    : 38.40
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer    : 0x51
CPU architecture: 8
CPU variant    : 0x6
CPU part    : 0x802
CPU revision    : 13

processor    : 6
BogoMIPS    : 38.40
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer    : 0x51
CPU architecture: 8
CPU variant    : 0x6
CPU part    : 0x802
CPU revision    : 13

processor    : 7
BogoMIPS    : 38.40
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp
CPU implementer    : 0x51
CPU architecture: 8
CPU variant    : 0x6
CPU part    : 0x802
CPU revision    : 13

Hardware    : Qualcomm Technologies, Inc SDM845
 

三:例如,

在Android模拟器中,从/proc/cpuinfo  文件读取出来的Hardware字段内容为 goldfish,于是,init进程就会将属性 ro.hardware 的值设置为“goldfish”。

系统属性 ro.product.board、ro.board.platform和ro.arch 是从 /system/build.prop文件读取出来的。

文件/system/build.prop

是由编译系统中的编译脚本  build/core/Makefile和Shell脚本build/tools/buildinfo.sh生成的,有兴趣的读者可以研究一下这两个文件,这里就不深入分析了。
 

LPD-10W:/system # cat build.prop                                                                                                    

# begin common build properties
# autogenerated by build/make/tools/buildinfo_common.sh
ro.system.build.date=Sat Jul 17 21:25:29 CST 2021
ro.system.build.date.utc=1626528329
ro.system.build.fingerprint=LitByLeia/LPD-10W/LPD-10W:10/QKQ1.200308.002/LUME_UI_1.3.25_LPD10_RoW:userdebug/release-keys
ro.system.build.id=QKQ1.200308.002
ro.system.build.tags=release-keys
ro.system.build.type=userdebug
ro.system.build.version.incremental=LUME_UI_1.3.25_LPD10_RoW
ro.system.build.version.release=10
ro.system.build.version.sdk=29
ro.product.system.brand=qti
ro.product.system.device=qssi
ro.product.system.manufacturer=QUALCOMM
ro.product.system.model=qssi system image for arm64
ro.product.system.name=qssi
# end common build properties
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=QKQ1.200308.002
ro.build.keys=release-keys
ro.build.display_build_number=LUME_UI_1.3.25_LPD10_RoW
ro.build.display.id=LUME_UI_1.3.25_LPD10_RoW_userdebug
ro.build.version.incremental=LUME_UI_1.3.25_LPD10_RoW
ro.build.version.sdk=29
ro.build.version.preview_sdk=0
ro.build.version.preview_sdk_fingerprint=REL
ro.build.version.codename=REL
ro.build.version.all_codenames=REL
ro.build.version.release=10
ro.build.version.security_patch=2021-07-01
ro.build.version.base_os=
ro.build.version.min_supported_target_sdk=23
ro.build.date=Sat Jul 17 21:25:29 CST 2021
ro.build.date.utc=1626528329
ro.build.type=userdebug
ro.build.user=zjgy03
ro.build.host=zjgy03-OptiPlex-9020
ro.build.tags=release-keys
ro.build.flavor=qssi-userdebug
ro.build.system_root_image=false
ro.build.ab_update=true
# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,
# use ro.product.cpu.abilist instead.
ro.product.cpu.abi=arm64-v8a
ro.product.cpu.abilist=arm64-v8a,armeabi-v7a,armeabi
ro.product.cpu.abilist32=armeabi-v7a,armeabi
ro.product.cpu.abilist64=arm64-v8a
ro.product.locale=en-US
ro.wifi.channels=
# Do not try to parse thumbprint
# end build properties

#
# from device/qcom/qssi/system.prop
#
#
# system.prop for qssi
#

rild.libpath=/vendor/lib64/libril-qc-hal-qmi.so
#rild.libargs=-d /dev/smd0
persist.rild.nitz_plmn=
persist.rild.nitz_long_ons_0=
persist.rild.nitz_long_ons_1=
persist.rild.nitz_long_ons_2=
persist.rild.nitz_long_ons_3=
persist.rild.nitz_short_ons_0=
persist.rild.nitz_short_ons_1=
persist.rild.nitz_short_ons_2=
persist.rild.nitz_short_ons_3=
ril.subscription.types=NV,RUIM
DEVICE_PROVISIONED=1
# Set network mode to (T/L/G/W/1X/EVDO, T/L/G/W/1X/EVDO) for 7+7 mode device on DSDS mode
ro.telephony.default_network=22,22

dalvik.vm.heapsize=36m
dev.pm.dyn_samplingrate=1

#ro.hdmi.enable=true
#persist.speaker.prot.enable=false
qcom.hw.aac.encoder=true
#
# system props for the cne module
#
persist.vendor.cne.feature=1

#system props for the MM modules
media.stagefright.enable-player=true
media.stagefright.enable-http=true
media.stagefright.enable-aac=true
media.stagefright.enable-qcp=true
media.stagefright.enable-fma2dp=true
media.stagefright.enable-scan=true
media.stagefright.thumbnail.prefer_hw_codecs=true
media.settings.xml=/vendor/etc/media_profiles_vendor.xml
mmp.enable.3g2=true
media.aac_51_output_enabled=true
mm.enable.smoothstreaming=true
#13631487 is decimal sum of supported codecs in AAL
#codecs:(PARSER_)AAC AC3 AMR_NB AMR_WB ASF AVI DTS FLV 3GP 3G2 MKV MP2PS MP2TS MP3 OGG QCP WAV FLAC AIFF APE DSD MOV XVID MHAS
# DOLBY_START // use aosp parser for ac4
#vendor.mm.enable.qcom_parser=63963135
#vendor.mm.enable.qcom_parser=131071999 0x7CFFFFF-0x0000100 to disable mp4 parser
vendor.mm.enable.qcom_parser=131071743
# DOLBY_END
persist.mm.enable.prefetch=true

#Netflix custom property
ro.netflix.bsp_rev=Q8250-19134-1


#
# system props for the data modules
#
ro.vendor.use_data_netmgrd=true
persist.vendor.data.mode=concurrent

#system props for time-services
persist.timed.enable=true

#
# system prop for opengles version
#
# 196608 is decimal for 0x30000 to report version 3
# 196609 is decimal for 0x30001 to report version 3.1
# 196610 is decimal for 0x30002 to report version 3.2
ro.opengles.version=196610

#
# System props for telephony
# System prop to turn on CdmaLTEPhone always
telephony.lteOnCdmaDevice=1

#Simulate sdcard on /data/media
#
persist.fuse_sdcard=true

#System props for BT
ro.bluetooth.library_name=libbluetooth_qti.so
persist.vendor.btstack.aac_frm_ctl.enabled=true

#
#snapdragon value add features
#
ro.qc.sdk.audio.ssr=false

##fluencetype can be "fluence" or "fluencepro" or "none"
ro.qc.sdk.audio.fluencetype=none
persist.audio.fluence.voicecall=true
persist.audio.fluence.voicerec=false
persist.audio.fluence.speaker=true


#enable offload audio video playback by default
audio.offload.video=true
#
##enable music through deep buffer
audio.deep_buffer.media=true
#
##set AudioFlinger client heap size
ro.af.client_heap_size_kbyte=7168
#
#system prop for RmNet Data
persist.rmnet.data.enable=true
persist.data.wda.enable=true
persist.data.df.dl_mode=5
persist.data.df.ul_mode=5
persist.data.df.agg.dl_pkt=10
persist.data.df.agg.dl_size=4096
persist.data.df.mux_count=8
persist.data.df.iwlan_mux=9
persist.data.df.dev_name=rmnet_usb0

#property to enable user to access Google WFD settings
persist.debug.wfd.enable=1
##property to choose between virtual/external wfd display
persist.sys.wfd.virtual=0


#property to enable HWC for VDS
debug.sf.enable_hwc_vds=1

#property to latch unsignaled buffer
debug.sf.latch_unsignaled=1

# enable tunnel encoding for amrwb
tunnel.audio.encode = true

#Buffer size in kbytes for compress offload playback
audio.offload.buffer.size.kb=32

#Enable offload audio video playback by default
av.offload.enable=true

#enable voice path for PCM VoIP by default
use.voice.path.for.pcm.voip=true

# system prop for NFC DT
ro.nfc.port=I2C

#enable dsp gapless mode by default
audio.offload.gapless.enabled=true

#initialize QCA1530 detection
sys.qca1530=detect

#Enable stm events
persist.debug.coresight.config=stm-events

#hwui properties
ro.hwui.texture_cache_size=72
ro.hwui.layer_cache_size=48
ro.hwui.r_buffer_cache_size=8
ro.hwui.path_cache_size=32
ro.hwui.gradient_cache_size=1
ro.hwui.drop_shadow_cache_size=6
ro.hwui.texture_cache_flushrate=0.4
ro.hwui.text_small_cache_width=1024
ro.hwui.text_small_cache_height=1024
ro.hwui.text_large_cache_width=2048
ro.hwui.text_large_cache_height=1024

config.disable_rtt=true

ro.radio.noril=true

#Bringup properties
persist.sys.force_sw_gles=1
persist.vendor.radio.atfwd.start=true
ro.kernel.qemu.gles=0
qemu.hw.mainkeys=0

#Expose aux camera for below packages
vendor.camera.aux.packagelist=org.codeaurora.snapcam

#Whitelisting the below packages
persist.vendor.camera.privapp.list=org.codeaurora.snapcam,com.leia.leiacam,com.leia.leiacam.debug
persist.camera.privapp.list=org.codeaurora.snapcam,com.leia.leiacam,com.leia.leiacam.debug

#enable IZat OptInApp overlay
persist.vendor.overlay.izat.optin=rro

# Property for backup NTP Server
persist.backup.ntpServer="0.pool.ntp.org"

#Property to enable Mag filter
persist.vendor.sensors.enable.mag_filter=true

#Partition source order for Product/Build properties pickup.
ro.product.property_source_order=odm,vendor,product,product_services,system

#Property to enable Codec2 for audio and OMX for Video
debug.stagefright.ccodec=1
persist.vendor.bluetooth.modem_nv_support = true
# end of device/qcom/qssi/system.prop

#
# ADDITIONAL_BUILD_PROPERTIES
#
ro.bionic.ld.warning=1
ro.treble.enabled=true
persist.debug.dalvik.vm.core_platform_api_policy=just-warn
dalvik.vm.lockprof.threshold=500
net.bt.name=Android
ro.vendor.qti.va_aosp.support=1
 

四:

怎么去获取现成机器的ro.hardware值呢?

答:使用adb shell就可以查看ro.hardware的值是什么。

在adb shell中执行以下命令就可以了:
LPD-10W:/ $ getprop ro.hardware
qcom
LPD-10W:/ $ getprop ro.product.board
sdm845
LPD-10W:/ $ getprop ro.board.platform
sdm845
LPD-10W:/ $ getprop ro.arch

LPD-10W:/ $ 

最后在机器如下路径找到:

vendor/lib/hw/

-rw-r--r-- 1 root root 6551312 2008-12-31 19:00 camera.qcom.so
-rw-r--r-- 1 root root   28580 2008-12-31 19:00 lights.sdm845.so
-rw-r--r-- 1 root root   15048 2008-12-31 19:00 power.default.so
-rw-r--r-- 1 root root   37144 2008-12-31 19:00 power.qcom.so
-rw-r--r-- 1 root root   51112 2008-12-31 19:00 sensors.sdm845.so
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/712536
推荐阅读
相关标签
  

闽ICP备14008679号