Chinaunix首页 | 论坛 | 博客
  • 博客访问: 264799
  • 博文数量: 69
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 900
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-07 16:35
文章分类

全部博文(69)

文章存档

2011年(1)

2010年(68)

我的朋友

分类: LINUX

2010-07-31 14:21:40

笔者所用的是一块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复制回去就好。
* 如果在编译的过程中出现错误,这可能是某些支持问题,可以在配置的时候把相关的选项去掉试试。
* 如果出现找不到内核版本号的编译错误,可以有两种方法解决:(1)把你的内核源码中的version.h文件拷贝到交叉编译器的包含文件的linux目录下(该方法笔者试验成功);(2)该方法来源于论坛上面的一位朋友,做法为删掉#include 换成#define UTS_RELEASE "2.4.27"  #define LINUX_VERSION_CODE 132123

  注意:

Q:安装某些需要内核源码的软件时,为什么我已经将内核源码装在了/usr/src/linux下,仍然提示找不到内核源码?

A:因为这些软件configure会通过检测/usr/src/linux/include/linux/version.h是否存在,以判断是否以安装
内核源码,而如果只将内核源码包解压,并不存在version.h这个文件,所以需要做如下步骤:
在内核源码目录下(/usr/src/linux)
1)make include/linux/version.h 生成version.h文件
阅读(1100) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~