When we 've worked so hard to compile Linux using scripts, What do you find the most troublesome?
Well, you may already have some experience, that is, placing various commands in your own small system, not only putting commands, but also porting the corresponding library files of commands. This is a huge Linux system, so many commands are transplanted ...... Maybe you forgot one day ......
To solve this problem, magio recommended a tool: busybox ......
Of course, when I first heard it, I thought it was a rap group -. -
Well, what is busybox?
Busybox is a Pandora magic box that can create all the commands you want to use. And the commands made here are just as domineering as the real commands! It is as small as a Swiss Army knife, but has extremely rich functions.
You may have noticed that I use the word "Manufacturing". Why is it manufacturing?
Because, after you correctly install busy, all the commands you use are actually using the busybox command, except that the busybox command can be used as LS, it can also be ECHO or free ......
Well, let's take a look at the real face of busybox:
We downloaded busybox 1.16.1 from our FTP server.
wget ftp://192.168.0.254/pub/Sources/Busybox/busybox-1.16.1.tar.bz2
Then, we put it in the folder we are going to install.
mkdir /tmp/bzboxcp busybox-1.16.1.tar.bz2 /tmp/bzboxcd /tmp/bzbox
Okay. Unzip the package.
tar vxf ./busybox-1.16.1.tar.bz2cd busybox-1.16.1
Busybox provides us with a detailed configuration list. We can develop our own:
make menuconfig
We can define how busybox works for us based on our own needs.
After setting, you can
makemake install
This provides the binary file of busybox that can be called. The next step is to build an environment around busybox, including the symbolic link to redirect standard Linux commands to the busybox binary file.
By default, this creates a local subdirectory named _ install, which contains the basic Linux environment. In this root directory, you will findlinuxrc
Program. Thislinuxrc
The program is useful when building an installation disk or an emergency disk (which allows modular guidance in advance. In the same root directory, there is also a binary file containing the Operating System
/Sbin sub-directory. There is also a/bin directory that contains user binary files. When building a floppy release or embedded initial RAM disk, We can migrate the _ install directory to the target environment. We can also use the make program'sPREFIX
Option to redirect the installation directory to another location.
Finally, let's look at the options supported by make in busybox:
help |
Show the complete list of make options |
defconfig |
Enable default (general) Configuration |
allnoconfig |
Disable all applications (empty configuration) |
allyesconfig |
Enable all applications (full configuration) |
allbareconfig |
Enable all applications without sub-Features |
config |
Text-based configuration tools |
menuconfig |
N-Curses (menu-based) Configuration Tool |
all |
Compile busybox binary files and documents (./docs) |
busybox |
Compile the busybox binary file |
clean |
Clear source code tree |
distclean |
Thoroughly clear the source code tree |
sizes |
Display the text/data size of the enabled application |
Then we will see a variety of commands on small Linux ~!
Although they are all linked files, they are almost no different from the real commands !~
Busybox, a useful tool for installing the system. I hope you will learn how to install, debug, and use it.