Build a mini Linux from scratch (4)

Source: Internet
Author: User


16. Compiling BusyBox

17. Provide Inittab file

18. Provide initialization scripts

19. Seventh Test Start


16. Compiling BusyBox


BusyBox Introduction BusyBox is a software that integrates more than 100 of the most commonly used Linux commands and tools.    BusyBox includes simple tools such as LS, Cat, Echo, and more, and includes larger, more complex tools such as grep, find, Mount, and Telnet. Some people call BusyBox the Swiss Army Knife in the Linux tool.  Simply speaking, BusyBox is like a big toolbox, which integrates many of the tools and commands that have been built into Linux, as well as the self-contained shell of the Android system. ---source Baidu Encyclopedia


[Email protected] ~]# tar xf busybox-1.22.1.tar.bz2 [[email protected] ~]# CD Busybox-1.22.1[[email protected] busybox-1. 22.1]# less install[[email protected] busybox-1.22.1]# make menuconfig//statically compile BusyBox Settings--->build Options---&  Gt [*] Build BusyBox as a static binary (no shared libs) installation Options ("Make Install" behavior)---> (./_install) Bus Ybox installation prefix [[email protected] busybox-1.22.1]# make && make install


Delete the directory under/mnt/sysroot and restart the test from the beginning

[Email protected] busybox-1.22.1]# rm-rf/mnt/sysroot/*


[[email protected] busybox-1.22.1]# ls _install/bin linuxrc sbin usr//file generated after successful compilation [[email protected] busybox-1.22.1]# C P-a _install/*/mnt/sysroot/[[email protected] busybox-1.22.1]# ls/mnt/sysroot/bin linuxrc sbin usr



Simple test

[[email protected] ~]# chroot/mnt/sysroot/chroot:failed to run command '/bin/bash ': No such file or Directory[[email Pro Tected] ~]# chroot/mnt/sysroot//bin/ash/#//most commands executed successfully



Create the appropriate directory

[[email protected] sysroot]# MKDIR-PV etc lib lib64 proc Sys Dev Root home boot mnt media tmp var




17. Provide Inittab file


BusyBox provides/sbin/init files, we can manually write the init configuration file/etc/inittab file (refer to the CentOS 5 series)

[[email protected] sysroot]# VIM Etc/inittab//Note is relative path:: Sysinit:/etc/rc.d/rc.sysinitconsole::respawn:-/bin/ash:: Ctrlaltdel:/sbin/reboot::shutdown:/bin/umount-a-R



18. Provide initialization scripts

[Email protected] sysroot]# mkdir etc/rc.d/[[email protected] sysroot]# vim etc/rc.d/rc.sysinit#!/bin/ash#echo-e "\  Twelcome to Sxj \033[32mmini\033[0m Linux "mount-t proc proc/procmount-t sysfs sysfs/sysmount-o remount,rw/dev/sda2 Add Execute permissions [[email protected] sysroot]# chmod +x etc/rc.d/rc.sysinit


19. Seventh Test Start


650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8B/67/wKioL1hN85uhWJlaAAACQj2_F10073.png-wh_500x0-wm_3 -wmp_4-s_302311515.png "style=" Float:none; "title=" 1.png "alt=" Wkiol1hn85uhwjlaaaacqj2_f10073.png-wh_50 "/>



650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8B/67/wKioL1hN85ygrJAfAAAhQu-Ql4M959.png-wh_500x0-wm_3 -wmp_4-s_61044927.png "style=" Float:none; "title=" 2.png "alt=" Wkiol1hn85ygrjafaaahqu-ql4m959.png-wh_50 "/>


Started successfully, and most of the commands are available


This article is from the "Homecoming" blog, make sure to keep this source http://sixijie123.blog.51cto.com/11880770/1881795

Build a mini Linux from scratch (4)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.