1.现象:
编译成user版本之后,kernel打开串口输出宏,串口只有输出没有输入.
2.原因:
编译user版本之后 ro.debuggable=0
build/core/main.mk:
ifeq (true,$(strip $(enable_target_debugging)))
# Target is more debuggable and adbd is on by default
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
# Enable Dalvik lock contention logging.
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500
# Include the debugging/testing OTA keys in this build.
INCLUDE_TEST_OTA_KEYS := true
else # !enable_target_debugging
# Target is less debuggable and adbd is off by default
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
endif # !enable_target_debugging
system/core/rootdir/init.rc
service console /system/bin/sh
class core
console
disabled
user shell
group shell log
seclabel u:r:shell:s0
on property:ro.debuggable=1
start console
可见console是否启动受属性ro.debuggable的控制.
3.解决方法:
- 修改 ro.debuggable = 1
- 直接将disabled移除,默认无条件启动console.