V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
capturepointer
V2EX  ›  Android

android 驱动开发的小问题 printk

  •  1
     
  •   capturepointer · 2017-06-18 21:13:47 +08:00 · 3702 次点击
    这是一个创建于 2474 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我在 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 打印,也看不到任何相关信息,我要怎么才能让它在手机上显示提示信息呢?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5332 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:15 · PVG 17:15 · LAX 02:15 · JFK 05:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.