Openembedded Core Discussions
 help / color / mirror / Atom feed
* Re: Build Kernel module on target
       [not found]     ` <502EAC8E.1090707@linux.intel.com>
@ 2012-08-17 23:07       ` Bodke, Kishore K
  2012-08-17 23:15         ` Darren Hart
  0 siblings, 1 reply; 2+ messages in thread
From: Bodke, Kishore K @ 2012-08-17 23:07 UTC (permalink / raw)
  To: Darren Hart; +Cc: openembedded-core@lists.openembedded.org



>-----Original Message-----
>From: Darren Hart [mailto:dvhart@linux.intel.com]
>Sent: Friday, August 17, 2012 1:42 PM
>To: Bodke, Kishore K
>Cc: linux-yocto@yoctoproject.org
>Subject: Re: Build Kernel module on target
>
>
>
>On 08/17/2012 11:11 AM, Bodke, Kishore K wrote:
>>
>>
>>> -----Original Message-----
>>> From: Darren Hart [mailto:dvhart@linux.intel.com]
>>> Sent: Thursday, August 16, 2012 5:00 PM
>>> To: Bodke, Kishore K
>>> Cc: linux-yocto@yoctoproject.org
>>> Subject: Re: Build Kernel module on target
>>>
>>>
>>>
>>> On 08/16/2012 04:31 PM, Bodke, Kishore K wrote:
>>>> Hi Darren,
>>>
>>> Hi Kishore,
>>>
>>>> I am trying to build the Kernel Module on the target with sdk image.
>>>> I get the below error for all the kernel modules I am building.
>>>>
>>>> == Build lib/librte_eal/linuxapp/igb_uio
>>>>
>>>> make: *** /lib/modules/3.4.6-yocto-standard/build: No such file or
>>>> directory.  Stop.
>>>>
>>>> make[7]: *** [igb_uio.ko] Error 2
>>>>
>>>> Makefile has the kernel source directory  set like below.
>>>>
>>>> RTE_KERNELDIR = /lib/modules/$(shell uname -r)/build
>>>>
>>>> And I see there is no build directory there in
>>>> /lib/modules/3.4.6-yocto-standard .
>>>>
>>>> I changed the RTE_KERNELDIR to
>>>>
>>>> RTE_KERNELDIR =/usr/src/kernel
>>>
>>> Correct.
>>
>> Why Yocto does not have /lib/modules/$(shell uname -r)/build?
>> Generally /lib/modules/$(shell uname -r)/build is where EVERY kernel
>module goes to look for kernel headers to build against.
>
>No reason. That would be a good addition. Please send a patch or open a
>bug with
>the request.
>
>>
>>>
>>>> This time it went further to build the kernel module but failed for the
>>>>
>>>> /usr/src/kernel/scripts/recordmcount: No such file or directory
>>>>
>>>> I saw the ${STAGING_KERNEL_DIR} for the recordmcount.  There is no
>such
>>> file
>>>> I think we need  scripts/recordmcount to be a part of the final image?
>>>
>>> This is an unfortunate result of the kernel building those "scripts" for
>>> the host, which we can't deploy to the target. We intentionally remove
>>> them. To build on the target, you must first build the "scripts":
>>>
>>> $ cd /usr/src/kernel
>>> $ make scripts
>>>
>>> Then try to build your modules.
>>
>> If I had to build the same module using recipe via bitbake, I get the same
>> error.
>
>You shouldn't. If you do, it's a bug either in the module building
>mechanism of oe-core or with your module recipe.
>
>> Unfortunately I cannot inherit module in my recipe.
>
>You really need to.

Moving the discussion to [open embedded core list]

Either I do inherit module or I don't, I need to have the kernel source directory to
point  to  ${STAGING_KERNEL_DIR} in my recipe, since the Makefile has /lib/modules/$(shell uname -r)/build 
for the kernel source, which If I don't override, it will build kernel module for the local host.

Also the Makefile does not have rule for module install, can we have the install rule inside a recipe to make the module 
in to the final image?
Something like 
FILES_${PN}+=  ${base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers"
install -m 640 ${B}/kmod/igb_uio.ko     ${MODULE_DIR} (This being defined in a recipe)

Thanks
Kishore.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Build Kernel module on target
  2012-08-17 23:07       ` Build Kernel module on target Bodke, Kishore K
