[ELDK] building .ko objects

Detlev Zundel dzu at denx.de
Fri Apr 25 12:54:11 CEST 2008


Hi Price,

> Hi, I've been trying to build an external kernel object file
> unsuccessfully.  I have read 6.2 in the DULG and the
> Documentation/kbuild/modules.txt and makefiles.txt.

It would really have helped if you provided some more data points, like
the kernel that you use and the configuration file of yours.

> What I try to do is cd to the samples/kobject directory from the top of
> the kernel source tree.

Ok, this indicates that you use a >2.6.24 kernel (which one exactly is
still not known), so nothing from within our ELDK distribution, so the
question strictly does not belong on the ELDK mailinglist.

> I saved the original Makefile and edited it to look like below;

Attaching used files is much easier for anyone trying to reproduce the
problem...

> [root at ma-dhcp-125 kobject]# cat Makefile
>
> obj-m: += kobject-example.o kset-example.o

What exactly makes you think that this change of yours is correct?

> Then I typed the following line at the prompt and saw;
>
>  [root at ma-dhcp-125 kobject]# pwd
> /data/denxSrc/linux-2.6-denx/samples/kobject
>  [root at ma-dhcp-125 kobject]# make ARCH=powerpc CROSS_COMPILE=ppc_4xx- -C
> /data/denxSrc/linux-2.6-denx M=`pwd`
> make: Entering directory `/data/denxSrc/linux-2.6-denx'
>   Building modules, stage 2.
>   MODPOST 0 modules
> make: Leaving directory `/data/denxSrc/linux-2.6-denx'
> [root at ma-dhcp-125 kobject]# ls
> kobject-example.c  Makefile      modules.order
> kset-example.c     MakefileSave  Module.symvers
>
> It looks as though it never compiled the source files into object files
> then into ko files.  However I see two new files; modules.order and
> Module.symvers.  
>
> I want to be able to go to a directory and just builid a *.ko file that
> I can then tftp over to my evaluation board, load with insmod.
>
> The kernel config has enable loadable modules.
>
> What am I missing?

If I change something and it doesn't work, I'd check what I do.  So
let's see, you changed

obj-$(CONFIG_SAMPLE_KOBJECT) += kobject-example.o kset-example.o

to read

obj-m: += kobject-example.o kset-example.o

So you substituted "$(CONFIG_SAMPLE_KOBJECT)" with "m:" (note the
colon).  Why do you think that should work?  If you substitute only an
"m", everything works fine for me and I am sure for you also.

Best wishes
  Detlev

-- 
C hasn't changed much since the 1970s. And let's face it it's ugly.
Can't we do better? C++? (Sorry, never mind.)
                                    -- Rob Pike
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the eldk mailing list