Find the answer to your Linux question:
Results 1 to 2 of 2
Please Help needed to compile my first kernel program I have compile & install new kernel 2.6.32.3 on path: /root/linux2.6.32.3/ I have written small program [shown below] at path: /root/abc/ ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    3

    Please Help needed to compile my first kernel program


    Please Help needed to compile my first kernel program

    I have compile & install new kernel 2.6.32.3 on path: /root/linux2.6.32.3/
    I have written small program [shown below] at path: /root/abc/

    I already compile & install kernel 2.6.32.3 on fedora 10 machine & check /boot/grub/menu1.st entry it is there.

    My program giving an error when I "make"
    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++

    uname: extra operand `.r'
    Try `uname --help' for more information.
    uname: extra operand `.r'
    Try `uname --help' for more information.
    make: Nothing to be done for `all'.


    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++

    My Kernel Program

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++
    /*
    * hello.1.c . The simplest kernel module.
    */
    #include </root/linux-2.6.32.3/include/linux/module.h> /* Needed by all modules */
    #include </root/linux-2.6.32.3/include/linux/kernel.h> /* Needed for KERN_INFO */

    int init_module(void)
    {
    printk(KERN_INFO "Hello world 1.\n");
    /*
    * A non 0 return means init_module failed; module can't be loaded.
    */
    return 0;
    }

    void cleanup_module(void)
    {
    printk(KERN_INFO "Goodbye world 1.\n");
    }

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++
    Makefile look like

    obj.m += hello.1.o
    all:
    make .C /lib/modules/$(shell uname .r)/build M=$(PWD) modules
    clean:
    make .C /lib/modules/$(shell uname .r)/build M=$(PWD) clean

    ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++~

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    the argument is not .r it is -r

Posting Permissions

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