HK-2000 OEM Development Board busybox Compilation Method

Source: Internet
Author: User
Tags gz file
What is busybox?
In terms of name, busybox is a "busy box". In fact, busybox can be understood as a Linux Command set.

Commands can be found in busybox, but busybox does not simply aggregate all commands together. It uses a very clever way, that is, "UseProgramCompleted

".
We usually use commands such as LS and VI to call glibc. Therefore, if each command is statically linked to these calls, each command will be very large, therefore, in normal releases,

Glibc will be dynamically linked, but the glibc dynamic library itself is very large, which is acceptable in PC + LINUX, but in embedded systems, this is too big, and not all

Library functions are used.
Generally, two solutions are used. One is to crop glibc, and the other is to use busybox. That is, the main functions of LS, VI, and other programs are all linked together, then static

Link glibc. In this way, only calls are required to link in. The entire busybox program may be smaller than the dynamic library of glibc.
Therefore, the working principle of busybox is to determine the program that the user wants to call based on the file name. For example, if the file name of your busybox program is LS, it runs LS and VI,

Run VI.
We provide busybox1.00 source code in the HK-2000 OEM system, users can add some common commands to the system during use. The source code is on the CD:

\ Develop \ Linux \ busybox.
The compilation and usage steps are described as follows:
1. Compile busybox
Copy the file busybox-1.00.tar.gz to the/home/work directory of the Linux server and run the following command to decompress the file:
# Tar xzvf AT91RM9200-busybox-1.00.tar.gz
After the file is decompressed, The busybox-1.00 directory will be automatically generated, enter the directory, and execute the following command to compile:
# Make clean; clear old compilation files
# Make menuconfig
After executing this command, go to the configuration main menu.
First, go to the menu build options and select "do you want to build busybox with a cross compiler ?" Option, and in the "Cross Compiler prefix" column

Enter the cross-compiler installation location, for example,/usr/local/ARM/2.95.3/bin/ARM-Linux-. Note that the last part is arm-Linux-. Other characters or spaces are not allowed.
In the "any extra cflags options for the compiler" column, enter the position of the header file in the source code directory of the arm-Linux system to be matched, as shown in figure

'/Home/Works/linux-2.4.27/include' and then exit the return to the main menu.
Then, go to the sub-menu where the required command tool is located and select the corresponding command item. If you need the "insmod" command, go to the "LINUX module utilities" sub-menu.

.
After selecting all the required commands, save the configuration file and exit, and execute the following command to compile:
# Make
# Make install
After the command is executed, the "_ install" Directory will be generated in the current directory. You can see four subdirectories: Bin, linuxrc, sbin, and USR.
2. Add the compilation result to ramdisk.
Create a new directory tmpin the/home/workcatalog. Run the following command to decompress the original ramdisk.gz file and mount it to the directory:
# Gunzip ramdisk.gz
# Mkdir TMP
# Mount-o loop ramdisk TMP
Run the following command to copy the files in the _ isntall directory to the tmp directory to overwrite the original files in ramdisk:
# Cp-AF/home/work/busybox-1.00/_ install/*/home/work/tmp
After the copy is complete, use the image file creation tool mkfs. jffs2 (in CD: \ Software \ tools) provided by the system to generate the jffs2 image file. The command is as follows:
#./Mkfs. jffs2-D./tmp-O jffs2.img
Then execute the following commands:
# Umount/home/work/tmp
# Gzip ramdisk
When all operations are completed, the new ramdisk.gz and jffs2.img files can be generated.
Note: The preceding operations may require the permissions of the Super User.

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.