ts-7000
[Top] [All Lists]

[ts-7000] Re: Compiling device driver module for the linux-2.6.21-ts ker

To:
Subject: [ts-7000] Re: Compiling device driver module for the linux-2.6.21-ts kernel
From: "charliem_1216" <>
Date: Sun, 22 Jun 2008 20:09:03 -0000
Hi --

--- In  "Vijay" <> wrote:
>
> Hi,
>  I am trying to compile/port a simple character device driver 
module
> that was previously built for the (ts) 2.4 kernel (and it runs 
fine).
> I have been able to install the gnu eabi cross tool chain and 
compile
> the 2.6.21 ts kernel.
> 
>  I used the following link as a guide.
> http://www.embeddedarm.com/software/arm-linux-26-ts72xx.php
> 
>  I edited my previously created Makefile to point to the new 
toolchain
> and the new kernel config/header files. But my build has been 
failing
> with the following errors.
> 
> :~/proj/base/module/glcd$ make
> /opt/crosstool/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc
> -D__KERNEL__ -DMODULE 
> -I/home/vijay/proj/base/kernel/linux-2.6.21-ts/include -O -Wall   -c
> -o glcd.o glcd.c
> In file included from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/bitops.h:9,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/thread_info.h:20,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/preempt.h:9,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/spinlock.h:49,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/module.h:9,
>                  from glcd.c:24:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/asm/bitops.h: 
In
> function `____atomic_set_bit':
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/asm/bitops.h:40:
> warning: implicit declaration of function `local_irq_save'
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/asm/bitops.h:42:
> warning: implicit declaration of function `local_irq_restore'

Can you double check that the headers are from the correct kernel?  
My include/asm/bitops.h:40 refers to 'raw_local_irq_save', rather 
than 'local_irq_save'.

> In file included from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/kobject.h:25,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/module.h:17,
>                  from glcd.c:24:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/rwsem.h:24:65:
> asm/rwsem.h: No such file or directory

Please just walk the include chain.  You can see that arch specific 
asm/rwsem.h is included if CONFIG_RWSEM_GENERIC_SPINLOCK is not 
defined.  Find out why that is not defined ... 

Oops, I see below you already looked into this.

Do you have include/asm symlinked to include/asm-arm?  Did you do 
a 'make mrproper' before or after?

> In file included from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/module.h:17,
>                  from glcd.c:24:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/kobject.h:
> At top level:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/kobject.h:178:
> error: field `rwsem' has incomplete type
> In file included from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/memory_hotplug.h:7,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/mmzone.h:463,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/gfp.h:4,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/slab.h:14,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/percpu.h:5,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/asm-generic/local.h:4,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/asm/local.h:1,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/module.h:19,
>                  from glcd.c:24:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/notifier.h:62:
> error: field `rwsem' has incomplete type
> In file included from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/fs.h:359,
>                  from glcd.c:31:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/quota.h:291: 
error:
> field `dqptr_sem' has incomplete type
> In file included from glcd.c:31:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/fs.h:553:
> error: field `i_alloc_sem' has incomplete type
> In file included from glcd.c:31:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/fs.h:917:
> error: field `s_umount' has incomplete type
> In file included from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/sched.h:51,
>                  from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/asm/uaccess.h:14,
>                  from glcd.c:33:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:33:3:
> #error You lose.
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/jiffies.h:225:31:
> division by zero in #if
> In file included from
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/asm/uaccess.h:14,
>                  from glcd.c:33:
> /home/vijay/proj/base/kernel/linux-2.6.21-ts/include/linux/sched.h:326: 
error:
> field `mmap_sem' has incomplete type
> make: *** [glcd.o] Error 1
> 
> 
> The following is the makefile I tried to use.
>                                                                      
>      
> ROOT_PATH=/home/vijay
> 
> 
COMPILER_PATH=/opt/crosstool/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
> 
> CC=$(COMPILER_PATH)gcc
> LD=$(COMPILER_PATH)ld
> 
> INCLUDE_PATH=$(ROOT_PATH)/proj/base/kernel/linux-2.6.21-ts/include
> KERNEL_DIR=$(ROOT_PATH)/proj/base/kernel/linux-2.6.21-ts
> 
> include $(KERNEL_DIR)/.config
> 
> CFLAGS = -D__KERNEL__ -DMODULE  -I$(INCLUDE_PATH) -O -Wall
> 
> all:glcd.o glcd_base.o
>         $(LD) -r -o glcd glcd.o glcd_base.o
> 
> clean:
>         rm *.o glcd
> 
> 
> 2. Question on including the kernel .config file in the Makefile.
> 
> The following (see at the bottom) is an extract from the top 
portion
> of my kernel .config file. As you can see,
> CONFIG_RWSEM_GENERIC_SPINLOCK=y is turned ON. But still when 
compiling
> my code, when rwsem.h gets included (indirectly), it tries to pull 
in
> the <asm/rwsem.h> instead of the <linux/rwsem-spinlock.h> file. My
> make file did have the line "include $(KERNEL_DIR)/.config" which 
has
> CONFIG_RWSEM_GENERIC_SPINLOCK=y defined. So, I am not sure how the
> <asm/rwsem.h> file is being pulled in.
> 
> snip -- from include/linux/rwsem.h --
> #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
> #include <linux/rwsem-spinlock.h> /* use a generic implementation 
*/
> #else
> #include <asm/rwsem.h> /* use an arch-specific implementation */
> #endif
> end snip -- from include/linux/rwsem.h --
> 
> 
> snip -- from .config file --
> #                                                                    
>                                                                      
>                  
> # Automatically generated make config: don't edit                    
>                                                                      
>                  
> # Linux kernel version: 2.6.21-ts                                    
>                                                                      
>                  
> # Fri Jun 20 23:53:04 2008                                           
>                                                                      
>                  
> #                                                                    
>                                                                      
>                  
> CONFIG_ARM=y
> CONFIG_SYS_SUPPORTS_APM_EMULATION=y
> # CONFIG_GENERIC_GPIO is not set                                     
>                                                                      
>                  
> # CONFIG_GENERIC_TIME is not set                                     
>                                                                      
>                  
> CONFIG_MMU=y
> # CONFIG_NO_IOPORT is not set                                        
>                                                                      
>                  
> CONFIG_GENERIC_HARDIRQS=y
> CONFIG_TRACE_IRQFLAGS_SUPPORT=y
> CONFIG_HARDIRQS_SW_RESEND=y
> CONFIG_GENERIC_IRQ_PROBE=y
> CONFIG_RWSEM_GENERIC_SPINLOCK=y
> # CONFIG_ARCH_HAS_ILOG2_U32 is not set                               
>                                                                      
>                  
> # CONFIG_ARCH_HAS_ILOG2_U64 is not set                               
>                                                                      
>                  
> CONFIG_GENERIC_HWEIGHT=y
> CONFIG_GENERIC_CALIBRATE_DELAY=y
> CONFIG_ZONE_DMA=y
> CONFIG_VECTORS_BASE=0xffff0000
> CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
> 
> end snip -- from .config file --
> 
> I have tried to look through the mailing list before posting. But
> nothing comes close to the answer I need.

The method for compiling out-of-tree modules is very different for 
2.6 than for 2.4.  The 3rd edition of the LDD book explains it quite 
well.  Both the second and third editions are also available on-line 
as well.

Regards. ............ Charlie
> 
> Thanks in advance for any help!
> -Vijay
>



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU