• (OK) 编译 Android, 打印 内核信息



    修改内核源代码:

    -------------------------------
    add pr_*
    -------------------------------
    	pr_emerg("%s: unable to restart system
    ", __func__);
    	pr_alert("%s: SGE packet mismatch
    ", adapter->name);
    	pr_crit("%s: cannot initialize default policy table: %d
    ", __func__, err);
    	pr_err("%s: Couldn't initialize inode slabcache
    ", __func__);
    	pr_warn("Freeing alive inet6 address %p
    ", ifp);
    	pr_notice("delayed DAD work was pending while freeing ifa=%p
    ", ifp);
    	pr_info("%s: use_tempaddr is disabled
    ", __func__);
    	pr_debug("%s
    ", __func__);
    
    -------------------------------
    can use printk
    -------------------------------
    	printk(KERN_DEBUG "MPTCP - %s: %d: %s
    ", __FILE__, __LINE__, __func__ );
    	printk(KERN_INFO "MPTCP - %s: %d: %s
    ", __FILE__, __LINE__, __func__ );
    
    	// printk("%02x ", data[i]);
    	// printk("
    ");
    	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






  • 相关阅读:
    一些python练习题
    爬取某房源网数据
    练习1:定义 is_Even 函数,传一 int 参数,判断是否是偶数,return True;不是,return False
    pycharm中tkinter 不显示窗口
    保护眼睛颜色的RGB数值
    Python study----------class的实例化
    HTML----------STUDY
    Python study----------字典 popitem()
    Python study----------Python搜索路径
    Python study----------第三方module-----chardet(识别编码)
  • 原文地址:https://www.cnblogs.com/ztguang/p/12645588.html
Copyright © 2020-2023  润新知