using LTIB to compile module driver for iMX31

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

using LTIB to compile module driver for iMX31

3,866 Views
vkama
Contributor I
:smileysad:

Reading other topics about LTIB, I found one that some people did a module driver using LTIB under shell mode:

./ltib -m shell

and apparently, this is a easy way to compile a module driver:

makefile:

obj-m := test.o

The fact is, using the hello.c, standard module driver "hello world", if I do a simple command:

LTIB> make

it complains:

make -C /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux/ M=/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver
make[1]: Entering directory `/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24'
  CC [M]  /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.o
cc1: error: unrecognized command line option "-m64"
cc1: error: unrecognized command line option "-mno-red-zone"
cc1: error: unrecognized command line option "-mcmodel=kernel"
cc1: error: unrecognized command line option "-maccumulate-outgoing-args"
make[2]: *** [/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.o] Error 1
make[1]: *** [_module_/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver] Error 2
make[1]: Leaving directory `/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24'
make: *** [default] Error 2
LTIB>

If I do a more complete command:

LTIB> make ARCH=arm/mach-mx3

make -C /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux/ M=/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver
make[1]: Entering directory `/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24'
  CC [M]  /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.o
In file included from include/linux/prefetch.h:14,
                 from include/linux/list.h:8,
                 from include/linux/module.h:9,
                 from /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.c:3:
include/asm/processor.h:103:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/asm/arch/memory.h:14,
                 from include/asm/memory.h:27,
                 from include/asm/system.h:6,
                 from include/linux/list.h:9,
                 from include/linux/module.h:9,
                 from /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.c:3:
include/asm/page.h:189:31: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/linux/irqflags.h:46,
                 from include/asm/system.h:79,
                 from include/linux/list.h:9,
                 from include/linux/module.h:9,
                 from /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.c:3:
include/asm/irqflags.h:11:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/linux/list.h:9,
                 from include/linux/module.h:9,
                 from /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.c:3:
include/asm/system.h:166:5: warning: "__LINUX_ARM_ARCH__" is not defined
include/asm/system.h:172:5: warning: "__LINUX_ARM_ARCH__" is not defined
include/asm/system.h:176:35: warning: "__LINUX_ARM_ARCH__" is not defined
include/asm/system.h:296:5: warning: "__LINUX_ARM_ARCH__" is not defined
include/asm/system.h:301:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/linux/bitops.h:17,
                 from include/linux/kernel.h:15,
                 from include/linux/cache.h:4,
                 from include/linux/time.h:7,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.c:3:
include/asm/bitops.h:237:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/asm/thread_info.h:16,
                 from include/linux/thread_info.h:34,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:49,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.c:3:
include/asm/fpstate.h:28:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/linux/spinlock.h:333,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.c:3:
include/asm/atomic.h:25:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/linux/jiffies.h:4,
                 from include/linux/sched.h:54,
                 from include/linux/smp_lock.h:5,
                 from include/linux/hardirq.h:5,
                 from include/asm-generic/local.h:5,
                 from include/asm/local.h:1,
                 from include/linux/module.h:19,
                 from /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.c:3:
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.)
In file included from include/asm/semaphore.h:13,
                 from include/linux/sched.h:63,
                 from include/linux/smp_lock.h:5,
                 from include/linux/hardirq.h:5,
                 from include/asm-generic/local.h:5,
                 from include/asm/local.h:1,
                 from include/linux/module.h:19,
                 from /home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.c:3:
include/asm/locks.h:15:5: warning: "__LINUX_ARM_ARCH__" is not defined
make[2]: *** [/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver/hello.o] Error 1
make[1]: *** [_module_/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24/drivers/hello_driver] Error 2
make[1]: Leaving directory `/home/serkam/ltib-imx31vip2704-R13/rpm/BUILD/linux-2.6.24'
make: *** [default] Error 2
LTIB>

The question is:

1) Using LTIB shell mode, how can I define __LINUX_ARM_ARCH__ ?

2) Someone could get a module driver compiled under LTIB shell mode?

Any help will welcome

SerKam
WarpTec



0 Kudos
1 Reply

425 Views
fabio_estevam
NXP Employee
NXP Employee
You can do the following:
 
./ltib -c
 
Package List - - - >
 
and select
 
[*] hello world module example
 
If you want to extract the source:
 
./ltib -p hello_mod.spec -m prep
 
Then look at rpm/BUILD/hello_mod-1.2/README file for a good explanation on how to build a kernel module within LTIB.
 
Regards,
 
Fabio Estevam
0 Kudos