Android MTK6765 UART 内核打印开关
1 、关闭log输出
参考路径如下:
…/vendor/mediatek/proprietary/bootable/bootloader/lk/app/mt_boot/mt_boot.c
参考代码如下(示例):
int boot_linux_fdt(void *kernel, unsigned *tags,
unsigned machtype,
void *ramdisk, unsigned ramdisk_sz)
......
case BUILD_TYPE_USERDEBUG:
if ((g_boot_mode == META_BOOT) && is_meta_log_disable &&
#ifdef LOG_STORE_SUPPORT
(is_meta_log_disable() == 1) && (g_boot_arg->log_dynamic_switch == 0))
#else
(is_meta_log_disable() == 1))
#endif
cmdline_append("printk.disable_uart=1 slub_debug=O");
#ifdef LOG_STORE_SUPPORT
else if (boot_ftrace && g_boot_arg->log_dynamic_switch == 0)
#else
else if (boot_ftrace)
#endif
cmdline_append("printk.disable_uart=1 slub_debug=-");
else
cmdline_append("printk.disable_uart=0"); // disable=1 enable=0 //for uart0 logcat //开关控制
break;
case BUILD_TYPE_ENG:
......
2、关闭控制台
参考路径如下:
…\system\core\rootdir\init.rc
参考代码如下(示例):
......
service console /system/bin/sh
class core
console
disabled
user shell
group shell log readproc
seclabel u:r:shell:s0
setenv HOSTNAME console
# disable=0 enable=1 for uart0 logcat
on property:ro.debuggable=1 //开关控制
# Give writes to anyone for the trace folder on debug builds.
# The folder is used to store method traces.
chmod 0773 /data/misc/trace
# Give reads to anyone for the window trace folder on debug builds.
chmod 0775 /data/misc/wmtrace
start console
......