@ 2012-08-17 23:15         ` Darren Hart
  0 siblings, 0 replies; 2+ messages in thread
From: Darren Hart @ 2012-08-17 23:15 UTC (permalink / raw)
  To: Bodke, Kishore K; +Cc: openembedded-core@lists.openembedded.org



On 08/17/2012 04:07 PM, Bodke, Kishore K wrote:
> 
> 
>> -----Original Message-----
>> From: Darren Hart [mailto:dvhart@linux.intel.com]
>> Sent: Friday, August 17, 2012 1:42 PM
>> To: Bodke, Kishore K
>> Cc: linux-yocto@yoctoproject.org
>> Subject: Re: Build Kernel module on target
>>
>>
>>
>> On 08/17/2012 11:11 AM, Bodke, Kishore K wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Darren Hart [mailto:dvhart@linux.intel.com]
>>>> Sent: Thursday, August 16, 2012 5:00 PM
>>>> To: Bodke, Kishore K
>>>> Cc: linux-yocto@yoctoproject.org
>>>> Subject: Re: Build Kernel module on target
>>>>
>>>>
>>>>
>>>> On 08/16/2012 04:31 PM, Bodke, Kishore K wrote:
>>>>> Hi Darren,
>>>>
>>>> Hi Kishore,
>>>>
>>>>> I am trying to build the Kernel Module on the target with sdk image.
>>>>> I get the below error for all the kernel modules I am building.
>>>>>
>>>>> == Build lib/librte_eal/linuxapp/igb_uio
>>>>>
>>>>> make: *** /lib/modules/3.4.6-yocto-standard/build: No such file or
>>>>> directory.  Stop.
>>>>>
>>>>> make[7]: *** [igb_uio.ko] Error 2
>>>>>
>>>>> Makefile has the kernel source directory  set like below.
>>>>>
>>>>> RTE_KERNELDIR = /lib/modules/$(shell uname -r)/build
>>>>>
>>>>> And I see there is no build directory there in
>>>>> /lib/modules/3.4.6-yocto-standard .
>>>>>
>>>>> I changed the RTE_KERNELDIR to
>>>>>
>>>>> RTE_KERNELDIR =/usr/src/kernel
>>>>
>>>> Correct.
>>>
>>> Why Yocto does not have /lib/modules/$(shell uname -r)/build?
>>> Generally /lib/modules/$(shell uname -r)/build is where EVERY kernel
>> module goes to look for kernel headers to build against.
>>
>> No reason. That would be a good addition. Please send a patch or open a
>> bug with
>> the request.
>>
>>>
>>>>
>>>>> This time it went further to build the kernel module but failed for the
>>>>>
>>>>> /usr/src/kernel/scripts/recordmcount: No such file or directory
>>>>>
>>>>> I saw the ${STAGING_KERNEL_DIR} for the recordmcount.  There is no
>> such
>>>> file
>>>>> I think we need  scripts/recordmcount to be a part of the final image?
>>>>
>>>> This is an unfortunate result of the kernel building those "scripts" for
>>>> the host, which we can't deploy to the target. We intentionally remove
>>>> them. To build on the target, you must first build the "scripts":
>>>>
>>>> $ cd /usr/src/kernel
>>>> $ make scripts
>>>>
>>>> Then try to build your modules.
>>>
>>> If I had to build the same module using recipe via bitbake, I get the same
>>> error.
>>
>> You shouldn't. If you do, it's a bug either in the module building
>> mechanism of oe-core or with your module recipe.
>>
>>> Unfortunately I cannot inherit module in my recipe.
>>
>> You really need to.
> 
> Moving the discussion to [open embedded core list]
> 
> Either I do inherit module or I don't, I need to have the kernel source directory to
> point  to  ${STAGING_KERNEL_DIR} in my recipe, since the Makefile has /lib/modules/$(shell uname -r)/build 
> for the kernel source, which If I don't override, it will build kernel module for the local host.

I would suggest updating the Makefile (possibly with a patch in the
SRC_URI of the recipe) to use KERNEL_SRC instead of a hard-coded path.
The module.bbclass with make that variable available at build time (see
module_do_compile() in module.bbclass).

> 
> Also the Makefile does not have rule for module install, can we have the install rule inside a recipe to make the module 
> in to the final image?

Your Makefile should have a modules_install target. If it does not, see
the meta-skeleton/hello-mod/files/Makefile for an example of how to add one.

> Something like 
> FILES_${PN}+=  ${base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers"
> install -m 640 ${B}/kmod/igb_uio.ko     ${MODULE_DIR} (This being defined in a recipe)

You would be better off updating your Makefile to use standard Linux
kernel installation mechanisms.

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-17 23:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <D956029D25CF204F948EA0FB515E1EE20AD5D9F3@ORSMSX105.amr.corp.intel.com>
     [not found] ` <502D8980.7030107@linux.intel.com>
     [not found]   ` <D956029D25CF204F948EA0FB515E1EE20AD5EE74@ORSMSX105.amr.corp.intel.com>
     [not found]     ` <502EAC8E.1090707@linux.intel.com>
2012-08-17 23:07       ` Build Kernel module on target Bodke, Kishore K
2012-08-17 23:15         ` Darren Hart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox