Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1254366
  • 博文数量: 404
  • 博客积分: 10011
  • 博客等级: 上将
  • 技术积分: 5382
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-03 16:29
文章存档

2010年(40)

2009年(140)

2008年(224)

我的朋友

分类: LINUX

2008-10-14 12:49:44

笔者所用的是一块ARM9 Atmel 9200的开发板,Linux内核为2.4.27, 交叉编译器为2.95.3,编译环境为RedHat9 Linux下。

1、从下载到busybox,笔者下载的为busybox1.1.3,下载后解压到一个目录下,如 /tmp 目录下;

2、进入解压后的目录,输入make menuconfig 进行编译配置,基本的配置如下:
Busybox Settings >                                                              
          General Configuration >                                                
                     [*] Support for devfs                                       
          Build Options >                                                        
                     [*] Build BusyBox as a static binary (no shared libs)       
                           /* 将busybox编译为静态连接,少了启动时找动态库的麻烦 */     
                     [*] Do you want to build BusyBox with a Cross Compiler?     
                       (/usr/local/arm/3.3.2/bin/armlinux)                       
                       Cross Compiler prefix                                     
                          /* 指定交叉编译工具路径 */                                
          Init Utilities >                                                       
                    [*] init                                                     
                    [*] Support reading an inittab file                          
                         /* 支持init读取/etc/inittab配置文件,一定要选上 */          
          Shells >                                                               
                    Choose your default shell (ash) >                            
                        /* (X) ash 选中ash,这样生成的时候才会生成bin/sh文件           
                   * 看看我们前头的linuxrc脚本的头一句:                       
                         * #!/bin/sh 是由bin/sh来解释执行的*/                       
                    [*] ash                                                      
          Coreutils >                                                            
                    [*] cp                                                       
                    [*] cat                                                      
                    [*] ls                                                       
                    [*] mkdir                                                    
                    [*] echo (basic SuSv3 version taking no options)             
                    [*] env                                                      
                    [*] mv                                                       
                    [*] pwd                                                      
                    [*] rm                                                       
                    [*] touch                                                    
         Editors >                         
  [*] vi                                                       
         Linux System Utilities >                                                
                    [*] mount                                                     
                    [*] umount                                                   
                    [*] Support loopback mounts                                  
                    [*] Support for the old /etc/mtab file                       
         Networking Utilities >                                                  
                    [*] inetd                                                    
                       /* 支持inetd超级服务器inetd的配置文件为/etc/inetd.conf文件,   
                        * "在该部分的4: 相关配置文件的创建"一节会有说明*/             

 

3、编译并安装Busybox
[arm@localhost busybox1.1.3]$make TARGET_ARCH=arm CROSS=/usr/local/arm/2.85.3/bin/arm-linux- PREFIX=/root/arm_9200/rdmnt/ all install

CROSS 为交叉编译器的路径。
PREFIX指明安装路径:就是我们根文件系统所在路径。
* 这里需要注意一点的是,只要install busybox,我们根文件系统下先前建好的linuxrc就会被覆盖为一同名二进
制文件。所以要事先备份我们自己的linuxrc,在安装完busybox后,将linuxrc复制回去就好。
* 如果在编译的过程中出现错误,这可能是某些支持问题,可以在配置的时候把相关的选项去掉试试。
* 如果出现找不到内核版本号的编译错误(如:编译libb/loop.c时提示找不到 linux/version.h 文件),可以有两种方法解决:
(1)把你的内核源码中的version.h文件拷贝到交叉编译器的包含文件的linux目录下(该方法笔者试验成功);
(2)该方法来源于论坛上面的一位朋友,做法
为删掉
   #include
换成
   #define UTS_RELEASE "2.4.27-vrs1"  
   #define LINUX_VERSION_CODE 132123
   #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

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