external modules build (Re: Compiling simple module on Redhat stock kernel.)

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

 



Hallo.

On 2007-01-23, Hemen Kapadia wrote:
> This is a multipart message in MIME format.
> --=_alternative 0046BF8C6525726C_=
> Content-Transfer-Encoding: 7bit
> Content-Type: text/plain; charset="us-ascii"
>
> 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. 

First, you are using very old kernel -- 2.6.9-42.EL, thus my suggestions
may fail.

Second. Do you have that kernel configured in its directory (make
modules_prepare)? That generally depends on write permission in
`/usr/src/kernels/2.6.9-42.EL-i686'. If you don't have one (ordinary user
should not), you may find useful to use separate output directory
`make O=/tmp/linuz'. But to have fully working `make O=dir M=dir' you need at
least <http://permalink.gmane.org/gmane.linux.kernel/485431> this patch.
Your sources seems to be OK, so that is only problem, i see.

My example. Do not see, that this is my own files, nothing is
generated in linux sources.
-*- bash -*-
olecom@deen:~/kernel.org/_work/linux/linux-2.6.20-rc5$
olecom@deen:~/kernel.org/_work/linux/linux-2.6.20-rc5$ rm -rf /tmp/linuz/
olecom@deen:~/kernel.org/_work/linux/linux-2.6.20-rc5$ mkdir /tmp/linuz/
olecom@deen:~/kernel.org/_work/linux/linux-2.6.20-rc5$ make O=/tmp/linuz defconfig >/dev/null
olecom@deen:~/kernel.org/_work/linux/linux-2.6.20-rc5$ cd /tmp/linuz/
olecom@deen:/tmp/linuz$ make modules_prepare >/dev/null
olecom@deen:/tmp/linuz$ make M=~/kernel.org/_work/ti_usb/ 2>/dev/null
make -C /mnt/work/app-src-build/kernel.org/_work/linux/linux-2.6.20-rc5 O=/dev/shm/linuz

  WARNING: Symbol version dump /dev/shm/linuz/Module.symvers
           is missing; modules will have no dependencies and modversions.

  LD      /home/olecom/kernel.org/_work/ti_usb/built-in.o
  CC [M]  /home/olecom/kernel.org/_work/ti_usb/ti_usb_3410_5052.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/olecom/kernel.org/_work/ti_usb/ti_usb_3410_5052.mod.o
  LD [M]  /home/olecom/kernel.org/_work/ti_usb/ti_usb_3410_5052.ko
olecom@deen:/tmp/linuz$
-*-
_____

>
> 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
>
>
>
> --=_alternative 0046BF8C6525726C_=
> Content-Transfer-Encoding: 7bit
> Content-Type: text/html; charset="us-ascii"
>
>
><br><font size=2 face="Courier New">Hello,</font>
><br>
><br><font size=2 face="Courier New">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. </font>
><br>
><br><font size=2 face="Courier New">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.</font>
><br>
><br><font size=2><tt>[hemen@localhost simple_module]$ ls -l</tt></font>
><br><font size=2><tt>total 24</tt></font>
><br><font size=2><tt>-rw-rw-rw- &nbsp;1 hemen hemen &nbsp;26 Dec 20 12:14
> Kbuild</tt></font>
><br><font size=2><tt>-rw-rw-rw- &nbsp;1 hemen hemen 224 Dec 20 12:14 Makefile</tt></font>
><br><font size=2><tt>-rw-rw-rw- &nbsp;1 hemen hemen 377 Dec 18 15:39 simple_module.c</tt></font>
><br><font size=2><tt>[hemen@localhost simple_module]$ make</tt></font>
><br><font size=2><tt>make -C /lib/modules/`uname -r`/build M=`pwd` modules</tt></font>
><br><font size=2><tt>make[1]: Entering directory `/usr/src/kernels/2.6.9-42.EL-i686'</tt></font>
><br><font size=2><tt>&nbsp; Building modules, stage 2.</tt></font>
><br><font size=2><tt>&nbsp; MODPOST</tt></font>
><br><font size=2><tt>make[1]: Leaving directory `/usr/src/kernels/2.6.9-42.EL-i686'</tt></font>
><br><font size=2><tt>[hemen@localhost simple_module]$ ls</tt></font>
><br><font size=2><tt>Kbuild &nbsp;Makefile &nbsp;simple_module.c</tt></font>
><br><font size=2 face="Courier New">[hemen@localhost ~]$ rpm -qa | grep
> kernel</font>
><br><font size=2 face="Courier New">kernel-smp-devel-2.6.9-42.EL</font>
><br><font size=2 face="Courier New">kernel-2.6.9-42.EL</font>
><br><font size=2 face="Courier New">kernel-ib-1.0-1</font>
><br><font size=2 face="Courier New">kernel-utils-2.4-13.1.83</font>
><br><font size=2 face="Courier New">kernel-hugemem-devel-2.6.9-42.EL</font>
><br><font size=2 face="Courier New">kernel-devel-2.6.9-42.EL</font>
><br><font size=2 face="Courier New">[hemen@localhost ~]$</font>
><br>
><br>
><br><font size=2 face="Courier New">Also providing the source, kbuild and
> Makefile I am using.</font>
><br>
><br>
><br>
><br><font size=2 face="Courier New">simple_module.c</font>
><br><font size=2 face="Courier New">===============</font>
><br><font size=2 face="Courier New">/* A simple linux kernel module */</font>
><br>
><br><font size=2 face="Courier New">/* Include the required headers */</font>
><br><font size=2 face="Courier New">#include &lt;linux/module.h&gt;</font>
><br><font size=2 face="Courier New">#include &lt;linux/kernel.h&gt;</font>
><br>
><br><font size=2 face="Courier New">/* The module initialisation function
> */</font>
><br><font size=2 face="Courier New">int init_module(void)</font>
><br><font size=2 face="Courier New">{</font>
><br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; printk(KERN_INFO
> &quot;Simple module inserted.\n&quot;);</font>
><br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; return
> 0;</font>
><br><font size=2 face="Courier New">}</font>
><br>
><br><font size=2 face="Courier New">/* The module cleanup function */</font>
><br><font size=2 face="Courier New">void cleanup_module()</font>
><br><font size=2 face="Courier New">{</font>
><br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; printk(KERN_INFO
> &quot;Removing simple module.\n&quot;);</font>
><br><font size=2 face="Courier New">}</font>
><br>
><br><font size=2 face="Courier New">Kbuild</font>
><br><font size=2 face="Courier New">======</font>
><br><font size=2 face="Courier New">obj-m := simple_module.o</font>
><br>
><br>
><br><font size=2 face="Courier New">Makefile</font>
><br><font size=2 face="Courier New">=======</font>
><br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; KERNELDIR
>:= /lib/modules/`uname -r`/build</font>
><br>
><br><font size=2 face="Courier New">modules:</font>
><br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; $(MAKE)
> -C $(KERNELDIR) M=`pwd` modules</font>
><br>
><br><font size=2 face="Courier New">modules_install:</font>
><br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; $(MAKE)
> -C $(KERNELDIR) M=`pwd` modules_install</font>
><br>
><br><font size=2 face="Courier New">clean:</font>
><br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; $(MAKE)
> -C $(KERNELDIR) M=`pwd` clean </font>
><br>
><br>
><br>
><br><font size=2 face="Courier New">Thanks and Regards,<br>
> Hemen Kiran Kapadia<br>
> Tata Consultancy Services<br>
> Mailto: hemen.kapadia@xxxxxxx<br>
> Website: http://www.tcs.com</font><pre>=====-----=====-----=====
> 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
>
>
></pre>
> --=_alternative 0046BF8C6525726C_=--
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
>
>


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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