Simple module, but won't build
Hi All,
I am trying to build a simple module which will let me write to a bank of LED's on my board.
When I #include <asm/io.h> I get this error:
/opt/eldk3.0/ppc_82xx/usr/include/asm/io.h: In function `virt_to_bus':/opt/eldk3.0/ppc_82xx/usr/include/asm/io.h:235: `CONFIG_KERNEL_START' undeclared (first use in this function)
the error also occurs in several other functions. I also see errors when I #include <asm/uaccess.h> as follows:
/opt/eldk3.0/ppc_82xx/usr/include/asm/uaccess.h: In function `verify_area':/opt/eldk3.0/ppc_82xx/usr/include/asm/uaccess.h:37: `CONFIG_TASK_SIZE' undeclared (first use in this function)
also in several functions.
I know I have used these with no problems with an older kernel and compiler. Is there something I need to add to make these work??
I am using ELDK 3.0 with the 2.4.24-pre2 kernel on an 8260 target.
Many thanks,
Rich
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 6 lines · In message <[email protected]> you wrote:
When I #include <
asm/io.h> I get this error:
/opt/eldk3.0/ppc_82xx/usr/include/asm/io.h: In function `virt_to_bus':/opt/eldk3.0/ppc_82xx/usr/include/asm/io.h:235: `CONFIG_KERNEL_START' undeclared (first use in this function)
...
Quoted 3 lines
/opt/eldk3.0/ppc_82xx/usr/include/asm/uaccess.h: In function `verify_area':/opt/eldk3.0/ppc_82xx/usr/include/asm/uaccess.h:37: `CONFIG_TASK_SIZE' undeclared (first use in this function)
...
Quoted 2 lines
I know I have used these with no problems with an older kernel and compiler. Is there something I need to add to make these work??
Seems you are missing to include some necessary header files and/or to provide the necessary compiler options.
It's difficult to guess what exactly is missing given so little information.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] "If you own a machine, you are in turn owned by it, and spend your
time serving it..." - Marion Zimmer Bradley, _The Forbidden Tower_
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Hi Wolfgang,
Quoted 3 lines · Wolfgang Denk
Seems you are missing to include some necessary header files and/or to provide the necessary compiler options.
I am taking a driver I wrote for a 2.4.2 kernel, built with 2.95.x compiler and trying to port it to 82xx from 8xx and use the new ELDK.
Since it is so simple, it just writes to a mem mapped I/O port to set some LED's on/off, I assumed it would be pretty simple. But alas, that was probably a bad assumption on my part.
The main module includes the following:
linux/module.h
linux/fs.h
asm/io.h
asm/uaccess.h
in that order.
I have grep'ed for CONFIG_KERNEL_START and CONFIG_TASK_SIZE and the only place I can find them defined is in the kernel source .config (and default config files for each board). Not in any of the header files.
Maybe I am sposed to #define them myself - I tried that and it worked - but would like a more automagic solution if there is one!
Command line options are:
-D__KERNEL__ -DMODULE -Wall -fno-builtins -O -c
Quoted 3 lines
It's difficult to guess what exactly is missing given so little information.
Sorry, yes.
Rich
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 7 lines · In message <[email protected]> you wrote:
Hi Wolfgang,
Quoted 3 lines · Wolfgang Denk
Seems you are missing to include some necessary header files and/or to provide the necessary compiler options.
Quoted 9 lines
I am taking a driver I wrote for a 2.4.2 kernel, built with 2.95.x compiler and trying to port it to 82xx from 8xx and use the new ELDK.
Since it is so simple, it just writes to a mem mapped I/O port to set some LED's on/off, I assumed it would be pretty simple. But alas, that was probably a bad assumption on my part.
The main module includes the following:
Insert:
#include <linux/kernel.h> #include <linux/init.h>
Quoted 2 lines
linux/module.h
linux/fs.h
Probably needed:
#include <asm/types.h>
Quoted 8 lines
asm/io.h
asm/uaccess.hin that order.
I have grep'ed for
CONFIG_KERNEL_STARTandCONFIG_TASK_SIZEand the only place I can find them defined is in the kernel source .config (and default config files for each board). Not in any of the header files.
Grep after configuring the kernel, and you should find them in
include/linux/autoconf.h:#define CONFIG_KERNEL_START 0xc0000000 include/config/kernel/start.h:#define CONFIG_KERNEL_START 0xc0000000 resp. include/linux/autoconf.h:#define CONFIG_TASK_SIZE 0x80000000 include/config/task/size.h:#define CONFIG_TASK_SIZE 0x80000000
Quoted 2 lines
Maybe I am sposed to #define them myself - I tried that and it worked - but would like a more automagic solution if there is one!
There is no magic involved ;-)
Quoted 3 lines
Command line options are:
-D__KERNEL__ -DMODULE -Wall -fno-builtins -O -c
This is not good either. You may try running a "make modules" in you kernel source directory and see what CFLAGS are needed; for me this looks for example like this:
CFLAGS="-D__KERNEL__ -I/work/TQM860L/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -I/work/TQM860L/arch/ppc -fsigned-char -msoft-float -pipe -ffixed-r2 -Wno-uninitialized -mmultiple -mstring -DMODULE"
Some of the options (like -msoft-float) are not optional at all ;-)
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] If A equals success, then the formula is A = X + Y + Z. X is work. Y
is play. Z is keep your mouth shut. - Albert Einstein
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 6 lines · Richard Danter
Command line options are:
-D__KERNEL__ -DMODULE -Wall -fno-builtins -O -c
A better approach is to create a small Makefile:
obj-m := rich.o
obj-y :=
Then use:
make -C $KERNELSRCDIR SUBDIRS=$PWD modules
This should give you the correct gcc options.
[Speaking of vanilla kernel, not knowing ELDK in this respect].
Sam
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 6 lines · In message <[email protected]> you wrote:
make -C $KERNELSRCDIR SUBDIRS=$PWD modules
This should give you the correct gcc options.
[Speaking of vanilla kernel, not knowing ELDK in this respect].
Same for ELDK. We use a standard Linux kernel, too [just some bug fixes and extensions included].
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected]
"It's when they say 2 + 2 = 5 that I begin to argue." - Eric Pepke
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Next steps
We've finally gotten the 2.5 kernel to boot using u-boot [ 2.6.3 doesn't, nor did 2.4 variants ] on a PPC440GP
on the Ebony board.
At this point, it is trying to talk to a dhcp/bootp server and get a NFS root filesystem.
Eventually, we'll be porting this to a custom board with some other chip set support on it.
Our application will essentially be data acquisition and transmission. We'll be talking to the chipset to
suck data off [ and push data ] and on the other side push/pull data from the PCI bus.
Linux is probably overkill for this, but we wanted a development platform we could extend in the future
more readily.
I'm curious as to the direction people think we should take at this point. Should we be trying to set up
a root NFS filesystem [ presumably because it is easier to change -- and then moving it to an initrd ? ]?
What do we need on the NFS filesystem...
What resources can you point me to to help us make the transition to the next level.
Any help is appreciated,
Thanks.
-- Brian
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Re: Next steps
Quoted 8 lines
I'm curious as to the direction people think we should take at this point. Should we be trying to set up
a root NFS filesystem [ presumably because it is easier to change -- and then moving it to an initrd ? ]?What do we need on the NFS filesystem...
Are you using the ELDK? Have you seen:
http://www.denx.de/twiki/bin/view/DULG/ELDKMountingTargetComponentsViaNF
S
Bob
--
Robert B. White Perigee, A Division of Sensis Corp Software Design Engr 316 Commerce Blvd. TEL: 315.453.7842x29 Liverpool, NY 13088 FAX: 315.453.7917 www.Perigee.com
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 4 lines
/opt/eldk3.0/ppc_82xx/usr/include/asm/io.h:235: `CONFIG_KERNEL_START'
/opt/eldk3.0/ppc_82xx/usr/include/asm/uaccess.h:37: `CONFIG_TASK_SIZE'
These are defined when you are building your kernel. Before building any modules,
you need to configure the kernel.
Assuming you use 'make menuconfig'.
Under 'Code Maturity Level Options' select 'Prompt for advanced kernel
configuration options'.
Then, under General Setup set
Set Custom Kernel Base Address
Set Custom user task size
My assumption is that the defaults (0xc0000000 and 0x80000000) are just dandy.
Joshua
p.s. This type of question is easy to answer by using lxr.linux.no and searching for freetext or identifier. No kernel programming should be performed without this close at hand.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/