Compiling simple module on Redhat stock kernel.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello,

I am trying to compile the following code on a system which has been booted with RHEL stock kernel. If I boot the same system with a custom kernel compiled from the source downloaded from kernel.org it compiles like a charm. However if I boot the system on the RHEL stock kernel (2.6.9-42.EL) no object is created in the working directory.

My session output is as below. I do not get any errors or warnings while compiling, but the module object is not being created. I believe I have the required packages installed. Can anyone help me compile it.

[hemen@localhost simple_module]$ ls -l
total 24
-rw-rw-rw-  1 hemen hemen  26 Dec 20 12:14 Kbuild
-rw-rw-rw-  1 hemen hemen 224 Dec 20 12:14 Makefile
-rw-rw-rw-  1 hemen hemen 377 Dec 18 15:39 simple_module.c
[hemen@localhost simple_module]$ make
make -C /lib/modules/`uname -r`/build M=`pwd` modules
make[1]: Entering directory `/usr/src/kernels/2.6.9-42.EL-i686'
  Building modules, stage 2.
  MODPOST
make[1]: Leaving directory `/usr/src/kernels/2.6.9-42.EL-i686'
[hemen@localhost simple_module]$ ls
Kbuild  Makefile  simple_module.c
[hemen@localhost ~]$ rpm -qa | grep kernel
kernel-smp-devel-2.6.9-42.EL
kernel-2.6.9-42.EL
kernel-ib-1.0-1
kernel-utils-2.4-13.1.83
kernel-hugemem-devel-2.6.9-42.EL
kernel-devel-2.6.9-42.EL
[hemen@localhost ~]$


Also providing the source, kbuild and Makefile I am using.



simple_module.c
===============
/* A simple linux kernel module */

/* Include the required headers */
#include <linux/module.h>
#include <linux/kernel.h>

/* The module initialisation function */
int init_module(void)
{
        printk(KERN_INFO "Simple module inserted.\n");
        return 0;
}

/* The module cleanup function */
void cleanup_module()
{
        printk(KERN_INFO "Removing simple module.\n");
}

Kbuild
======
obj-m := simple_module.o


Makefile
=======
        KERNELDIR := /lib/modules/`uname -r`/build

modules:
        $(MAKE) -C $(KERNELDIR) M=`pwd` modules

modules_install:
        $(MAKE) -C $(KERNELDIR) M=`pwd` modules_install

clean:
        $(MAKE) -C $(KERNELDIR) M=`pwd` clean



Thanks and Regards,
Hemen Kiran Kapadia
Tata Consultancy Services
Mailto: hemen.kapadia@xxxxxxx
Website: http://www.tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux