=嵌入式开发中的一句话备忘 - 嵌入式linux(安卓)
安卓BSP的基本知识
//上层log开启的标志是
--------- beginning of main
//如果出现重启,则导出的log中有关键字backtrace
的类似堆栈打印:
01-01 08:01:34.745 2604 21611 F DEBUG : backtrace:
01-01 08:01:34.745 2604 21611 F DEBUG : #00 pc 00007c8c /vendor/lib/lib_omx_v4l2_common_arm11_elinux.so (V4l2Object::IsFormatSupported(unsigned int)+8)
01-01 08:01:34.745 2604 21611 F DEBUG : #01 pc 00007cdd /vendor/lib/lib_omx_v4l2_common_arm11_elinux.so
//实时搜索logcat的log,比如实时搜索 FAULT_CAM :
logcat |grep FAULT_CAM
//刷机模式:
用adb reboot bootloader 命令先进刷机模式, 然后再用命令去刷写,比如NXP使用uuu命令
//安卓录屏命令:
adb shell screenrecord /sdcard/demo.mp4
录制的视频存放到手机sd卡里,默认录制时间为180s。按Ctrl+C结束录制。
adb shell screenrecord --time-limit 10 /sdcard/demo.mp4
说明:限制视频录制时间为10s
//安卓的版本:8.0简称o版本,9.0简称p版本,以此类推
//安卓文件系统的原始路径: system/core/rootdir
android9产品,busybox在 /sbin/busybox,而 /bin里面的二进制大都指向了toybox(/system/bin/下)
//adb remount执行前后的分区差异
IMX8 (android 9)
//安卓下uboot里敲fastboot 0,进入fastboot状态,可以方便升级
//安装软件后(adb install -r xxx.apk),桌面不显示图标需要:
adb shell settings put system "showallapp" 1
ps -A | grep -i launcher
找到桌面进程,杀一次,就可以了,或者重启设备.
恢复简洁模式:
adb shell settings put system "showallapp" 0
adb shell "am force-stop com.dftc.launcher"
//nxp imx 升级使用uuu工具,windows下升级时插入的USB会映射出一个外设:
//反复开关机,挂机测试时长时间抓log的方法
先查询logcat的使用配置项:
ps -A -o ARGS
可以看到:
logcat -b main -b system -b crash -f /logcache/log/logcat.log -r2048 -n 50 -v threadtime
logcat -b kernel -f /logcache/log/logcat_kernel.log -r1024 -n 50 -v threadtime
如果禁用"-b main -b system -b crash"类型log,就修改
/system/etc/init.logcat.sh
去掉"-b main -b system -b crash"相关行;
如果希望kernel log不要1MB才存一次,可以修改
/system/etc/init.logkernel.sh
中的-r1024 为 -r100,即100KB存一次
//如果要清除所有缓冲区(如radio,kernel..etc),请使用以下命令 adb shell logcat -b all -c
//NXP IMX8QM-CPU的安卓9的prop:
E:\_project_G59\_imx8qm MEK\android_p9.0.0_2.0.0-ga_image_8qmek.tar\android_p9.0.0_2.0.0-ga_image_8qmek>adb shell getprop
[TMPDIR]: [/data/vendor/.opencl-cache]
[back_camera_name]: [imx8_ov5640_mipi,max9286_mipi,imx8_ov5640]
[back_camera_orient]: [0]
[camera.disable_zsl_mode]: [1]
[dalvik.vm.appimageformat]: [lz4]
[dalvik.vm.dex2oat-Xms]: [64m]
[dalvik.vm.dex2oat-Xmx]: [512m]
[dalvik.vm.dex2oat-minidebuginfo]: [true]
[dalvik.vm.dexopt.secondary]: [true]
[dalvik.vm.heapgrowthlimit]: [192m]
[dalvik.vm.heapmaxfree]: [8m]
[dalvik.vm.heapminfree]: [512k]
[dalvik.vm.heapsize]: [512m]
[dalvik.vm.heapstartsize]: [16m]
[dalvik.vm.heaptargetutilization]: [0.75]
[dalvik.vm.image-dex2oat-Xms]: [64m]
[dalvik.vm.image-dex2oat-Xmx]: [64m]
[dalvik.vm.image-dex2oat-filter]: [verify-at-runtime]
[dalvik.vm.isa.arm.features]: [default]
[dalvik.vm.isa.arm.variant]: [cortex-a9]
[dalvik.vm.isa.arm64.features]: [default]
[dalvik.vm.isa.arm64.variant]: [cortex-a53]
[dalvik.vm.lockprof.threshold]: [500]
[dalvik.vm.stack-trace-dir]: [/data/anr]
[dalvik.vm.usejit]: [true]
[dalvik.vm.usejitprofiles]: [true]
[debug.atrace.tags.enableflags]: [0]
[debug.force_rtl]: [0]
[dev.bootcomplete]: [1]
[front_camera_name]: [imx8_ov5640,imx8_ov5640_mipi,uvc]
[front_camera_orient]: [0]
[gsm.current.phone-type]: [1]
[gsm.network.type]: [Unknown]
[gsm.operator.alpha]: []
[gsm.operator.iso-country]: []
[gsm.operator.isroaming]: [false]
[gsm.operator.numeric]: []
[hw.backlight.dev]: [56228000.mipi_dsi_bridge.0]
[hwc.stretch.filter]: [1]
[hwservicemanager.ready]: [true]
[init.svc.adbd]: [running]
[init.svc.audioserver]: [running]
[init.svc.bootanim]: [stopped]
[init.svc.cameraserver]: [running]
[init.svc.console]: [running]
[init.svc.drm]: [running]
[init.svc.early_init_sh]: [stopped]
[init.svc.gatekeeperd]: [running]
[init.svc.healthd]: [running]
[init.svc.hidl_memory]: [running]
[init.svc.hwservicemanager]: [running]
[init.svc.incidentd]: [running]
[init.svc.installd]: [running]
[init.svc.keystore]: [running]
[init.svc.lmkd]: [running]
[init.svc.logd]: [running]
[init.svc.logd-reinit]: [stopped]
[init.svc.media]: [running]
[init.svc.mediadrm]: [running]
[init.svc.mediaextractor]: [running]
[init.svc.mediametrics]: [running]
[init.svc.netd]: [running]
[init.svc.perfprofd]: [running]
[init.svc.sensor_fusion]: [running]
[init.svc.servicemanager]: [running]
[init.svc.start_hci_filter]: [stopped]
[init.svc.statsd]: [running]
[init.svc.storaged]: [running]
[init.svc.surfaceflinger]: [running]
[init.svc.thermalservice]: [running]
[init.svc.tombstoned]: [running]
[init.svc.ueventd]: [running]
[init.svc.update_engine]: [running]
[init.svc.update_verifier_nonencrypted]: [stopped]
[init.svc.usb-hal-1-1]: [running]
[init.svc.usbd]: [stopped]
[init.svc.vendor.audio-hal-2-0]: [running]
[init.svc.vendor.bluetooth-1-0]: [running]
[init.svc.vendor.boot-hal-1-0]: [running]
[init.svc.vendor.camera-provider-2-4]: [running]
[init.svc.vendor.cas-hal-1-0]: [running]
[init.svc.vendor.configstore-hal]: [running]
[init.svc.vendor.drm-hal-1-0]: [running]
[init.svc.vendor.gatekeeper-1-0]: [running]
[init.svc.vendor.gralloc-2-0]: [running]
[init.svc.vendor.health-hal-2-0]: [running]
[init.svc.vendor.hwcomposer-2-1]: [running]
[init.svc.vendor.keymaster-3-0-software]: [running]
[init.svc.vendor.light-hal-2-0]: [running]
[init.svc.vendor.media.omx]: [running]
[init.svc.vendor.memtrack-hal-1-0]: [running]
[init.svc.vendor.power-hal-1-0]: [running]
[init.svc.vendor.ril-daemon]: [running]
[init.svc.vendor.sensors-hal-1-0]: [running]
[init.svc.vendor.wifi_hal_legacy]: [running]
[init.svc.vndservicemanager]: [running]
[init.svc.vold]: [running]
[init.svc.watchdogd]: [running]
[init.svc.wificond]: [running]
[init.svc.zygote]: [running]
[init.svc.zygote_secondary]: [running]
[log.tag.WifiHAL]: [D]
[log.tag.stats_log]: [I]
[logd.logpersistd.enable]: [true]
[media.amphion_vpu.enable-tile]: [0]
[media.fsl_codec.flag]: [7]
[net.bt.name]: [Android]
[net.qtaguid_enabled]: [1]
[net.tcp.default_init_rwnd]: [60]
[partition.vendor.verified]: [2]
[persist.netd.stable_secret]: [80ac:6261:c068:eec7:641f:9d3b:4f37:5d8e]
[persist.service.bdroid.bdaddr]: [22:22:67:C6:69:73]
[persist.sys.dalvik.vm.lib.2]: [libart.so]
[persist.sys.displayinset.top]: [0]
[persist.sys.timezone]: [GMT]
[persist.sys.usb.config]: [adb]
[persist.sys.webview.vmsize]: [147551200]
[pm.dexopt.ab-ota]: [speed-profile]
[pm.dexopt.bg-dexopt]: [speed-profile]
[pm.dexopt.boot]: [quicken]
[pm.dexopt.first-boot]: [extract]
[pm.dexopt.inactive]: [verify]
[pm.dexopt.install]: [speed-profile]
[pm.dexopt.priv-apps-oob]: [false]
[pm.dexopt.priv-apps-oob-list]: [ALL]
[pm.dexopt.shared]: [speed]
[qcom.bluetooth.soc]: [rome_uart]
[ro.FSL_AAC_PARSER]: [1]
[ro.FSL_AVI_PARSER]: [1]
[ro.FSL_FLAC_PARSER]: [1]
[ro.FSL_FLV_PARSER]: [1]
[ro.FSL_MKV_PARSER]: [1]
[ro.FSL_MPG2_PARSER]: [1]
[ro.actionable_compatible_property.enabled]: [true]
[ro.allow.mock.location]: [1]
[ro.art.hiddenapi.warning]: [1]
[ro.audio.usb.period_us]: [20000]
[ro.baseband]: [unknown]
[ro.bionic.ld.warning]: [1]
[ro.board.platform]: [imx8]
[ro.boot.avb_version]: [1.1]
[ro.boot.bootreason]: [reboot]
[ro.boot.boottime]: [1BLL:0,1BLE:4485,KL:0,KD:0,AVB:1748,ODT:0,SW:0]
[ro.boot.btmacaddr]: [09:0b:20:0e:82:89]
[ro.boot.console]: [ttyLP0]
[ro.boot.dtbo_idx]: [0]
[ro.boot.fbTileSupport]: [enable]
[ro.boot.hardware]: [freescale]
[ro.boot.keystore]: [software]
[ro.boot.primary_display]: [imx-drm]
[ro.boot.serialno]: [090b200e82895de0]
[ro.boot.slot_suffix]: [_a]
[ro.boot.soc_type]: [imx8qm]
[ro.boot.storage_type]: [emmc]
[ro.boot.vbmeta.avb_version]: [1.1]
[ro.boot.vbmeta.device_state]: [locked]
[ro.boot.vbmeta.digest]: [b7b24413b929d250665e8941f618606481725fcc1bd7e0beb3c1bac37bbda3f6]
[ro.boot.vbmeta.hash_alg]: [sha256]
[ro.boot.vbmeta.invalidate_on_error]: [yes]
[ro.boot.vbmeta.size]: [3264]
[ro.boot.verifiedbootstate]: [green]
[ro.boot.veritymode]: [enforcing]
[ro.boot.wificountrycode]: [CN]
[ro.bootimage.build.date]: [Mon Oct 21 17:29:48 CST 2019]
[ro.bootimage.build.date.utc]: [1571650188]
[ro.bootimage.build.fingerprint]: [Android/mek_8q/mek_8q:9/2.0.1-ga-rc1/ck10211729:eng/dev-keys]
[ro.bootloader]: [unknown]
[ro.bootmode]: [unknown]
[ro.boottime.adbd]: [12706728250]
[ro.boottime.audioserver]: [12513241750]
[ro.boottime.bootanim]: [14284214000]
[ro.boottime.cameraserver]: [12547083250]
[ro.boottime.console]: [12537625375]
[ro.boottime.drm]: [12527463500]
[ro.boottime.early_init_sh]: [10223330000]
[ro.boottime.gatekeeperd]: [12594379375]
[ro.boottime.healthd]: [12390595000]
[ro.boottime.hidl_memory]: [12388626000]
[ro.boottime.hwservicemanager]: [11875093625]
[ro.boottime.incidentd]: [12550012375]
[ro.boottime.init]: [9641]
[ro.boottime.init.cold_boot_wait]: [292]
[ro.boottime.init.mount_all.default]: [1302]
[ro.boottime.init.selinux]: [260]
[ro.boottime.installd]: [12552057000]
[ro.boottime.keystore]: [12554202875]
[ro.boottime.lmkd]: [12501298250]
[ro.boottime.logd]: [11872465375]
[ro.boottime.logd-reinit]: [12296866250]
[ro.boottime.media]: [12521879875]
[ro.boottime.mediadrm]: [12518108250]
[ro.boottime.mediaextractor]: [12556459750]
[ro.boottime.mediametrics]: [12561128375]
[ro.boottime.netd]: [12285679875]
[ro.boottime.perfprofd]: [12602842000]
[ro.boottime.sensor_fusion]: [12544469750]
[ro.boottime.servicemanager]: [11873846750]
[ro.boottime.statsd]: [12563297125]
[ro.boottime.storaged]: [12565889500]
[ro.boottime.surfaceflinger]: [12503315625]
[ro.boottime.thermalservice]: [12507950000]
[ro.boottime.tombstoned]: [12606347875]
[ro.boottime.ueventd]: [10218993375]
[ro.boottime.update_engine]: [12608034750]
[ro.boottime.update_verifier_nonencrypted]: [12234968875]
[ro.boottime.usb-hal-1-1]: [12498961625]
[ro.boottime.usbd]: [12618077500]
[ro.boottime.vendor.audio-hal-2-0]: [12395492625]
[ro.boottime.vendor.bluetooth-1-0]: [12399999250]
[ro.boottime.vendor.boot-hal-1-0]: [11938480375]
[ro.boottime.vendor.camera-provider-2-4]: [12405385625]
[ro.boottime.vendor.cas-hal-1-0]: [12415014000]
[ro.boottime.vendor.configstore-hal]: [12417631250]
[ro.boottime.vendor.drm-hal-1-0]: [12420269875]
[ro.boottime.vendor.gatekeeper-1-0]: [12422978000]
[ro.boottime.vendor.gralloc-2-0]: [12426681875]
[ro.boottime.vendor.health-hal-2-0]: [12437251125]
[ro.boottime.vendor.hwcomposer-2-1]: [12433168500]
[ro.boottime.vendor.keymaster-3-0-software]: [11940772625]
[ro.boottime.vendor.light-hal-2-0]: [12444999750]
[ro.boottime.vendor.media.omx]: [12578611375]
[ro.boottime.vendor.memtrack-hal-1-0]: [12456161875]
[ro.boottime.vendor.power-hal-1-0]: [12465982250]
[ro.boottime.vendor.ril-daemon]: [12592501750]
[ro.boottime.vendor.sensors-hal-1-0]: [12483897250]
[ro.boottime.vendor.wifi_hal_legacy]: [12325088125]
[ro.boottime.vndservicemanager]: [11877345750]
[ro.boottime.vold]: [11943227375]
[ro.boottime.watchdogd]: [10538591125]
[ro.boottime.wificond]: [12569042750]
[ro.boottime.zygote]: [12287052375]
[ro.boottime.zygote_secondary]: [12288451250]
[ro.build.ab_update]: [true]
[ro.build.characteristics]: [tablet]
[ro.build.date]: [Mon Oct 21 17:29:48 CST 2019]
[ro.build.date.utc]: [1571650188]
[ro.build.description]: [mek_8q-eng 9 2.0.1-ga-rc1 20190529 dev-keys]
[ro.build.display.id]: [mek_8q-eng 9 2.0.1-ga-rc1 20190529 dev-keys]
[ro.build.fingerprint]: [Android/mek_8q/mek_8q:9/2.0.1-ga-rc1/ck10211729:eng/dev-keys]
[ro.build.flavor]: [mek_8q-eng]
[ro.build.host]: [ck-Legion-Y7000-2019-PG0]
[ro.build.id]: [2.0.1-ga-rc1]
[ro.build.product]: [mek_8q]
[ro.build.system_root_image]: [true]
[ro.build.tags]: [dev-keys]
[ro.build.type]: [eng]
[ro.build.user]: [ck]
[ro.build.version.all_codenames]: [REL]
[ro.build.version.base_os]: []
[ro.build.version.codename]: [REL]
[ro.build.version.incremental]: [20190529]
[ro.build.version.min_supported_target_sdk]: [17]
[ro.build.version.preview_sdk]: [0]
[ro.build.version.release]: [9]
[ro.build.version.sdk]: [28]
[ro.build.version.security_patch]: [2019-01-05]
[ro.carrier]: [unknown]
[ro.config.alarm_alert]: [Alarm_Classic.ogg]
[ro.config.notification_sound]: [OnTheHunt.ogg]
[ro.crypto.state]: [encrypted]
[ro.crypto.type]: [file]
[ro.dalvik.vm.native.bridge]: [0]
[ro.debuggable]: [1]
[ro.device_owner]: [false]
[ro.frp.pst]: [/dev/block/by-name/presistdata]
[ro.hardware]: [freescale]
[ro.hardware.bootctrl]: [avb]
[ro.hardware.lightsensor]: [/sys/class/i2c-dev/i2c-4/device/4-0044/]
[ro.kernel.android.checkjni]: [1]
[ro.lightsensor.threshold]: [20]
[ro.lmk.use_minfree_levels]: [true]
[ro.logd.size.stats]: [64K]
[ro.media.maxmem]: [3221225471]
[ro.mediacomponents.package]: [com.nxp.extractorpkg]
[ro.opengles.version]: [196610]
[ro.persistent_properties.ready]: [true]
[ro.product.board]: [MEK]
[ro.product.brand]: [Android]
[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.device]: [mek_8q]
[ro.product.first_api_level]: [28]
[ro.product.locale]: [en-US]
[ro.product.manufacturer]: [freescale]
[ro.product.model]: [MEK-MX8Q]
[ro.product.name]: [mek_8q]
[ro.product.vendor.brand]: [Android]
[ro.product.vendor.device]: [mek_8q]
[ro.product.vendor.manufacturer]: [freescale]
[ro.product.vendor.model]: [MEK-MX8Q]
[ro.product.vendor.name]: [mek_8q]
[ro.property_service.version]: [2]
[ro.radio.noril]: [yes]
[ro.revision]: [0]
[ro.runtime.firstboot]: [1571662973162]
[ro.secure]: [0]
[ro.serialno]: [090b200e82895de0]
[ro.sf.lcd_density]: [213]
[ro.tether.denied]: [false]
[ro.treble.enabled]: [true]
[ro.vendor.build.date]: [Mon Oct 21 17:29:48 CST 2019]
[ro.vendor.build.date.utc]: [1571650188]
[ro.vendor.build.fingerprint]: [Android/mek_8q/mek_8q:9/2.0.1-ga-rc1/ck10211729:eng/dev-keys]
[ro.vendor.build.security_patch]: []
[ro.vendor.product.cpu.abilist]: [arm64-v8a,armeabi-v7a,armeabi]
[ro.vendor.product.cpu.abilist32]: [armeabi-v7a,armeabi]
[ro.vendor.product.cpu.abilist64]: [arm64-v8a]
[ro.vndk.version]: [28]
[ro.wifi.channels]: []
[ro.zygote]: [zygote64_32]
[rw.VIDEO_RENDER_NAME]: [video_render.surface]
[selinux.restorecon_recursive]: [/data/misc_ce/0]
[service.bootanim.exit]: [1]
[service.sf.present_timestamp]: [1]
[sys.all.early_init.ready]: [1]
[sys.boot.reason]: [reboot]
[sys.boot_completed]: [1]
[sys.hwc.disable]: [1]
[sys.logbootcomplete]: [1]
[sys.oem_unlock_allowed]: [0]
[sys.retaildemo.enabled]: [0]
[sys.sysctl.extra_free_kbytes]: [24300]
[sys.usb.config]: [adb]
[sys.usb.configfs]: [2]
[sys.usb.controller]: [gadget-cdns3]
[sys.usb.ffs.ready]: [1]
[sys.usb.mtp.device_type]: [3]
[sys.user.0.ce_available]: [true]
[sys.wifitracing.started]: [1]
[tombstoned.max_tombstone_count]: [50]
[vendor.2d.composition]: [0]
[vendor.all.system_server.ready]: [1]
[vendor.powerhal.state]: [interaction]
[vendor.usb.config]: [gadget-cdns3]
[vendor.wc_transport.start_hci]: [false]
[vold.has_adoptable]: [0]
[vold.has_quota]: [1]
[vold.has_reserved]: [1]
[vold.post_fs_data_done]: [1]
[wifi.concurrent.interface]: [p2p0]
[wifi.interface]: [wlan0]
camera
//查询摄像头的能力
adb shell dumpsys media.camera
查看设备分辨率:
adb shell wm size
比如G59项目是
Physical size: 1920x720
查看屏幕密度(DPI):
adb shell wm density
比如G59项目是
Physical density: 160
MTK
//flash_tool工具在客户自主升级的时候请选择fireware upgrade,以确保模块的射频参数不丢失。
项目差异对比项目差异对比
MTK | NXP | |
---|---|---|
升级方法 | 使用smart phone flash tool 加载MT6873_Android_scatter.txt,其中定义了升级的分区地址 | uuu.exe 使用 uuu.lst中定义的分区地址来升级 |
摄像头接口 | ||
显示器接口 | ||
仪表盘CPU资源 | ||
中控屏CPU资源 | ||
//
安卓的日志打印有五个等级,分别是:
- Verbose:这是最低级别,用于输出一些详细的调试信息。
- Debug:用于输出调试信息,可以在开发过程中使用。
- Info:用于输出一些重要的信息,如应用启动、网络请求等。
- Warning:用于输出警告信息,如一些不严重的错误。
- Error:用于输出错误信息。
在Android Studio中,可以直接在Logcat中看到这些等级的日志信息。