V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
capturepointer
V2EX  ›  Android

android 驱动开发的小问题 printk

  •  1
     
  •   capturepointer · Jun 18, 2017 · 12292 views
    This topic created in 3239 days ago, the information mentioned may be changed or developed.

    我在 ubuntu 上面写了一个 hello.c 文件:

    #include <linux/init.h>
    #include <linux/kernel.h>
    #include <linux/module.h>
    #include <linux/slab.h>
    MODULE_LICENSE("Dual BSD/GPL");
    
    static int __init hello_init(void) {
        printk(KERN_EMERG  "Hello world init!\n");
        return 0;
    }
    
    static void __exit hello_exit(void) {
        printk(KERN_EMERG  "Hello world exit!\n");
    }
    
    module_init(hello_init);
    module_exit(hello_exit);
    

    进行交叉编译,然后通过

    adb push
    

    到华为 P8 手机上,再接着使用

    insmod hello.ko
    

    是安装成功的,但是就是不会有任何输出信息提示,使用 dmesg 打印,也看不到任何相关信息,我要怎么才能让它在手机上显示提示信息呢?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2441 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 10:16 · PVG 18:16 · LAX 03:16 · JFK 06:16
    ♥ Do have faith in what you're doing.