busybox编译笔记

1.下载busybox-1.20.1.tar.bz

2.解压:tar   jxvf   busybox-1.20.1.tar.bz

3.配置:

(1)进入解压后的文件busybox-1.20.1:cd busybox-1.20.1

(2)进行默认配置:make defconfig

(3)个别修改配置:

make menuconfig

Busybox Setting ----->
    Build Options -----> 
        //1选择将busybox进行静态编译 
        [*]Build BusyBox as a static binary (no shared libs) 
        //2.指定交叉编译器为 
        (/usr/local/arm/4.3.2/bin/arm-linux-)Cross Compiler prefix

 

Busybox Library Tuning---> 
    [*]Username completion    // tab 自动补齐功能
    [*]Fancy shell prompts 
    [*]Query  cursor  position  from  terminal 
        //4.编译出的busybox的shell命令解释器支持显示当前路径及主机信息

保存退出

4.修改Makefile

(1)将CROSS_COMPILE ?=   修改为 CROSS_COMPILE = arm-linux-

(2)ARCH ?= $(SUBARCH)    修改为 ARCH = arm

5.编译:make

出现错误:recipe for target 'loginutils/passwd.o' failed

解决方法:

BusyBox源码的include目录下/libbb.h 文件添加一行引用 #include

保存后再次编译 make

6.编译成功后安装:make install

安装后的初始文件系统就在_install中,包含:bin  sbin  user  linuxrc

7.或者使用make CONFIG_RREFIX=自定义目录 install

 

你可能感兴趣的:(linux)