1. 程式人生 > >busybox(二)編譯

busybox(二)編譯


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

    [email protected]:/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

    [email protected]:~/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
    
    
    [email protected]:~/stu/first_fs$ ls bin/ls -l
    lrwxrwxrwx 1 book book 7 11月 13 23:37 bin/ls -> busybox