Problem in compiling a kernel module

13 messages, 8 authors, 2007-08-08 · open the first message on its own page

Problem in compiling a kernel module

From: Matthias Fechner <hidden>
Date: 2007-03-12 17:00:45

Hi,

I'm not sure if this is the right list, so please correct me.

If have written a kernel module to read a I2C chip (it's very basic
now and I try to understand some thinks first so please forgive some
stupid questions).

I copied it to drivers/i2c/chips and added it into the Makefile with
the following line:
obj-m += max6633.o

If I try now to compile to kernel I got the following error message:
WARNING: drivers/i2c/chips/max6633.o - Section mismatch: reference to
.init.data: from .text after 'cleanup_module' (at offset 0x196)
WARNING: drivers/i2c/chips/max6633.o - Section mismatch: reference to
.init.data: from .text after 'cleanup_module' (at offset 0x1a6)
WARNING: drivers/i2c/chips/max6633.o - Section mismatch: reference to
.init.data: from .text after 'cleanup_module' (at offset 0x1da)
WARNING: drivers/i2c/chips/max6633.o - Section mismatch: reference to
.init.data: from .text after 'cleanup_module' (at offset 0x1e2)

What does that mean or how can debug or solve the problem?

Best regards,
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

Re: Problem in compiling a kernel module

From: Grant Likely <hidden>
Date: 2007-03-12 18:36:46

On 3/12/07, Matthias Fechner [off-list ref] wrote:
If I try now to compile to kernel I got the following error message:
WARNING: drivers/i2c/chips/max6633.o - Section mismatch: reference to
.init.data: from .text after 'cleanup_module' (at offset 0x196)
WARNING: drivers/i2c/chips/max6633.o - Section mismatch: reference to
.init.data: from .text after 'cleanup_module' (at offset 0x1a6)
WARNING: drivers/i2c/chips/max6633.o - Section mismatch: reference to
.init.data: from .text after 'cleanup_module' (at offset 0x1da)
WARNING: drivers/i2c/chips/max6633.o - Section mismatch: reference to
.init.data: from .text after 'cleanup_module' (at offset 0x1e2)

What does that mean or how can debug or solve the problem?
Looks like you're trying to access inital data (which is freed after
module load) from regular code (which is not)

g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

Re: Problem in compiling a kernel module

From: Matthias Fechner <hidden>
Date: 2007-03-13 04:31:02

Hello Grant,

* Grant Likely [off-list ref] [12-03-07 12:36]:
Looks like you're trying to access inital data (which is freed after
module load) from regular code (which is not)
is it possible to find the line of code with the address is these
warnings?

Best regards,
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

Re: Problem in compiling a kernel module

From: Grant Likely <hidden>
Date: 2007-03-13 04:55:44

On 3/12/07, Matthias Fechner [off-list ref] wrote:
Hello Grant,

* Grant Likely [off-list ref] [12-03-07 12:36]:
quoted
Looks like you're trying to access inital data (which is freed after
module load) from regular code (which is not)
is it possible to find the line of code with the address is these
warnings?
somewhere in the 'cleanup_module' function.  I don't know how to
resolve function+offset to line number in .o files, but it can
probably be done with readelf.

g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

Re: Problem in compiling a kernel module

From: Ben Warren <hidden>
Date: 2007-03-13 12:55:30

Matthias,
--- Matthias Fechner <idefix@fechner.net> wrote:
Hello Grant,

* Grant Likely [off-list ref] [12-03-07
12:36]:
quoted
Looks like you're trying to access inital data
(which is freed after
quoted
module load) from regular code (which is not)
is it possible to find the line of code with the
address is these
warnings?
Is there any chance that you qualify private data as
__init within the driver?  Can you post the cleanup()
function and any private (static) functions that it
calls?

regards,
Ben

Re: Problem in compiling a kernel module

From: Matthias Fechner <hidden>
Date: 2007-03-14 04:33:19

Hello Ben,

* Ben Warren [off-list ref] [13-03-07 05:55]:
Is there any chance that you qualify private data as
__init within the driver?  Can you post the cleanup()
function and any private (static) functions that it
calls?
no problem, I attached the file. It is bery basic from now and it is
not written very well, but it should have all necessary parts in it.

PS: It's not necessary to CC me I'm on the list :)

Best regards,
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

Re: Problem in compiling a kernel module

From: Domen Puncer <hidden>
Date: 2007-03-14 06:54:16

On 14/03/07 05:33 +0100, Matthias Fechner wrote:
Hello Ben,

* Ben Warren [off-list ref] [13-03-07 05:55]:
quoted
Is there any chance that you qualify private data as
__init within the driver?  Can you post the cleanup()
function and any private (static) functions that it
calls?
no problem, I attached the file. It is bery basic from now and it is
not written very well, but it should have all necessary parts in it.

