Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    problems compiling module

    Hello, i am new to linux, C, and this forum, but i was hoping to get some help. Im trying to learn how to create kernel modules, its for a school project as well. I got the simple hello world module working, so i tried to make one that took parameters from terminal. It looks like this

    #include <linux/module.h>
    #include <linux/moduleparam.h>
    #include <linux/kernel.h>

    static char name[] = "name";
    module_param(name, char, 0);
    MODULE_PARM_DESC(name, "The name of the person being greeted);

    int init_module(void)

    printk(KERN_INFO "Hello %s\n", name);
    return 0;

    void cleanup_module(void)
    printk(KERN_INFO "Goodbye %s\n", name);

    the Makefile looks like this

    bj -m += hello3.o

    make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
    make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean

    when i run the make command i get no errors, but when i ls the dir afterwards i only see modules.order and Module.symvers. This is my problem, where is the .ko file? What did i do wrong?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Check out these links to books that document how to build kernel modules for Linux: Linux.Kernel.Development.3rd.Edition.pdf
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    I can see three problems here. In the Make file there should be obj-m += hello3.o. In hello3.c module_param should be declared like this:

    static char *name = "name";

    module_param(name, charp, 0);

    And in the MODULE_PARM_DESC() there should be double quote the end

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts