[ELDK] building .ko objects

Price, John @ SDS john.p.price at l-3com.com
Fri Apr 25 16:09:11 CEST 2008


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

Of course more kernel specific information would aid persons trying to
help.  My apologies.  

The kernel build I am working with is shown below:

Image Name:   Linux-2.6.25-rc6-01253-gca0a328-
Created:      Fri Apr 25 09:36:33 2008
Image Type:   PowerPC Linux Kernel Image (gzip compressed)
Data Size:    1555521 Bytes = 1519.06 kB = 1.48 MB
Load Address: 0x00000000
Entry Point:  0x00000000

>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.

The steps that led me to make a modification in the Makefile located in
the samples/kobject directory are because I selected M on the kobject
option in the menuconfig and expected to see kobjects compiled when I
built modules from the top of the tree.

The exact steps I took from the top of the kernel source tree were;

>make mrproper

>make ARCH=powerpc CROSS_COMPILE=ppc_4xx- kilauea_defconfig

>make ARCH=powerpc CROSS_COMPILE=ppc_4xx- menuconfig

>make ARCH=powerpc CROSS_COMPILE=ppc_4xx- uImage

While this step executed I saw the sample/kobject built as builtin, even
though I selected modules from the menuconfig.  Looking at the .config
file located at the top of the kernel source tree I saw this;

[root at ma-dhcp-125 linux-2.6-denx]# grep KOBJECT .config
# CONFIG_DEBUG_KOBJECT is not set
CONFIG_SAMPLE_KOBJECT=m

So then I cd'd to samples/kobject and typed the following line;

[root at ma-dhcp-125 kobject]# cat Makefile
obj-$(CONFIG_SAMPLE_KOBJECT) += kobject-example.o kset-example.o
[root at ma-dhcp-125 kobject]# make -C /data/denxSrc/linux-2.6-denx M=`pwd`
modules
make: Entering directory `/data/denxSrc/linux-2.6-denx'
  CC [M]  /data/denxSrc/linux-2.6-denx/samples/kobject/kobject-example.o
cc1: error: unrecognized command line option "-mno-red-zone"
cc1: error: unrecognized command line option "-mcmodel=kernel"
cc1: error: unrecognized command line option
"-maccumulate-outgoing-args"
make[1]: ***
[/data/denxSrc/linux-2.6-denx/samples/kobject/kobject-example.o] Error 1
make: *** [_module_/data/denxSrc/linux-2.6-denx/samples/kobject] Error 2
make: Leaving directory `/data/denxSrc/linux-2.6-denx'

After seeing this I modified the Makefile as follows and tried to build
the two modules;

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

[root at ma-dhcp-125 kobject]# make -C /data/denxSrc/linux-2.6-denx M=`pwd`
modules
make: Entering directory `/data/denxSrc/linux-2.6-denx'
  CC [M]  /data/denxSrc/linux-2.6-denx/samples/kobject/kobject-example.o
cc1: error: unrecognized command line option "-mno-red-zone"
cc1: error: unrecognized command line option "-mcmodel=kernel"
cc1: error: unrecognized command line option
"-maccumulate-outgoing-args"
make[1]: ***
[/data/denxSrc/linux-2.6-denx/samples/kobject/kobject-example.o] Error 1
make: *** [_module_/data/denxSrc/linux-2.6-denx/samples/kobject] Error 2
make: Leaving directory `/data/denxSrc/linux-2.6-denx'

Sorry about "m:", a typo on my part after a very frustrating afternoon
trying to get kobject modules to build.

Also from the top of the kernel source tree building modules prior to
any makefile modifications;

>make ARCH=powerpc CROSS_COMPILE=ppc_4xx- modules

This line builds scsi_wait_scan.ko object just fine, but again not the
samples/kobject.

So a makefile with the  "obj-m += module.o" and the command "make -C
/top/of/kernel/src M=`pwd` modules" should allow me to build external
modules with your linux distribution?

Should I try another version?

Thank you for your time and patience.



More information about the eldk mailing list