Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1020378
  • 博文数量: 244
  • 博客积分: 6820
  • 博客等级: 准将
  • 技术积分: 3020
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-09 21:33
文章分类

全部博文(244)

文章存档

2013年(1)

2012年(16)

2011年(132)

2010年(3)

2009年(12)

2008年(80)

我的朋友

分类: LINUX

2008-12-23 10:53:51

首先我使用的busybox是1.1.3版本!
因为这个版本有好多的有用的配置选项!
进入解压后的目录,配置Busybox
[arm@localhost busybox1.1.3]$make menuconfig
配置选项
然后:
#make TARGET_ARCH=arm CROSS=arm-linux-
#make install

如果你是使用的1.4以上的版本,交叉编译同编译内核一样,需要修改Makefile中的arch=arm     CROSS_COMPILE=arm-linux-
然后#make xconfig
#make
#make install
###############################################################
 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.4.1/bin/arm-linux-)
 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
###################################################################################
另外,按照他的这种方法做出来的文件系统,运行的时候 shell 并不好有,没有历史记录、自动补全、删除字符的功能,下面介绍如何为它添加这些功能:
               Shells --->
---   Bourne Shell Options                                            
   [ ]   Hide message on interactive shell startup                    
   [ ]   Standalone shell                                             
   [*]   command line editing                                         
   [*]     vi-style line editing commands                            
      (15)    history size                                           
   [*]     history saving                                             
   [*]     tab completion                                             
   [*]       username completion                                     
   [ ]     Fancy shell prompts
###################################################################################
 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 >
##########################################################
 Linux Module Utilities  ---> 
        
[*] insmod                  
       
[*] rmmod                                   
        
[*] lsmod                  
        
[*]   lsmod pretty output for 2.6.x Linux kernels                    
        
[*] modprobe                                            
       
[*]   Multiple options parsing              
                     ---   Options common to multiple modutils              
        
[*]   Support tainted module checking with new kernels            
       
[ ]   Support version 2.2.x to 2.4.x Linux kernels    //此项一定不要选!!!
       
[*]   Support version 2.6.x Linux kernels                                        
########################################################################

建立根文件系统结构

#mkdir rootfs
#cd rootfs
#mkdir bin dev etc lib proc sbin tmp usr var
#chmod 1777 tmp
#mkdir usr/bin usr/lib usr/sbin
#mkdir var/lib var/lock var/log var/run var/tmp
#chmod 1777 var/tmp


准备链接库

#cd ${OBJ_LIB}/lib (${OBJ_LIB}是交叉编译环境的目录)
#for file in libc libcrypt libdl libm \
>libpthread libresolv libutil
>do
>cp $file-*.so /home/fortis/rootfs/lib
>cp -d $file.so.[*0-9] /home/fortis/rootfs/lib
>done
#cp -d ld*.so* /home/fortis/rootfs/lib

#######################################################################

如果不知道需要哪些共享库,可以在你写好自己的程序后使用#ld hello 命令来看看需要哪些共享库然后在复制到/lib目录下面!

#######################################################################

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