Skip to contentSkip to conversation

Problems building a kernelmodule for OE

DISCUSSION Henk Geraads 2 participants 6 messages Oct 27, 2008 – Oct 29, 2008

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 1 line · Henk Geraads

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.

Quoted 1 line

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

Strange. It should be defined.

Quoted 6 lines

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

Signature · 9 lines
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: [email protected]
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/
#2 lore raw

Hi Stanislav

questions,

Quoted 13 lines

-----Oorspronkelijk bericht-----
Van: [email protected] [mailto:[email protected]]Namens Stanislav Brabec
Verzonden: maandag 27 oktober 2008 16:56
Aan: [email protected]
Onderwerp: Re: [oe] Problems building a kernelmodule for OE

Quoted 1 line · Henk Geraads

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

Quoted 7 lines

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.

Quoted 1 line
	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?

Quoted 7 lines
Quoted 2 lines
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: 

implicit declaration of function 'GPLR'

Quoted 1 line
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: 

implicit declaration of function 'GPIO_bit'

Quoted 2 lines
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c: In function 'cfi_init':
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:204: error: 
Quoted 8 lines

'GPIO_IN' undeclared (first use in this function)

Quoted 1 line
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:208: error: 

'MSC1' undeclared (first use in this function)

Quoted 1 line
	/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" ?

Quoted 17 lines
Signature · 16 lines
-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: [email protected]
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
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
#3 lore raw

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

Quoted 69 lines

-----Oorspronkelijk bericht-----
Van: Henk Geraads [mailto:[email protected]]
Verzonden: dinsdag 28 oktober 2008 10:16
Aan: [email protected]
Onderwerp: RE: [oe] Problems building a kernelmodule for OE

Hi Stanislav

questions,

Quoted 13 lines

-----Oorspronkelijk bericht-----
Van: [email protected] [mailto:[email protected]]Namens Stanislav Brabec
Verzonden: maandag 27 oktober 2008 16:56
Aan: [email protected]
Onderwerp: Re: [oe] Problems building a kernelmodule for OE

Quoted 1 line · Henk Geraads

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

Quoted 7 lines

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.

Quoted 1 line
	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?

Quoted 7 lines
Quoted 2 lines
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: 

implicit declaration of function 'GPLR'

Quoted 1 line
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:67: warning: 

implicit declaration of function 'GPIO_bit'

Quoted 2 lines
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c: In function 'cfi_init':
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:204: error: 
Quoted 8 lines

'GPIO_IN' undeclared (first use in this function)

Quoted 1 line
	/home/henk/cm270/fifodrv/cfi-ktst/cfi-mod.c:208: error: 

'MSC1' undeclared (first use in this function)

Quoted 1 line
	/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" ?

Quoted 17 lines
Signature · 16 lines
-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: [email protected]
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
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
#4 lore raw
Quoted 2 lines · Henk Geraads

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.

Quoted 12 lines

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
Quoted 1 line

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

#5 lore raw

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

Quoted 60 lines

-----Oorspronkelijk bericht-----
Van: [email protected] [mailto:[email protected]]Namens Stanislav Brabec
Verzonden: woensdag 29 oktober 2008 0:10
Aan: [email protected]
Onderwerp: Re: [oe] Problems building a kernelmodule for OE

Quoted 2 lines · Henk Geraads

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.

Quoted 4 lines

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

Quoted 3 lines
	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'

Quoted 1 line
	arm-angstrom-linux-gnueabi-ld: use the --help option for 

usage information

Quoted 1 line
	make[2]: *** 

[/home/henk/SystemDev/module/cfi-ktst/cfi-mod.ko] Error 1

Quoted 4 lines
	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
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel