Openembedded Devel Discussions
 help / color / mirror / Atom feed
* Problems building a kernelmodule for OE
@ 2008-10-27  8:13 Henk Geraads
  2008-10-27 15:56 ` Stanislav Brabec
  0 siblings, 1 reply; 6+ messages in thread
From: Henk Geraads @ 2008-10-27  8:13 UTC (permalink / raw)
  To: openembedded-devel

Hi,

I am not sure if i posted it in the correct mailing list!
But I am trying to make a kernel module for the OE distro angstrom 2007-12 for machine CM-X270.

when I try to make the module, following error message is produced!

	In file included from include/linux/jiffies.h:4,
     	      	     from include/linux/sched.h:54,
      	           from include/asm/uaccess.h:14,
                 	     from /home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:10:
	include/linux/calc64.h: In function 'do_div_llr':
	include/linux/calc64.h:25: error: '__LINUX_ARM_ARCH__' undeclared (first use in this function)
	include/linux/calc64.h:25: error: (Each undeclared identifier is reported only once
	include/linux/calc64.h:25: error: for each function it appears in.)
	/home/henk/cm270/fifodrv../cfi-ktst/cfi-mod.c: In function 'cfi_ioctl':
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: implicit declaration of function 'GPLR'
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: implicit declaration of function 'GPIO_bit'
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c: In function 'cfi_init':
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:204: error: 'GPIO_IN' undeclared (first use in this function)
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:208: error: 'MSC1' undeclared (first use in this function)
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:209: error: 'GPIO79_nCS_3_MD' undeclared (first use in this function)
	make[2]: *** [/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.o] Error 1
	make[1]: *** [_module_/home/henk/cm270/fifodrv/cfi-ktst] Error 2
	make: *** [default] Error 2

My source for the module cfi-kernel is located in the
path: /home/henk/cm270/fifodrv

I create with "bitbake linux -c defshell -f" an enviroment with the
"correct" path's and env.var's.

Makefile:
	# Makefile for external CFI kernel module
	CFLAGS = -march=armv5t -Wall -D_GNU_SOURCE 

	ifneq ($(KERNELRELEASE),)
	# we are inside the kernel tree and called from kernel build system

	obj-m   := cfi-mod.o
	else
	# we are a separate module and start the kernel make and give it our directory
	KERNELDIR = /home/henk/oe/build/tmp/angstrom/work/cm-x270-angstrom-linux-gnueabi/linux-2.6.23-r8/linux-2.6.23

	#KERNELDIR = ../linux-26
	PWD       := $(shell pwd)

	default:
		$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
	endif

	clean::
		$(RM) -rf *.o .depend .*.cmd *.ko *.mod.c .tmp_versions *~

	.PHONY: clean

	depend .depend dep:
		$(CC) $(CFLAGS) -M *.c > .depend

	ifeq (.depend,$(wildcard .depend))
	include .depend
	endif


start op the module sourcecode:

	#include <linux/module.h>
	#include <linux/kernel.h>
	#include <linux/ioport.h>
	#include <linux/fs.h>
	#include <asm/uaccess.h>
	#include <asm/io.h>

	MODULE_AUTHOR("Henk");  
	......


What is my mistake??

Thanks in advance for any reaction!

Henk





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems building a kernelmodule for OE
  2008-10-27  8:13 Problems building a kernelmodule for OE Henk Geraads
@ 2008-10-27 15:56 ` Stanislav Brabec
  2008-10-28  9:15   ` Henk Geraads
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislav Brabec @ 2008-10-27 15:56 UTC (permalink / raw)
  To: openembedded-devel

Henk Geraads wrote:

> when I try to make the module, following error message is produced!

It seems, that source code is a bit outdated (intended for older kernel
that you have) or you are compiling it in a bad way.

> 	include/linux/calc64.h:25: error: '__LINUX_ARM_ARCH__' undeclared (first use in this function)

Strange. It should be defined.

> 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: implicit declaration of function 'GPLR'
> 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: implicit declaration of function 'GPIO_bit'
> 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c: In function 'cfi_init':
> 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:204: error: 'GPIO_IN' undeclared (first use in this function)
> 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:208: error: 'MSC1' undeclared (first use in this function)
> 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:209: error: 'GPIO79_nCS_3_MD' undeclared (first use in this function)

It indicates that you need to include asm/arch/pxa2xx-regs.h and
asm/arch/pxa2xx-gpio.h.

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                                    http://www.suse.cz/




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems building a kernelmodule for OE
  2008-10-27 15:56 ` Stanislav Brabec
