Welcome 微信登录

首页 / 操作系统 / Linux / GeekOS编译于64位Linux系统

开始GeekOS之旅的时候,一开始就碰到了小麻烦,在自己64位的Fedora上编译GeekOS的时候报如下错误:
  1. geekos/lowlevel.o: could not read symbols: File in wrong format  
断定是平台问题.再去官网看了下:
  1. GeekOS is a tiny operating system kernel for x86 PCs.  
看了后就决定换i386系统了,装上后就发现很多需要配置,太麻烦,稍微思考片刻,记得以前在编译其它i386代码时,是可以跨平台的,编译时搜索lib32库不就行了嘛.研究了下GeekOS的Makefile.GeekOS提供的Makefile中是有编译于X64的配置的.拿 project0的Makefile来说,在第97行(GeekOS-0.3.0) 把TARGECT_CC_PREFIX打开就可以了. 但是你的OS需要安装Cross-development的开发包.不过没关系,还有个方法就是加编译选项 -m32 和 链接选项 -m elf_i386 这样会在编译时自动去找lib32.在GeekOS的 Makefile中第100,106,109行改成如下:
  1. 100 TARGET_CC := $(TARGET_CC_PREFIX)gcc -m32                                                    
  2. 101   
  3. 102 # Host C compiler.  This is used to compile programs to execute on                          
  4. 103 # the host platform, not the target (x86) platform.  On x86/ELF  
  5. 104 # systems, such as Linux and FreeBSD, it can generally be the same                          
  6. 105 # as the target C compiler.                                                                 
  7. 106 HOST_CC := gcc -m32                                                                         
  8. 107   
  9. 108 # Target linker.  GNU ld is probably to only one that will work.                            
  10. 109 TARGET_LD := $(TARGET_CC_PREFIX)ld  -m elf_i386              
然后改动后,你可能需要安装glibc的386版本,fedora安装如下:
  1. yum -y install glibc-devel.i686  
然后再进行编译就OK了:cat geekos/fd_boot.bin geekos/setup.bin geekos/kernel.bin > fd.img 镜像文件成功生成.UNIX网络编程之环境配置安装 LibreOffice 3.4.3 (官方PPA 源)相关资讯      Linux知识  GeekOS 
  • 时光总是太匆匆!Linux已经诞生23  (08/29/2014 14:12:03)
  • Linux虚拟文件系统之文件打开(sys  (02/14/2012 11:41:54)
  • 2012 年 Linux 峰会时间表  (02/14/2012 06:47:27)
  • 报告称当前 Linux 人才抢手 高薪也  (02/15/2012 06:35:56)
  • 解析企业为何选择Linux及其特别之  (02/14/2012 08:17:59)
  • Linux禁用字符闪烁的方法  (11/02/2011 10:28:25)
本文评论 查看全部评论 (0)
表情: 姓名: 字数