Chinaunix首页 | 论坛 | 博客
  • 博客访问: 55636
  • 博文数量: 15
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 195
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-11 13:32
文章分类

全部博文(15)

文章存档

2016年(4)

2015年(11)

我的朋友

分类: LINUX

2015-08-31 08:05:45

一. 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
  1. diff --git a/scripts/unifdef.c b/scripts/unifdef.c
  2. index 552025e..977e682 100644
  3. --- a/scripts/unifdef.c
  4. +++ b/scripts/unifdef.c
  5. @@ -206,7 +206,7 @@ static void done(void);
  6. static void error(const char *);
  7. static int findsym(const char *);
  8. static void flushline(bool);
  9. -static Linetype getline(void);
  10. +static Linetype parseline(void);
  11. static Linetype ifeval(const char **);
  12. static void ignoreoff(void);
  13. static void ignoreon(void);
  14. @@ -512,7 +512,7 @@ process(void)
  15. for (;;) {
  16. linenum++;
  17. -     lineval = getline();
  18. +     lineval = parseline();
  19. trans_table[ifstate[depth]][lineval]();
  20. debug("process %s -> %s depth %d",
  21. linetype_name[lineval],
  22. @@ -526,7 +526,7 @@ process(void)
  23. * help from skipcomment().
  24. */
  25. static Linetype
  26. -getline(void)
  27. +parseline(void)
  28. {
  29. const char *cp;
  30. 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. 出错信息
  1. LDS arch/x86/kernel/vsyscall_32.lds
  2.   AS arch/x86/kernel/vsyscall-int80_32.o
  3.   AS arch/x86/kernel/vsyscall-note_32.o
  4.   SYSCALL arch/x86/kernel/vsyscall-int80_32.so
  5. gcc: error: elf_i386: No such file or directory
解决方法:
  1. 61c61
  2. < cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
  3. ---
  4. > cmd_syscall = $(CC) -m32 -nostdlib $(SYSCFLAGS_$(@F)) \
2. 出错信息
  1. LD .tmp_vmlinux1
  2. kernel/built-in.o: In function `mutex_lock':
  3. /work/x86/2.6.24/linux-2.6.24/kernel/mutex.c:92: undefined reference to `__mutex_lock_slowpath'
  4. kernel/built-in.o: In function `mutex_unlock':
  5. /work/x86/2.6.24/linux-2.6.24/kernel/mutex.c:118: undefined reference to `__mutex_unlock_slowpath'
  6. make: *** [.tmp_vmlinux1] Error 1
解决方法:
sun@ubuntu:/work/x86/2.6.24/linux-2.6.24$ vi kernel/mutex.c
  1. 61c61
  2. < static void fastcall noinline __sched
  3. ---
  4. > static __used void fastcall noinline __sched
  5. 98c98
  6. < static void fastcall noinline __sched
  7. ---
  8. > static __used void fastcall noinline __sched
  9. 263c263
  10. < static fastcall noinline void
  11. ---
  12. > static __used fastcall noinline void

3. 出错信息
  1. arch/x86/boot/boot.h: Assembler messages:
  2. arch/x86/boot/boot.h:112: Error: bad register name `%dil'
  3. make[1]: *** [arch/x86/boot/video.o] Error 1
解决方法:
vi arch/x86/boot/boot.h
  1. 109 static inline u8 rdfs8(addr_t addr)
  2. 110 {
  3. 111 u8 v;
  4. 112 //asm volatile("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
  5. 113 asm volatile("movb %%fs:%1,%0" : "=q" (v) : "m" (*(u8 *)addr));
  6. 114 return v;
  7. 115 }


阅读(2931) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~