Compile the busybox File System

Source: Internet
Author: User
[Original] compile the busybox File System

 

I. Environment
Ubuntu 8.04
Arm-Linux-GCC 3.4.5
Busybox-1.1.3

Ii. busybox File System
1. Download busybox1.1.3 (http://www.busybox.net/) and unzip it.
2. Go to the decompressed directory and configure busybox

# Make menuconfig

Busybox Settings>

General configuration>
[*] Support for devfs

Init utilities>
[*] Init
[*] Support reading an inittab file/* supports init to read the/etc/inittab configuration file, which must be selected */
[*] Be _ extra _ quiet on boot
[*] Support running init from within an initrd (not initramfs)
[*] Poweroff, halt, and reboot
[*] Mesg

Shells>

Choose your default shell (Ash)>
/* (X) ash select ash to generate the bin/sh file only when it is generated.
* Let's look at the first line of the linuxrc script:
*#! /Bin/sh is interpreted and executed by bin/sh.
*/(Because I didn't select it here, the startup will fail)
[*] Ash

Add history records, auto-completion, and delete characters:
Shells --->
--- Bourne shell options
[] Hide message on Interactive Shell startup
[] Standalone Shell
[*] Command line editing
[*] Vi-style line editing commands
(15) History Size
[*] History saving
[*] Tab completion
[*] Username completion
[] Fancy shell prompts

Coreutils>
[*] CP
[*] Cat
[*] Ls
[*] Mkdir
[*] Echo (Basic susv3 version taking no options)
[*] Env
[*] Mv
[*] Pwd
[*] RM
[*] Touch

Editors>
[*] Vi

Linux system utilities>
[*] Mount
[*] Umount
[*] Support loopback mounts
[*] Support for the old/etc/mtab File

LINUX module utilities --->
[*] Insmod
[*] Rmmod
[*] Lsmod
[*] Lsmod pretty output for 2.6.x linux kernels
[*] Modprobe
[*] Multiple options Parsing
--- Options common to multiple modutils
[*] Support tainted module checking with new kernels
[] Support version 2.2.x to 2.4.x linux kernels // do not select this option !!!
[*] Support version 2.6.x linux kernels

Networking utilities>
[*] Ifconfig
[*] Ping

Archival utilities --->
[*] Tar
[*] Enable archive creation (new)
[*] Enable-J option to handle .tar.bz2 files

Note: You can select commands as needed.

3, if the file system runs on 2410, do not need to modify the source code, if running on 2440, need to busybox-1.1.3/init. c In
Two places
Close (0 );
Close (1 );
Close (2 );
Comment out:
/* Clean up */
// Close (0 );
// Close (1 );
// Close (2 );

/* Close whatever files are open, and reset the console .*/
// Close (0 );
// Close (1 );
// Close (2 );
4. Compile and install busybox. (arch and cross content is not set in makefile 1.1.3. You need to write them in the command. I did this)

# Export Path = $ path: usr/crosstool/gcc-3.4.5-glibc-2.3.6/ARM-Linux/bin
# Make target_arch = arm cross = "arm-Linux -"
# Make install

5. Create a root file system structure
# Cd ~
# Mkdir rootfs
# Cd rootfs
# Mkdir bin Dev etc lib proc sbin tmp usr var mnt
# Chmod 1777 TMP
# Mkdir usr/bin usr/lib usr/sbin
# Mkdir var/lib var/lock var/log var/run var/tmp
# Mkdir etc/init. d
# Chmod 1777 var/tmp
Copy all files in the busybox1.1.3/_ install/directory to overwrite the empty folder in the rootfs folder.

In Lib, some library files need to be merged. below, only some common libraries are provided.
# Cd rootfs/lib
# Cp-RfD/usr/crosstool/gcc-3.4.5-glibc-2.3.6/ARM-Linux/lib/LD *./
# Cp-RfD/usr/crosstool/gcc-3.4.5-glibc-2.3.6/ARM-Linux/lib/libc-2.3.6.so ./
# Cp-RfD/usr/crosstool/gcc-3.4.5-glibc-2.3.6/ARM-Linux/lib/libc. so.6 ./
# Cp-RfD/usr/crosstool/gcc-3.4.5-glibc-2.3.6/ARM-Linux/lib/libm *./
# Cp-RfD/usr/crosstool/gcc-3.4.5-glibc-2.3.6/ARM-Linux/lib/libcrypt *./
Of course, you can put all the cross-compiled libraries in for convenience, but this will increase the volume of the file system.
# Cp-RfD/usr/crosstool/gcc-3.4.5-glibc-2.3.6/ARM-Linux/lib/*./(note-D to keep the link between library files)

6. Create etc/init. d/RCS
#! /Bin/sh
Echo "running/etc/init. d/RCS"
Echo "mount the/proc file system"
/Bin/Mount-T proc/proc

Echo "Mount tmpfs filesystem to/tmp"
/Bin/Mount-T tmpfs NONE/tmp

Echo "Mount ramfs filesystem to/Var"
/Bin/Mount-T ramfs NONE/var

Then modify the permission: chmod 775 RCS

7. Create ETC/inittab
# This is run first packet t when booting
Console: sysinit:/etc/init. d/RCS
# Start an "askfirst" shell on the console
#: Askfirst:-/bin/bash
Console: askfirst:-/bin/sh
# Stuff to do when restarting the INIT process
: Restart:/sbin/init
# Stuff to do before rebooting
: Ctrlaltdel:/sbin/reboot
: Shutdown:/bin/umount-a-r
Note: All the kernel source code Drivers/Char/tty_io.c must be
Change noctty = 1 to noctty = 0

8. Create etc/fstab again.
None/proc defaults 0 0
None/dev/PTS devpts mode = "0622" 0 0
Tmpfs/dev/SHM tmpfs defaults 0 0

At this point, the root file system has been created.

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.