@ 2008-10-28  9:15   ` Henk Geraads
  2008-10-28 11:51     ` Henk Geraads
  0 siblings, 1 reply; 6+ messages in thread
From: Henk Geraads @ 2008-10-28  9:15 UTC (permalink / raw)
  To: openembedded-devel

Hi Stanislav

questions,

> -----Oorspronkelijk bericht-----
> Van: openembedded-devel-bounces@lists.openembedded.org 
> [mailto:openembedded-devel-bounces@lists.openembedded.org]Namens 
> Stanislav Brabec
> Verzonden: maandag 27 oktober 2008 16:56
> Aan: openembedded-devel@lists.openembedded.org
> Onderwerp: Re: [oe] Problems building a kernelmodule for OE
> 
> 
> Henk Geraads wrote:
> 
> > when I try to make the module, following error message is produced!
> 
> It seems, that source code is a bit outdated (intended for older kernel
> that you have) or you are compiling it in a bad way.
> 
> > 	include/linux/calc64.h:25: error: '__LINUX_ARM_ARCH__' 
> undeclared (first use in this function)
> 
> Strange. It should be defined.

Where should it be defined?

> 
> > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: 
> implicit declaration of function 'GPLR'
> > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: 
> implicit declaration of function 'GPIO_bit'
> > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c: In function 'cfi_init':
> > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:204: error: 
> 'GPIO_IN' undeclared (first use in this function)
> > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:208: error: 
> 'MSC1' undeclared (first use in this function)
> > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:209: error: 
> 'GPIO79_nCS_3_MD' undeclared (first use in this function)
> 
> It indicates that you need to include asm/arch/pxa2xx-regs.h and
> asm/arch/pxa2xx-gpio.h.

Are these not covered by including "asm/uaccess.h" and "asm/io.h" ?

