(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
分类:
016_LOS/CM/And/移植/刷机
, 999_OK
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通