(OK) 编译 Android, 打印 内核信息 - pr_info - pr_notice


修改内核源代码:

-------------------------------
add pr_*
-------------------------------
	pr_emerg("%s: unable to restart system\n", __func__);
	pr_alert("%s: SGE packet mismatch\n", adapter->name);
	pr_crit("%s: cannot initialize default policy table: %d\n", __func__, err);
	pr_err("%s: Couldn't initialize inode slabcache\n", __func__);
	pr_warn("Freeing alive inet6 address %p\n", ifp);
	pr_notice("delayed DAD work was pending while freeing ifa=%p\n", ifp);
	pr_info("%s: use_tempaddr is disabled\n", __func__);
	pr_debug("%s\n", __func__);

-------------------------------
can use printk
-------------------------------
	printk(KERN_DEBUG "MPTCP - %s: %d: %s\n", __FILE__, __LINE__, __func__ );
	printk(KERN_INFO "MPTCP - %s: %d: %s\n", __FILE__, __LINE__, __func__ );

	// printk("%02x ", data[i]);
	// printk("\n");
	sed -i "s/printk(KERN_DEBUG \"MPTCP/printk(KERN_INFO \"MPTCP/g" `grep "printk(KERN_DEBUG \"MPTCP" -rl ./`
-------------------------------
#define KERN_EMERG "<0>" /* system is unusable*/
#define KERN_ALERT "<1>" /* action must be taken immediately*/
#define KERN_CRIT "<2>" /* critical conditions*/
#define KERN_ERR "<3>" /* error conditions*/
#define KERN_WARNING "<4>" /* warning conditions*/
#define KERN_NOTICE "<5>" /* normal but significant condition*/
#define KERN_INFO "<6>" /* informational*/
#define KERN_DEBUG "<7>" /* debug-level messages*/
-------------------------------


启动 Android,执行下面命令:

 To determine your current console_loglevel you simply enter:

# cat /proc/sys/kernel/printk
	7       4       1       7
	current	default	minimum	boot-time-default

 To change your current console_loglevel simply write to this file, 
 so in orderto get all messages printed to the console do a simple
 and every kernel message will appear on your console.
# echo 7 > /proc/sys/kernel/printk
or
# dmesg -n 7


cat /proc/kmsg


adb -s 192.168.56.3 shell cat /proc/kmsg






  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值