一. ubuntu 10.10下编译linux-2.6.24
gcc 4.4.5
1.1 出错信息
LD vmlinux.o
MODPOST vmlinux.o
CHK include/linux/version.h
HOSTCC scripts/unifdef
linux-2.6.24/scripts/unifdef.c:209: error: conflicting types for ‘getline’
/usr/include/stdio.h:671: note: previous declaration of ‘getline’ was here
make[3]: *** [scripts/unifdef] Error 1
make[2]: *** [headers_install] Error 2
make[1]: *** [vmlinux] Error 2
make: *** [sub-make] Error 2
解决方法:
linux-2.6.24/scripts/unifdef.c 中的 getline 与 gcc编译过程中/usr/include/stdio.h用的getline函数冲突,将linux-2.6.24/scripts/unifdef.c下的 getline改名为parseline
-
diff --git a/scripts/unifdef.c b/scripts/unifdef.c
-
index 552025e..977e682 100644
-
--- a/scripts/unifdef.c
-
+++ b/scripts/unifdef.c
-
@@ -206,7 +206,7 @@ static void done(void);
-
static void error(const char *);
-
static int findsym(const char *);
-
static void flushline(bool);
-
-static Linetype getline(void);
-
+static Linetype parseline(void);
-
static Linetype ifeval(const char **);
-
static void ignoreoff(void);
-
static void ignoreon(void);
-
@@ -512,7 +512,7 @@ process(void)
-
for (;;) {
-
linenum++;
-
- lineval = getline();
-
+ lineval = parseline();
-
trans_table[ifstate[depth]][lineval]();
-
debug("process %s -> %s depth %d",
-
linetype_name[lineval],
-
@@ -526,7 +526,7 @@ process(void)
-
* help from skipcomment().
-
*/
-
static Linetype
-
-getline(void)
-
+parseline(void)
-
{
-
const char *cp;
-
int cursym;
1.2出错信息
CC arch/x86/boot/video.o
/root/fs_all/kernel/linux-2.6.24/arch/x86/boot/boot.h: Assembler messages:
/root/fs_all/kernel/linux-2.6.24/arch/x86/boot/boot.h:112: Error: bad register name `%dil'
make[2]: *** [arch/x86/boot/video.o] Error 1
make[1]: *** [bzImage] Error 2
make: *** [sub-make] Error 2
解决方法
出错行中用"=q"替换"=r"
As allan said, replace "=r" with "=q" in the affected line. "dil" (lower 8 bits part of [RE]DI) register is inexistent under x86-32, only available under x86-64.
二. ubuntu 12.04下编译linux-2.6.24
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
1. 出错信息
-
LDS arch/x86/kernel/vsyscall_32.lds
-
AS arch/x86/kernel/vsyscall-int80_32.o
-
AS arch/x86/kernel/vsyscall-note_32.o
-
SYSCALL arch/x86/kernel/vsyscall-int80_32.so
-
gcc: error: elf_i386: No such file or directory
解决方法:
-
61c61
-
< cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
-
---
-
> cmd_syscall = $(CC) -m32 -nostdlib $(SYSCFLAGS_$(@F)) \
2. 出错信息
-
LD .tmp_vmlinux1
-
kernel/built-in.o: In function `mutex_lock':
-
/work/x86/2.6.24/linux-2.6.24/kernel/mutex.c:92: undefined reference to `__mutex_lock_slowpath'
-
kernel/built-in.o: In function `mutex_unlock':
-
/work/x86/2.6.24/linux-2.6.24/kernel/mutex.c:118: undefined reference to `__mutex_unlock_slowpath'
-
make: *** [.tmp_vmlinux1] Error 1
解决方法:
sun@ubuntu:/work/x86/2.6.24/linux-2.6.24$ vi kernel/mutex.c
-
61c61
-
< static void fastcall noinline __sched
-
---
-
> static __used void fastcall noinline __sched
-
98c98
-
< static void fastcall noinline __sched
-
---
-
> static __used void fastcall noinline __sched
-
263c263
-
< static fastcall noinline void
-
---
-
> static __used fastcall noinline void
3. 出错信息
-
arch/x86/boot/boot.h: Assembler messages:
-
arch/x86/boot/boot.h:112: Error: bad register name `%dil'
-
make[1]: *** [arch/x86/boot/video.o] Error 1
解决方法:
vi arch/x86/boot/boot.h
-
109 static inline u8 rdfs8(addr_t addr)
-
110 {
-
111 u8 v;
-
112 //asm volatile("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
-
113 asm volatile("movb %%fs:%1,%0" : "=q" (v) : "m" (*(u8 *)addr));
-
114 return v;
-
115 }
阅读(2931) | 评论(0) | 转发(0) |