* Simple module, but won't build
@ 2004-05-04 18:03 Richard Danter
2004-05-04 19:10 ` Wolfgang Denk
2004-05-04 19:38 ` Joshua Lamorie
0 siblings, 2 replies; 10+ messages in thread
From: Richard Danter @ 2004-05-04 18:03 UTC (permalink / raw)
To: linuxppc-embedded
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/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Simple module, but won't build
2004-05-04 18:03 Richard Danter
@ 2004-05-04 19:10 ` Wolfgang Denk
2004-05-04 19:46 ` Richard Danter
2004-05-04 19:38 ` Joshua Lamorie
1 sibling, 1 reply; 10+ messages in thread
From: Wolfgang Denk @ 2004-05-04 19:10 UTC (permalink / raw)
To: Richard Danter; +Cc: linuxppc-embedded
In message <4097DAEA.5@ntlworld.com> 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)
...
> /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)
...
> 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: wd@denx.de
"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/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Simple module, but won't build
2004-05-04 18:03 Richard Danter
2004-05-04 19:10 ` Wolfgang Denk
@ 2004-05-04 19:38 ` Joshua Lamorie
1 sibling, 0 replies; 10+ messages in thread
From: Joshua Lamorie @ 2004-05-04 19:38 UTC (permalink / raw)
To: Richard Danter, linuxppc-embedded
> /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/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Simple module, but won't build
2004-05-04 19:10 ` Wolfgang Denk
@ 2004-05-04 19:46 ` Richard Danter
2004-05-04 20:19 ` Wolfgang Denk
2004-05-04 21:15 ` Sam Ravnborg
0 siblings, 2 replies; 10+ messages in thread
From: Richard Danter @ 2004-05-04 19:46 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linuxppc-embedded
Hi Wolfgang,
Wolfgang Denk wrote:
>
> 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
>
> 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/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Simple module, but won't build
2004-05-04 19:46 ` Richard Danter
@ 2004-05-04 20:19 ` Wolfgang Denk
2004-05-04 21:15 ` Sam Ravnborg
1 sibling, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2004-05-04 20:19 UTC (permalink / raw)
To: Richard Danter; +Cc: linuxppc-embedded
In message <4097F32F.6090504@ntlworld.com> you wrote:
> Hi Wolfgang,
>
> Wolfgang Denk wrote:
> >
> > 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:
>
Insert:
#include <linux/kernel.h>
#include <linux/init.h>
> linux/module.h
> linux/fs.h
Probably needed:
#include <asm/types.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.
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
> 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 ;-)
> 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: wd@denx.de
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/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Simple module, but won't build
2004-05-04 19:46 ` Richard Danter
2004-05-04 20:19 ` Wolfgang Denk
@ 2004-05-04 21:15 ` Sam Ravnborg
2004-05-04 21:46 ` Wolfgang Denk
1 sibling, 1 reply; 10+ messages in thread
From: Sam Ravnborg @ 2004-05-04 21:15 UTC (permalink / raw)
To: Richard Danter; +Cc: Wolfgang Denk, linuxppc-embedded
On Tue, May 04, 2004 at 08:46:55PM +0100, Richard Danter wrote:
>
> 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/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Simple module, but won't build
2004-05-04 21:15 ` Sam Ravnborg
@ 2004-05-04 21:46 ` Wolfgang Denk
0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2004-05-04 21:46 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: Richard Danter, linuxppc-embedded
In message <20040504211508.GA2510@mars.ravnborg.org> 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: wd@denx.de
"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/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Simple module, but won't build
@ 2006-08-31 22:55 Steven Kaiser
2006-09-01 6:35 ` Josu Onandia
0 siblings, 1 reply; 10+ messages in thread
From: Steven Kaiser @ 2006-08-31 22:55 UTC (permalink / raw)
To: linuxppc-embedded
Hi gurus:
Newbie here. I am using ELDK 3.1.1, 2.4.25 kernel, and a Lite5200b board.
I run the kernel in RAM, and mount a filesystem via NFS. So far so good,
and I move on to trying to build a simple module to write to a few LEDs.
Simple hello world modules compile and insmod/rmmod fine, but when I try to
#include <asm/io.h>, here I have the exact same problem as Richard Danter
did: CONFIG_KERNEL_START and CONFIG_TASK_SIZE are not defined anywhere in
any headers-- just in the config files.
http://ozlabs.org/pipermail/linuxppc-embedded/2004-May/014037.html
My little wrinkle to add to this problem is I have recompiled the kernel, as
advised in the replies to Richard's post, with the 'Set Custom Kernel Base
Address' and 'Set Custom user task size' options enabled, but in my case I
still I cannot find CONFIG_KERNEL_START and CONFIG_TASK_SIZE defined
anywhere noteworthy.
My 'include/linux/autoconf.h' file is empty, and I don't even have an
'include/config/' directory at all. Where in the steps of recompiling the
kernel should these files and directories get generated?
My process for building the kernel is:
$ cd /opt/eldk/usr/src/linuxppc_2_4_devel
$ make mrproper
$ make lite5200b_config
$ make menuconfig
$ make dep
$ make uImage
$ cp arch/ppc/boot/images/uImage /tftpboot/MPC5200/uImage
I can manually include CONFIG_KERNEL_START and CONFIG_TASK_SIZE in my module
source, compile, insmod, and all goes well (except my LEDs don't light up
but first things first).
When my kernel boots, I get a few gripes which I think are related to this
issue:
Finding module dependencies: depmod: Can't open
/lib/modules/2.4.25/modules.deg [FAILED]
modprobe: Can't open dependencies file /lib/modules/2.4.25/modules.dep (No
such)
Young and foolish, I figured maybe I should try:
$ make modules
$ make modules_install
Oops. That was bad. Now I cannot even compile the simplest hello.c module
without a page of errors, the first being a complaint of not being able to
find linux/autoconf.h. Before I only had trouble when I tried to #include
<asm/io.h>, now it happens 100% of the time.
So I went back and turned off module support, recompiled the kernel, and
still cannot compile hello.c. I also tried recompiling the kernel after
doing a "make oldconfig", and still cannot compile a simple module anymore.
I think I am going to have to go back to square 1 and reinstall ELDK and
everything from scratch. But before I do:
Any insight into the generation of autoconf.h, and whereabouts this file
should come from? I will watch for it when I redo the whole process.
Steven Kaiser
Chemistry Electronics Facility
University of California, Irvine
2347 Natural Sciences 2
Irvine, CA 92697-2025
(949)824-7520
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Simple module, but won't build
2006-08-31 22:55 Steven Kaiser
@ 2006-09-01 6:35 ` Josu Onandia
0 siblings, 0 replies; 10+ messages in thread
From: Josu Onandia @ 2006-09-01 6:35 UTC (permalink / raw)
To: Steven Kaiser; +Cc: linuxppc-embedded
Steven Kaiser wrote:
>Hi gurus:
>
>Newbie here. I am using ELDK 3.1.1, 2.4.25 kernel, and a Lite5200b board.
>I run the kernel in RAM, and mount a filesystem via NFS. So far so good,
>and I move on to trying to build a simple module to write to a few LEDs.
>
>Simple hello world modules compile and insmod/rmmod fine, but when I try to
>#include <asm/io.h>, here I have the exact same problem as Richard Danter
>did: CONFIG_KERNEL_START and CONFIG_TASK_SIZE are not defined anywhere in
>any headers-- just in the config files.
>
>http://ozlabs.org/pipermail/linuxppc-embedded/2004-May/014037.html
>
>My little wrinkle to add to this problem is I have recompiled the kernel, as
>advised in the replies to Richard's post, with the 'Set Custom Kernel Base
>Address' and 'Set Custom user task size' options enabled, but in my case I
>still I cannot find CONFIG_KERNEL_START and CONFIG_TASK_SIZE defined
>anywhere noteworthy.
>
>My 'include/linux/autoconf.h' file is empty, and I don't even have an
>'include/config/' directory at all. Where in the steps of recompiling the
>kernel should these files and directories get generated?
>
>My process for building the kernel is:
>
>$ cd /opt/eldk/usr/src/linuxppc_2_4_devel
>$ make mrproper
>$ make lite5200b_config
>$ make menuconfig
>$ make dep
>$ make uImage
>$ cp arch/ppc/boot/images/uImage /tftpboot/MPC5200/uImage
>
>I can manually include CONFIG_KERNEL_START and CONFIG_TASK_SIZE in my module
>source, compile, insmod, and all goes well (except my LEDs don't light up
>but first things first).
>
>When my kernel boots, I get a few gripes which I think are related to this
>issue:
>
>Finding module dependencies: depmod: Can't open
>/lib/modules/2.4.25/modules.deg [FAILED]
>modprobe: Can't open dependencies file /lib/modules/2.4.25/modules.dep (No
>such)
>
>Young and foolish, I figured maybe I should try:
>
>$ make modules
>$ make modules_install
>
>Oops. That was bad. Now I cannot even compile the simplest hello.c module
>without a page of errors, the first being a complaint of not being able to
>find linux/autoconf.h. Before I only had trouble when I tried to #include
><asm/io.h>, now it happens 100% of the time.
>
>So I went back and turned off module support, recompiled the kernel, and
>still cannot compile hello.c. I also tried recompiling the kernel after
>doing a "make oldconfig", and still cannot compile a simple module anymore.
>I think I am going to have to go back to square 1 and reinstall ELDK and
>everything from scratch. But before I do:
>
>Any insight into the generation of autoconf.h, and whereabouts this file
>should come from? I will watch for it when I redo the whole process.
>
>Steven Kaiser
>Chemistry Electronics Facility
>University of California, Irvine
>2347 Natural Sciences 2
>Irvine, CA 92697-2025
>(949)824-7520
>
>
>_______________________________________________
>Linuxppc-embedded mailing list
>Linuxppc-embedded@ozlabs.org
>https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
>
I can help you with the leds part of your problem. Below is some simple
code to manage the leds in a Lite5200b.
About the rest of the problem, I can't tell, because my linux/autoconf.h
is OK, and I can include asm/io.h in my modules without problem. To
reinstall everything from scratch is a good idea.
I'm writing modules for a Lite5200b right now, using RTAI. I use the
leds to do some 'visual debugging'. You can contact me directly if you want.
#include <asm/mpc5xxx.h>
struct mpc5xxx_wu_gpio {
volatile u32 enable;
volatile u32 ode;
volatile u32 dir;
volatile u32 data; };
static void configure_leds(void)
{
struct mpc5xxx_gpio *gpio;
struct mpc5xxx_wu_gpio *wu_gpio;
gpio = (struct mpc5xxx_gpio*) MPC5xxx_GPIO;
wu_gpio = (struct mpc5xxx_wu_gpio*)MPC5xxx_WU_GPIO;
gpio->port_config &= ~(0x00f00000);
gpio->simple_gpioe |= 0x30000000;
gpio->simple_ddr |= 0x30000000;
gpio->simple_dvo |= 0x30000000;
wu_gpio->enable |= 0x30000000;
wu_gpio->ode &= ~0x30000000;
wu_gpio->dir |= 0x30000000;
}
static void led_off(int led)
{
struct mpc5xxx_gpio *gpio;
struct mpc5xxx_wu_gpio *wu_gpio;
gpio = (struct mpc5xxx_gpio*) MPC5xxx_GPIO;
wu_gpio = (struct mpc5xxx_wu_gpio*)MPC5xxx_WU_GPIO;
switch( led)
{
case 1:
wu_gpio->data |= 0x20000000;
break;
case 2:
gpio->simple_dvo |= 0x10000000;
break;
case 3:
wu_gpio->data |= 0x10000000;
break;
case 4:
gpio->simple_dvo |= 0x20000000;
break;
default:
break;
}
}
static void led_on(int led)
{
struct mpc5xxx_gpio *gpio;
struct mpc5xxx_wu_gpio *wu_gpio;
gpio = (struct mpc5xxx_gpio*) MPC5xxx_GPIO;
wu_gpio = (struct mpc5xxx_wu_gpio*)MPC5xxx_WU_GPIO;
switch(led)
{
case 1:
wu_gpio->data &= ~0x20000000;
break;
case 2:
gpio->simple_dvo &= ~0x10000000;
break;
case 3:
wu_gpio->data &= ~0x10000000;
break;
case 4:
gpio->simple_dvo &= ~0x20000000;
break;
default:
break;
}
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Simple module, but won't build
@ 2006-09-06 19:29 Steven Kaiser
0 siblings, 0 replies; 10+ messages in thread
From: Steven Kaiser @ 2006-09-06 19:29 UTC (permalink / raw)
To: linuxppc-embedded
Thanks Josu for the LED source code. It works!
Turns out my basic problem with autoconf.h was my confusion with all the
kernel trees I have around. I was downloading and compiling new kernels
into:
/opt/eldk/
but my NFS filesystem was targeted at:
/opt/eldk/ppc_82xx/
autoconf.h is generated during the $make menuconfig step (I'm pretty sure),
and so was placed in:
/opt/eldk/usr/src/linuxppc_2_4_devel/include/linux
but my running kernel was looking for it in:
/opt/eldk/ppc_82xx/usr/src/linuxppc_2_4_devel/include/linux
So I downloaded new kernel sources into /opt/eldk/ppc_82xx/, recompiled,
fixed some symbolic links, and did a little makefile magic to ensure the
right stuff is included when I compile modules, and all now seems well.
Steven Kaiser
Chemistry Electronics Facility
University of California, Irvine
2347 Natural Sciences 2
Irvine, CA 92697-2025
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-09-06 19:29 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-06 19:29 Simple module, but won't build Steven Kaiser
-- strict thread matches above, loose matches on Subject: below --
2006-08-31 22:55 Steven Kaiser
2006-09-01 6:35 ` Josu Onandia
2004-05-04 18:03 Richard Danter
2004-05-04 19:10 ` Wolfgang Denk
2004-05-04 19:46 ` Richard Danter
2004-05-04 20:19 ` Wolfgang Denk
2004-05-04 21:15 ` Sam Ravnborg
2004-05-04 21:46 ` Wolfgang Denk
2004-05-04 19:38 ` Joshua Lamorie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).