Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2118660
  • 博文数量: 438
  • 博客积分: 3871
  • 博客等级: 中校
  • 技术积分: 6075
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-10 00:11
个人简介

邮箱: wangcong02345@163.com

文章分类

全部博文(438)

文章存档

2017年(15)

2016年(119)

2015年(91)

2014年(62)

2013年(56)

2012年(79)

2011年(16)

分类: LINUX

2016-09-29 10:30:19

环境: Ubuntu 14.04.2 LTS 64位
GCC: gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2


1. 编译流程需要三步
下载linux1.0.tar.gz然后解压至任意目录
cong@msi:/work/qemu/x86/linux$ make config
cong@msi:/work/qemu/x86/linux$ make dep
cong@msi:/work/qemu/x86/linux$ make zImage



2. Makefile修改
TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
CC =gcc -D__KERNEL__ -I$(TOPDIR)/include



  1. serial.c:538:8: error: macro names must be identifiers
  2.  #ifdef 0
  3. cong@msi:/work/qemu/x86/linux$ vi drivers/char/serial.c
  4. 将#ifdef 0 -->#if 0


  5. buffer.c:108:8: error: macro names must be identifiers
  6.  #ifdef 0 /* Disable bad-block debugging code */
  7. cong@msi:/work/qemu/x86/linux$ vi fs/buffer.c
  8. 将#ifdef 0 -->#if 0



  1. sched.c:41:25: error: conflicting type qualifiers for 'xtime'
  2. /work/qemu/x86/linux/sched.h:308:23: note: previous declaration of 'xtime' was here
  3. 将include/linux/sched.h中
  4. //extern struct timeval xtime;
    extern volatile struct timeval xtime;




  1. cong@msi:/work/qemu/x86/linux$ as -c -o boot/head.o boot/head.s
  2. boot/head.S: Assembler messages:
  3. boot/head.S:64: Error: invalid instruction suffix for `push'
  4. boot/head.S:65: Error: invalid instruction suffix for `popf'
  5. boot/head.S:99: Error: invalid instruction suffix for `pushf
  6. 修改Makefile: 
  7. .s.o:
       $(AS) $(ASFLAGS) -c -o $*.o $<






  1. gcc -D__KERNEL__ -I/work/qemu/x86/linux/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -m486 -c -o init/main.o init/main.c
  2. gcc: error: unrecognized command line option-m486’
  3. 修改Makefile: 


还有很多有时间再整理 




3.现在己经可以编译通过了,但是运行时还有点问题,先把修改的diff文件如下
change.rar(下载后改名为change.tar.gz)


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