Re: Fwd: KBUILD_MODNAME issue

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

 



Yeah currently First 2 steps are successful.

But once moved to third step it fails as it is not generating mod.c file.

I tried modpost with gdb and found that it is calling read_symbols
with file name as "/lib/modules/2.6.32.58/source/Module.symvers" which
in turn is calling read_elf which is failing.

Cant get much info other than that as optimizations enabled wont let
me know more than that.

Regards,
Ajith
--------------------------------------------
codingfreak.blogspot.com


On Fri, Feb 22, 2013 at 1:12 AM, Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
> On 02/21/2013 09:55 AM, Ajith Adapa wrote:
>>
>> Yeah I agree .. But seems our client is using a customized Make
>> script. So I disabled CONFIG_DYNAMIC_DEBUG option which is a kind of
>> temporary hack to my previous issue.
>>
>> But the Make script follows following steps
>>
>> 1. Create .o for all .c files
>>
>> 2. Create final module.o with all the above .o files
>>
>
> A correct, normal Makefile for external modules does the above
> 2 steps and then the kernel build handles the rest of it.
>
>
>
>> 3. Using modpost create Module.markers
>>
>> /lib/modules/2.6.32.58/source/scripts/mod/modpost  -i
>> /lib/modules/2.6.32.58/source/Module.symvers -S -K
>> /lib/modules/2.6.32.58/source/Module.markers -M  ../l2/Module.markers
>> ../l2/l2_module.o
>>
>> I guess this step creates modulename.mod.c file
>>
>> 4. Now create modulename.mod.o file
>>
>> 5. Finally link up everything creating .ko file.
>>
>> Above steps works great with 2.6.32 kernel but When I am trying on 3.7
>> kernel Step-3 doesn't return anything other than Error 1 at the end.
>>
>> Seems Modpost is one tough nut to crack as it has doesnt have any
>> options or debug logs to display its output status.
>> I thought I will create modpost with -g option enabled to run the GDB
>> over it to see why it fails.
>>
>> Is there any doc or wiki page where we can understand different steps
>> involved in the creation of a .ko file right from step 1 ?
>>
>> Regards,
>> Ajith
>> --------------------------------------------
>> codingfreak.blogspot.com
>>
>>
>> On Thu, Feb 21, 2013 at 10:22 PM, Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
>> wrote:
>>>
>>> On 02/21/13 04:15, Ajith Adapa wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am again hit with KBUILD issue which says as shown below
>>>>
>>>> /home/tmp/linux-26/include/net/inet_connection_sock.h: In function
>>>> ‘inet_csk_clear_xmit_timer’:
>>>> /home/tmp/linux-26/include/net/inet_connection_sock.h:203:3: error:
>>>> ‘KBUILD_MODNAME’ undeclared (first use in this function)
>>>> /home/tmp/linux-26/include/net/inet_connection_sock.h:203:3: note:
>>>> each undeclared identifier is reported only once for each function it
>>>> appears in
>>>> /home/tmp/linux-26/include/net/inet_connection_sock.h: In function
>>>> ‘inet_csk_reset_xmit_timer’:
>>>> /home/tmp/linux-26/include/net/inet_connection_sock.h:219:3: error:
>>>> ‘KBUILD_MODNAME’ undeclared (first use in this function)
>>>>
>>>> Ideally my understanding is When a module is build KBUILD_MODNAME is
>>>> automatically updated.
>>>>
>>>> But I even tried options like -D"KBUILD_MODNAME=KBUILD_STR(l2_module)"
>>>>
>>>> /usr/bin/gcc -M -g -O2 -DMODULE
>>>> -D"KBUILD_MODNAME=KBUILD_STR(l2_module)" -D__KERNEL__ -DLINUX
>>>> -fno-strict-aliasing -fno-common -ffreestanding -O2 -m32
>>>> -fomit-frame-pointer -g -pipe -msoft-float
>>>> -mpreferred-stack-boundary=2 -fno-unit-at-a-time -march=i686
>>>> -mtune=pentium4 -mregparm=3 -I/lib/modules/3.7.6.1.i686/source
>>>> /include -I/lib/modules/3.7.6.1.i686/source/arch/x86/include
>>>> -I/lib/modules/3.7.6.1.i686/source/include
>>>> -I/lib/modules/3.7.6.1.i686/source/include2
>>>> -I/lib/modules/3.7.6.1.i686/source/include/asm/mach-default
>>>> -I/lib/modules/3.7.6.1.i686/source/include2/asm/mach-default
>>>> -I/lib/modules/3.7.6.1.i686/source/include/uapi
>>>> -I/lib/modules/3.7.6.1.i686/source/include/linux/kconfig.h
>>>> -I/lib/modules/3.7.6.1.i686/source/include/generated/uapi
>>>> -I/lib/modules/3.7.6.1.i686/source/arch/x86/include/generated/uapi
>>>> -m32 tmp/l2.c
>>>>
>>>>
>>>> /lib/modules/3.7.6.1.i686/source/include/net/inet_connection_sock.h:203:3:
>>>> error: ‘l2_module’ undeclared (first use in this function)
>>>>
>>>> It says it is undeclared.
>>>>
>>>> Anybody have any clue what I messed up this time ? Thanks for the last
>>>> reply
>>>
>>>
>>>
>>> The official, expected way to build any (external) kernel module is to
>>> use a Makefile
>>> for the module and run 'make', e.g.:
>>>
>>> $ make -C /path/to/kernel/source M=/path/to/module/source
>>> [O=/path/to/kernel/build] modules
>>>
>>> That should work.  If not, let us know.
>>>
>>>
>>> --
>>> ~Randy
>
>
>
> --
> ~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux