首页 > 技术文章 > busybox(二)编译

zongzi10010 2018-11-26 23:03 原文


title: busybox(二)编译
tag: arm
date: 2018-11-13 23:14:58

busybox(二)编译

  1. 解压,源码包在busybox-1.7.0.tar.bz2,

    tar xjf  busybox-1.7.0.tar.bz2
    cd busybox-1.7.0/
    
  2. 查看说明文档INSTALL,注意不能直接使用make install,这样会安装到pc上,破坏pc.应该要使用make CONFIG_PREFIX=xxx目录 install

     make menuconfig     # This creates a file called ".config"
     make                # This creates the "busybox" executable  
     make install        # or make CONFIG_PREFIX=/path/from/root install
    
  3. 设置下交叉编译工具为arm-linux-,修改顶层Makefile

    CROSS_COMPILE   ?=arm-linux-
    
  4. 使用make menuconfig配置,发现提示错误,这是因为版本问题,修改下makefile

    book@100ask:/work/busybox-1.7.0$ make menuconfig
    Makefile:405: *** mixed implicit and normal rules: deprecated syntax
    Makefile:1242: *** mixed implicit and normal rules: deprecated syntax
    make: *** No rule to make target 'menuconfig'.  Stop.
    

    修改以下内容

    顶层Makefile 405行:config %config: scripts_basic outputmakefile FORCE 改为:
    %config: scripts_basic outputmakefile FORCE
    
    修改busybox-1.7.0 顶层Makefile 1242行:
    / %/: prepare scripts FORCE   改为:
    %/: prepare scripts FORCE
    
    如果还不行 
    要安装 sudo apt-get install libncurses5-dev libncursesw5-dev 这两个库才可以
    
  5. 修改配置项目,增加tab补全功能,busybox settings ---busybox libry tuning ----tab completion,输入y选择.其余模块的使能一般在Linux Module Utilities --->

  6. make

  7. 设置安装路径 make CONFIG_PREFIX=~/stu/first_fs install

  8. 可以看到文件链接到busybox,也就是说bin下面有个busybox的程序,其他ls等都链接到它

    book@100ask:~/stu/first_fs$ ls -l
    总用量 12
    drwxrwxr-x 2 book book 4096 11月 13 23:37 bin
    lrwxrwxrwx 1 book book   11 11月 13 23:37 linuxrc -> bin/busybox
    drwxrwxr-x 2 book book 4096 11月 13 23:37 sbin
    drwxrwxr-x 4 book book 4096 11月 13 23:37 usr
    
    
    book@100ask:~/stu/first_fs$ ls bin/ls -l
    lrwxrwxrwx 1 book book 7 11月 13 23:37 bin/ls -> busybox
    
    

推荐阅读