当前位置: 技术问答>linux和unix
内核编译时出错,请大牛们帮忙解答下
来源: 互联网 发布时间:2016-09-12
本文导语: 我用arm-linux-gcc 3.4.1编译linux-2.6.26.5内核。 linux提示的问题如下: drivers/built-in.o(.text+0x33288): In function `drm_lock_take': /mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg' drive...
我用arm-linux-gcc 3.4.1编译linux-2.6.26.5内核。
linux提示的问题如下:
drivers/built-in.o(.text+0x33288): In function `drm_lock_take':
/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
drivers/built-in.o(.text+0x336ec): In function `drm_lock_free':
/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
drivers/built-in.o(.text+0x337ac):/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
drivers/built-in.o(.text+0x339cc): In function `drm_notifier':
/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
drivers/built-in.o(.text+0x33b20): In function `drm_idlelock_release':
/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make[1]: *** [.tmp_vmlinux1] 错误 1
make: *** [sub-make] 错误 2
下面的代码是cmpxchg-local.h中的含有wrong_size_cmpxchg部分,已经在文件头用“extern unsigned long wrong_size_cmpxchg(volatile void *ptr)”定义调用外部函数wrong_size_cmpxchg了,但是编译时却出现了上面linux提示的问题,请大牛帮忙解答下这是什么原因造成的以及怎么解决。
#define __ASM_GENERIC_CMPXCHG_LOCAL_H
#include
extern unsigned long wrong_size_cmpxchg(volatile void *ptr);
/*
* Generic version of __cmpxchg_local (disables interrupts). Takes an unsigned
* long parameter, supporting various types of architectures.
*/
static inline unsigned long __cmpxchg_local_generic(volatile void *ptr,
unsigned long old, unsigned long new, int size)
{
unsigned long flags, prev;
/*
* Sanity checking, compile-time.
*/
if (size == 8 && sizeof(unsigned long) != 8)
wrong_size_cmpxchg(ptr);
local_irq_save(flags);
switch (size) {
case 1: prev = *(u8 *)ptr;
if (prev == old)
*(u8 *)ptr = (u8)new;
break;
case 2: prev = *(u16 *)ptr;
if (prev == old)
*(u16 *)ptr = (u16)new;
break;
case 4: prev = *(u32 *)ptr;
if (prev == old)
*(u32 *)ptr = (u32)new;
break;
case 8: prev = *(u64 *)ptr;
if (prev == old)
*(u64 *)ptr = (u64)new;
break;
default:
wrong_size_cmpxchg(ptr);
}
local_irq_restore(flags);
return prev;
}
linux提示的问题如下:
drivers/built-in.o(.text+0x33288): In function `drm_lock_take':
/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
drivers/built-in.o(.text+0x336ec): In function `drm_lock_free':
/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
drivers/built-in.o(.text+0x337ac):/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
drivers/built-in.o(.text+0x339cc): In function `drm_notifier':
/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
drivers/built-in.o(.text+0x33b20): In function `drm_idlelock_release':
/mnt/hgfs/shared/cheshi/linux-2.6.26.5/include/asm-generic/cmpxchg-local.h:42: undefined reference to `wrong_size_cmpxchg'
make[1]: *** [.tmp_vmlinux1] 错误 1
make: *** [sub-make] 错误 2
下面的代码是cmpxchg-local.h中的含有wrong_size_cmpxchg部分,已经在文件头用“extern unsigned long wrong_size_cmpxchg(volatile void *ptr)”定义调用外部函数wrong_size_cmpxchg了,但是编译时却出现了上面linux提示的问题,请大牛帮忙解答下这是什么原因造成的以及怎么解决。
#define __ASM_GENERIC_CMPXCHG_LOCAL_H
#include
extern unsigned long wrong_size_cmpxchg(volatile void *ptr);
/*
* Generic version of __cmpxchg_local (disables interrupts). Takes an unsigned
* long parameter, supporting various types of architectures.
*/
static inline unsigned long __cmpxchg_local_generic(volatile void *ptr,
unsigned long old, unsigned long new, int size)
{
unsigned long flags, prev;
/*
* Sanity checking, compile-time.
*/
if (size == 8 && sizeof(unsigned long) != 8)
wrong_size_cmpxchg(ptr);
local_irq_save(flags);
switch (size) {
case 1: prev = *(u8 *)ptr;
if (prev == old)
*(u8 *)ptr = (u8)new;
break;
case 2: prev = *(u16 *)ptr;
if (prev == old)
*(u16 *)ptr = (u16)new;
break;
case 4: prev = *(u32 *)ptr;
if (prev == old)
*(u32 *)ptr = (u32)new;
break;
case 8: prev = *(u64 *)ptr;
if (prev == old)
*(u64 *)ptr = (u64)new;
break;
default:
wrong_size_cmpxchg(ptr);
}
local_irq_restore(flags);
return prev;
}
|
make menuconfig,选中相应的驱动选项。
要么是 , 要么是[M], 或者 [*].
具体可以看help信息。
要么是 , 要么是[M], 或者 [*].
具体可以看help信息。
|
你用的system type是什么?
我选的system type为S3C2410没有将drm驱动编译进去,在make menuconfig时也不可能进行选择。你是手工加的还是选择了什么特定的system type?
我选的system type为S3C2410没有将drm驱动编译进去,在make menuconfig时也不可能进行选择。你是手工加的还是选择了什么特定的system type?
|
直接问公司的人会比较快点。沟通很重要。不要担心会让别人觉得自己技术差。
完成任务自己再研究。