> 
> -- 
> Best Regards / S pozdravem,
> 
> Stanislav Brabec
> software developer
> ---------------------------------------------------------------------
> SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
> Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
> 190 00 Praha 9                                  fax: +420 284 028 951
> Czech Republic                                    http://www.suse.cz/
> 
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems building a kernelmodule for OE
  2008-10-28  9:15   ` Henk Geraads
@ 2008-10-28 11:51     ` Henk Geraads
  2008-10-28 23:10       ` Stanislav Brabec
  0 siblings, 1 reply; 6+ messages in thread
From: Henk Geraads @ 2008-10-28 11:51 UTC (permalink / raw)
  To: openembedded-devel

Hi Stanislav,

Found the problem with __LINUX_ARM_ARCH__!
the "-march=armv5t"  in the makefie compiler line did mess up things!!
the include of the "pxa-regs.h" and "gpio.h" solved the other problem.

Now I've got strange error's from the linker;
	make[2]: *** [/home/henk/SystemDev/module/cfi-ktst/cfi-mod.ko] Error 1
	make[1]: *** [modules] Error 2
	make: *** [default] Error 2
	arm-angstrom-linux-gnueabi-ld: unrecognized option '-Wl,-rpath-link,/home/armcore/oe/build/tmp/angstrom/staging/arm-angstrom-linux-gnueabi/lib'
	arm-angstrom-linux-gnueabi-ld: use the --help option for usage information
	make[2]: *** [/home/henk/SystemDev/module/cfi-ktst/cfi-mod.ko] Error 1
	make[1]: *** [modules] Error 2
	make: *** [default] Error 2

I thought linker option's are very common?

Henk



> -----Oorspronkelijk bericht-----
> Van: Henk Geraads [mailto:linux@hf-electronics.com]
> Verzonden: dinsdag 28 oktober 2008 10:16
> Aan: openembedded-devel@lists.openembedded.org
> Onderwerp: RE: [oe] Problems building a kernelmodule for OE
> 
> 
> Hi Stanislav
> 
> questions,
> 
> > -----Oorspronkelijk bericht-----
> > Van: openembedded-devel-bounces@lists.openembedded.org 
> > [mailto:openembedded-devel-bounces@lists.openembedded.org]Namens 
> > Stanislav Brabec
> > Verzonden: maandag 27 oktober 2008 16:56
> > Aan: openembedded-devel@lists.openembedded.org
> > Onderwerp: Re: [oe] Problems building a kernelmodule for OE
> > 
> > 
> > Henk Geraads wrote:
> > 
> > > when I try to make the module, following error message is produced!
> > 
> > It seems, that source code is a bit outdated (intended for older kernel
> > that you have) or you are compiling it in a bad way.
> > 
> > > 	include/linux/calc64.h:25: error: '__LINUX_ARM_ARCH__' 
> > undeclared (first use in this function)
> > 
> > Strange. It should be defined.
> 
> Where should it be defined?
> 
> > 
> > > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: 
> > implicit declaration of function 'GPLR'
> > > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: 
> > implicit declaration of function 'GPIO_bit'
> > > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c: In function 'cfi_init':
> > > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:204: error: 
> > 'GPIO_IN' undeclared (first use in this function)
> > > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:208: error: 
> > 'MSC1' undeclared (first use in this function)
> > > 	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:209: error: 
> > 'GPIO79_nCS_3_MD' undeclared (first use in this function)
> > 
> > It indicates that you need to include asm/arch/pxa2xx-regs.h and
> > asm/arch/pxa2xx-gpio.h.
> 
> Are these not covered by including "asm/uaccess.h" and "asm/io.h" ?
> 
> > 
> > -- 
> > Best Regards / S pozdravem,
> > 
> > Stanislav Brabec
> > software developer
> > ---------------------------------------------------------------------
> > SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
> > Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
> > 190 00 Praha 9                                  fax: +420 284 028 951
> > Czech Republic                                    http://www.suse.cz/
> > 
> > 
> > _______________________________________________
> > Openembedded-devel mailing list
> > Openembedded-devel@lists.openembedded.org
> > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems building a kernelmodule for OE
  2008-10-28 11:51     ` Henk Geraads
@ 2008-10-28 23:10       ` Stanislav Brabec
  2008-10-29 13:46         ` Henk Geraads
  0 siblings, 1 reply; 6+ messages in thread
From: Stanislav Brabec @ 2008-10-28 23:10 UTC (permalink / raw)
  To: openembedded-devel

Henk Geraads wrote:

> Found the problem with __LINUX_ARM_ARCH__!
> the "-march=armv5t"  in the makefie compiler line did mess up things!!

It is very probably still not correct. When cross compiling the kernel,
you need to pass "ARCH=arm" to make (and set CPU type in .config.
Otherwise compile options may be invalid (and you can even corrupt
your .config file) and then correct -march should be generated by make.

> the include of the "pxa-regs.h" and "gpio.h" solved the other problem.
> 
> Now I've got strange error's from the linker;
> 	make[2]: *** [/home/henk/SystemDev/module/cfi-ktst/cfi-mod.ko] Error 1
> 	make[1]: *** [modules] Error 2
> 	make: *** [default] Error 2
> 	arm-angstrom-linux-gnueabi-ld: unrecognized option '-Wl,-rpath-link,/home/armcore/oe/build/tmp/angstrom/staging/arm-angstrom-linux-gnueabi/lib'
> 	arm-angstrom-linux-gnueabi-ld: use the --help option for usage information
> 	make[2]: *** [/home/henk/SystemDev/module/cfi-ktst/cfi-mod.ko] Error 1
> 	make[1]: *** [modules] Error 2
> 	make: *** [default] Error 2
> 
> I thought linker option's are very common?

-Wl is not an option for linker, but cor compiler. Linker should get
only parameters of -Wl. Additionally -rpath-link is not useful for
kernel (dynamic linking is an user space issue). Something went wrong
and make passed bad arguments to the linker.

Here is a make syntax I am using for kernel cross compilation:
make ARCH=arm CC=arm-angstrom-linux-gnueabi-gcc LD=arm-angstrom-linux-gnueabi-ld INSTALL_PATH=$PWD/INSTALL/boot INSTALL_MOD_PATH=$PWD/INSTALL
You may need to add target (e. g. zImage, install, zinstall,
modules_install).


________________________________________________________________________
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems building a kernelmodule for OE
  2008-10-28 23:10       ` Stanislav Brabec
@ 2008-10-29 13:46         ` Henk Geraads
  0 siblings, 0 replies; 6+ messages in thread
From: Henk Geraads @ 2008-10-29 13:46 UTC (permalink / raw)
  To: openembedded-devel

Hi Stanislav,

Thanks for the remarks, ideed it seems the .config file was messed up.
I did repopulate the kernel source tree again. Did "make ARCH=arm menuconfig"
Created a new kernel and also did use this new tree to succesfully build my own kernel module.

Best regards,

Henk


> -----Oorspronkelijk bericht-----
> Van: openembedded-devel-bounces@lists.openembedded.org
> [mailto:openembedded-devel-bounces@lists.openembedded.org]Namens
> Stanislav Brabec
> Verzonden: woensdag 29 oktober 2008 0:10
> Aan: openembedded-devel@lists.openembedded.org
> Onderwerp: Re: [oe] Problems building a kernelmodule for OE
> 
> 
> Henk Geraads wrote:
> 
> > Found the problem with __LINUX_ARM_ARCH__!
> > the "-march=armv5t"  in the makefie compiler line did mess up things!!
> 
> It is very probably still not correct. When cross compiling the kernel,
> you need to pass "ARCH=arm" to make (and set CPU type in .config.
> Otherwise compile options may be invalid (and you can even corrupt
> your .config file) and then correct -march should be generated by make.
> 
> > the include of the "pxa-regs.h" and "gpio.h" solved the other problem.
> > 
> > Now I've got strange error's from the linker;
> > 	make[2]: *** 
> [/home/henk/SystemDev/module/cfi-ktst/cfi-mod.ko] Error 1
> > 	make[1]: *** [modules] Error 2
> > 	make: *** [default] Error 2
> > 	arm-angstrom-linux-gnueabi-ld: unrecognized option 
> '-Wl,-rpath-link,/home/armcore/oe/build/tmp/angstrom/staging/arm-a
> ngstrom-linux-gnueabi/lib'
> > 	arm-angstrom-linux-gnueabi-ld: use the --help option for 
> usage information
> > 	make[2]: *** 
> [/home/henk/SystemDev/module/cfi-ktst/cfi-mod.ko] Error 1
> > 	make[1]: *** [modules] Error 2
> > 	make: *** [default] Error 2
> > 
> > I thought linker option's are very common?
> 
> -Wl is not an option for linker, but cor compiler. Linker should get
> only parameters of -Wl. Additionally -rpath-link is not useful for
> kernel (dynamic linking is an user space issue). Something went wrong
> and make passed bad arguments to the linker.
> 
> Here is a make syntax I am using for kernel cross compilation:
> make ARCH=arm CC=arm-angstrom-linux-gnueabi-gcc 
> LD=arm-angstrom-linux-gnueabi-ld INSTALL_PATH=$PWD/INSTALL/boot 
> INSTALL_MOD_PATH=$PWD/INSTALL
> You may need to add target (e. g. zImage, install, zinstall,
> modules_install).
> 
> 
> ________________________________________________________________________
> Stanislav Brabec
> http://www.penguin.cz/~utx/zaurus
> 
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-29 13:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-27  8:13 Problems building a kernelmodule for OE Henk Geraads
2008-10-27 15:56 ` Stanislav Brabec
2008-10-28  9:15   ` Henk Geraads
2008-10-28 11:51     ` Henk Geraads
2008-10-28 23:10       ` Stanislav Brabec
2008-10-29 13:46         ` Henk Geraads

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox