構建自己的Linux 之二 BusyBox移植

來源:互聯網
上載者:User
構建自己的Linux 之二 BusyBox移植

 

              BusyBox是一個整合了一百多個最常用linux命令和工具的軟體,他甚至還整合了一個http伺服器和一個telnet伺服器,而所有這一切功能卻只有區區1M左右的大小.我們平時用的那些linux命令就好比是分立式的電子元件,而BusyBox就好比是一個整合電路,把常用的工具和命令整合壓縮在一個可執行檔裡,功能基本不變,而大小卻小很多倍,在嵌入式linux應用中,BusyBox有非常廣的應用,另外,大多數linux發行版的安裝程式中都有BusyBox的身影,安裝linux的時候按ctrl+alt+F2就能得到一個控制台,而這個控制台中的所有命令都是指向BusyBox的連結.

配置BusyBox

[root@localhost Desktop]# tar jxvf busybox-1.13.0.tar.bz2[root@localhost Desktop]# cd busybox-1.13.0[root@localhost busybox-1.13.0]#make menuconfig   [*] Build Busybox as a static binary (noshared libs)busyboxsettings->busybox library tuning->username completion、fancy shell promptsmake menuconfig設定CROSS COMPILE為arm-linux-installoptin-->     [*] Don't use /usr 防止編譯後產生的檔案安裝到主機的/usr目錄下,改變了主機的系統make install即可在_install目錄下產生bin sbin及其linuxrc檔案(該檔案連結到/bin/busybox)。

安裝

將bin sbin及其linuxrc複製到檔案系統中(直接覆蓋,以前lib中的庫檔案不需要啦!)。

/etc目錄下的設定檔

/etc/inittab的內容如下:

::sysinit:/etc/init.d/rcS::respawn:-/bin/sh#tty1::askfirst:-/bin/sh::ctrlaltdel:/bin/umount -a –r

/etc/fstab的內容如下:

/dev/sda2   /         ext3  defaults   0   0/dev/sda1  /boot     ext3   defaults  0   0sysfs      /sys      sysfs  defaults  0   0proc       /proc     proc   defaults  0   0tmpfs      /tmp      tmpfs  defaults  0   0tmpfs      /dev      tmpfs  defaults  0   0var        /dev      tmpfs  defaults  0   0

/etc/init.d的內容如下:

#! /bin/sh /bin/mount –a

測試

效果如所示:













相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.