PS: It's not necessary to CC me I'm on the list :)
...
static int __initdata max6633_initialized = 0;
__initdata
void max6633_cleanup(void)
{
   int res;
   if(max6633_initialized==1)
But you access it from non-init code.


	Domen

Re: Problem in compiling a kernel module

From: Matthias Fechner <hidden>
Date: 2007-03-15 04:27:18

Hello Domen,

* Domen Puncer [off-list ref] [14-03-07 07:54]:
__initdata
quoted
void max6633_cleanup(void)
{
   int res;
   if(max6633_initialized==1)
But you access it from non-init code.
ah ok, I rechecked the docu in the kernel now again and found a small
line that mentioned that. I have easily written the code from the docu.
But now it will be linked fine.

Thx a lot, now a lot of thinks got clearer and I understood some steps.

Best regards,
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

Fedora 7 on a non FPU system

From: Michael Brian Willis <hidden>
Date: 2007-08-07 18:47:46

Hello, 

I'm trying to install a Fedora 7 Root File System on an MPC8540 based
embedded system with a Denx 2.6.21 kernel. I have read the Denx
Application note located at: 
http://www.denx.de/wiki/DULG/AN2007_03_InstallFC7OnSequoia. 

However this App. Note says that the instructions apply only to
processors that have a full Floating Point Unit (FPU). My processor does
not have an FPU and I believe that this is causing some system hangs. 

Has anybody every successfully installed Fedora(or another major distro)
on a non-FPU system? Or, does anybody know what is needed to get it
working properly on a non FPU system? 

Any help is greatly appreciated. 

Regards,

Michael Willis
Applied Research Labs-University of Texas
willis@arlut.utexas.edu

Re: Fedora 7 on a non FPU system

From: Roland Dreier <hidden>
Date: 2007-08-07 19:21:18

 > Has anybody every successfully installed Fedora(or another major distro)
 > on a non-FPU system? Or, does anybody know what is needed to get it
 > working properly on a non FPU system? 

The simplest thing to do is to use a kernel that has FPU emulation
enabled.  Pretty much every ppc binary will use the FPU for spare
registers if nothing else, so your only other alternative would be to
rebuild the whole distribution.

 - R.

Re: Fedora 7 on a non FPU system

From: Josh Boyer <hidden>
Date: 2007-08-07 19:29:09

On Tue, 07 Aug 2007 12:42:41 -0500
Michael Brian Willis [off-list ref] wrote:
Hello, 

I'm trying to install a Fedora 7 Root File System on an MPC8540 based
embedded system with a Denx 2.6.21 kernel. I have read the Denx
Application note located at: 
http://www.denx.de/wiki/DULG/AN2007_03_InstallFC7OnSequoia. 

However this App. Note says that the instructions apply only to
processors that have a full Floating Point Unit (FPU). My processor does
not have an FPU and I believe that this is causing some system hangs. 

Has anybody every successfully installed Fedora(or another major distro)
on a non-FPU system? Or, does anybody know what is needed to get it
working properly on a non FPU system? 
CONFIG_MATH_EMULATION in the kernel will emulate floating point
instructions. Try that.

josh

Re: Fedora 7 on a non FPU system

From: Clemens Koller <hidden>
Date: 2007-08-07 21:43:11

Hi, Michael!

Michael Brian Willis schrieb:
I'm trying to install a Fedora 7 Root File System on an MPC8540 based
embedded system with a Denx 2.6.21 kernel. I have read the Denx
Application note located at: 
http://www.denx.de/wiki/DULG/AN2007_03_InstallFC7OnSequoia. 

However this App. Note says that the instructions apply only to
processors that have a full Floating Point Unit (FPU). My processor does
not have an FPU and I believe that this is causing some system hangs. 
Yes, that won't work.
You can either use FPU emulation or do the floating point stuff on the e500
core's SPE (Signal Processing Engine) which is AFAIK not supported by any
major distribution.
Has anybody every successfully installed Fedora(or another major distro)
on a non-FPU system?
CRUX - not a "major distro", because it's targeted at "experienced Linux users".
I am running my selfmade version of "embedded CRUX" on my MPC8540 Boards
based on http://cruxppc.sunsite.dk/wp/index.php which now fully supports
the e500 core features.
Or, does anybody know what is needed to get it
working properly on a non FPU system?
... mentioned above.
I bootstrapped the toolchain (binutils, (e)glibc, gcc and friends)
from scratch. See:
http://www.anagramm-technology.com/05_Services/FoxFactSheet.pdf
Current versions: kernel 2.6.23-rc2, gcc-4.2.1, (e)glibc 2.5.1/2.6.1.

Regards,
-- 
Clemens Koller
_______________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany

http://www.anagramm-technology.com
Phone: +49-89-741518-50
Fax: +49-89-741518-19

Re: Fedora 7 on a non FPU system

From: Michael Brian Willis <hidden>
Date: 2007-08-08 22:18:31

On Tue, 2007-08-07 at 23:43 +0200, Clemens Koller wrote:
You can either use FPU emulation or do the floating point stuff on the e500
core's SPE (Signal Processing Engine) which is AFAIK not supported by any
major distribution.
I do have FPU emulation enabled in the kernel. I was able to get a
Yellow Dog 4.1 root filesystem to work. However when I move up to
YellowDog 5.0 or to Fedora 7, I have system lags. (For example, shortly
after boot-up, date and top do not behave properly. For example top
displays "nan" values. However a few minutes after boot up everything
seems fine.)

I suspect that the newest distribution versions rely more heavily on
full FPU functionality while the older distributions don't. Which might
be why older distributions seem to work a little better. 


CRUX - not a "major distro", because it's targeted at "experienced Linux users".
I am running my selfmade version of "embedded CRUX" on my MPC8540 Boards
based on http://cruxppc.sunsite.dk/wp/index.php which now fully supports
the e500 core features.
Thanks, I will start looking into using CRUX. 


I bootstrapped the toolchain (binutils, (e)glibc, gcc and friends) from scratch
Did you find any documentation that was helpful when you did this? 
I'm not really sure how to start this process. Do you basically just
download binutils, glibc etc... and compile them using the gcc that
comes with CRUX? 



Thanks again for all your help!

Regards, 

Michael Willis
Applied Research Labs-University of Texas
willis@arlut.utexas.edu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help