BusyBox preparation before building the system
First installation:
To resolve BusyBox compilation error: Fatal error:curse.h error is due to missing suite ncurses devel
Apt-get Install Libncurses5-dev
problems can be solved;
Step two: Download ARM-LINUX-GCC installation, this is based on the arm architecture of the Linux Platform Cross-compilation tool, download arm-linux-gcc-4.4.3 version
1, TAR-ZXVF arm-linux-gcc-4.4.3.tar.gz-c/
2, in the terminal sudo VIM/ROOT/.BASHRC last line fills in
Export path= $PATH:/opt/tools/4.4.3/bi
3, install the compatible library
sudo apt-get install G++-muitilib
Source/root/.bashrc
4. Test Arm-linux-gcc-v
Third Step Download
Download the BusyBox source package, the latest version is busybox-1.15.0
http://www.busybox.net/downloads/
Unpack and enter the directory:
# tar JXVF busybox-1.15.0.tar.bz2
# CD busybox-1.15.0
Modify Makefile:
# gedit Makefile &
Change the 164 lines to:
Cross_compile = arm-linux-
Change the 189 lines to:
ARCH = Arm
Configuration:
# Make Menuconfig
Enter BusyBox directory
Vim Makefile
the Arch? = $ (Subarch) is modified to
ARCH? = Arm
cross_compile? = modified to
cross_compile? = arm-linux-
3. Execute source/etc/profile to make the compiler effective
4. Make menuconfig configuration busybox option:
A. Enter Busybox Settingsà
Build options->
Select "Build BusyBox as a static binary", Static link
Cross Compiler prefix (arm-linux-)
Installation options->
Select ' Don ' t use/usr to avoid busybox being installed into the host system's/usr directory and to destroy the host system
Busybox installation Prefix (/XXX/ROOTFS)
This option indicates the installation location of the compiled BusyBox
Select the following:
Busybox Settings---> Build Options---> [*] Build BusyBox as a static binary (no shared libs) [*] Build and Large File Support (for accessing files > 2 GB) Busybox Library Tuning---> [*] Vi-style Line Editing commands [*] Fancy Shell Prompts Linux Module Utilities---> [] Simplified Modutils [*] Insmod [*] Rmmod [*] Lsmod [*] Modprobe [*] Depmod |
Exit and save the configuration.
Compile:
# make
Installation:
# make Install
The _install subdirectory can be found in the busybox-1.15.0 directory, which is just the installation directory.
(ii) Add the necessary directories and documents
Renamed to minimized root file system directory:
# MV _install Mini_rootfs
Enter the minimized root file system directory:
# CD Mini_rootfs
Create a script file named create_rootfs.sh in the Mini_rootfs directory:
#!/bin/sh
#root dir mkdir bin sbin lib etc dev sys proc tmp var opt mnt usr home root media
#usr Sub Dir CD usr mkdir bin Sbin Lib Local #usr/local Sub Dir CD Local mkdir bin Sbin Lib Cd.. /..
#etc Sub Dir CDS etc Touch Inittab Touch Fstab Touch profile Touch passwd Touch Group Touch Shadow Touch resolv.conf Touch mdev.conf Touch inetd.conf mkdir RC.D mkdir INIT.D Touch Init.d/rcs chmod +x Init.d/rcs mkdir Sysconfig Touch Sysconfig/hostname Cd..
#dev Sub Dir CD Dev Mknod Console C 5 1 chmod 777 Console Mknod NULL C 1 3 chmod 777 NULL Cd..
#var Sub Dir CD var mkdir Log Cd.. |
Add executable permissions to the create_rootfs.sh script:
# chmod +x create_rootfs.sh
Execute the script to generate the directories and files needed to minimize the root file system:
#./create_rootfs.sh
Copy the dynamic link library in the cross compiler to the Lib and usr/lib directory of the minimized root file system:
# cp-f/opt/arm-2009q1/arm-none-linux-gnueabi/libc/armv4t/lib/*so* lib-a
# cp-f/opt/arm-2009q1/arm-none-linux-gnueabi/libc/armv4t/usr/lib/*so* usr/lib-a
The contents of the Etc/fatab file are:
#/etc/fstab:static File System information. # # use ' vol_id--uuid ' to print the universally unique identifier for a # device; This May is used with uuid= as a and robust way to name devices # that works even if disks are added and removed. Fstab (5). # # <file system> <mount point> <type> <options> <dump> <pass> PROC/PROC proc Defaults 0 0 Sysfs/sys Sysfs Defaults 0 0 Tmpfs/var TMPFS Defaults 0 0 Tmpfs/tmp TMPFS Defaults 0 0 Tmpfs/dev TMPFS Defaults 0 0 |
The contents of the Etc/inittab file are:
:: Sysinit:/etc/init.d/rcs S3c2410_serial0::askfirst:-/bin/sh :: Ctrlaltdel:-/sbin/reboot :: Shutdown:/bin/umount-a-R :: Restart:/sbin/init |
The contents of the Etc/profile file are:
# Ash Profile # Vim:syntax=sh
# No core Files by default Ulimit-s-C 0 >/dev/null 2>&1
User= "' Id-un '" Logname= $USER Ps1= ' [\u@\h \w]\# ' Path= $PATH
Hostname= '/bin/hostname '
Export USER LOGNAME PS1 PATH
Export Ld_library_path=lib:/usr/lib: $LD _library_path
|
The contents of the Etc/init.d/rcs file are:
#!/bin/sh Path=/sbin:/bin:/usr/sbin:/usr/bin
Runlevel=s Prevlevel=n
Umask 022
Export PATH runlevel Prevlevel
Mount-a
Mkdir/dev/pts Mount-t devpts devpts/dev/pts Echo/sbin/mdev >/proc/sys/kernel/hotplug Mdev-s
/bin/hostname-f/etc/sysconfig/hostname
Ifconfig eth0 192.168.0.80 |
The contents of the resolv.conf file are:
NameServer 202.96.128.166 |
ETC/INETD.COF is the inetd configuration file, which reads:
# It is generally considered safer to keep. echo Stream TCP nowait root internal echo dgram UDP wait root internal Daytime stream TCP nowait root internal Daytime Dgram UDP Wait root internal Time stream TCP nowait root internal Time Dgram UDP Wait root internal
# These are standard services. FTP stream TCP nowait ROOT/USR/SBIN/TCPD in.ftpd Telnet Stream TCP nowait root/sbin/telnetd/sbin/telnetd |
The content of the Etc/sysconfig/hostname file is your English name.
The contents of the ETC/PASSWD, Etc/group, Etc/shadow files are empty.
Etc/mdev.conf is the Mdev device file system configuration file, you can refer to:
The use of Mdev under BusyBox and the rule configuration of mdev.conf
Mdev realize automatic mount of U disk and SD card
OK, kind of a good ~ ~
III) User Management
After the file system is working properly, use the AddUser command:
# AddUser Root
Will print out the following message:
Passwd:unknown UID 0
This means that you cannot set a password for the user, and you will find that the passwd command is not available.
The workaround is to open the/etc/passwd file, which reads:
Root:x:1000:1000:linux user...:/home/root:/bin/sh
Modify both the user ID and the group ID to 0.
Open the/etc/group file, which reads:
root:x:1000:
Also modify the group ID to 0.
The passwd command can then be used normally.
Then set the password for the root user:
# passwd Root
Enter the password according to the prompts.
This is what I do. A compressed package that minimizes the root file system:
|
File: |
Mini_rootfs.tar.gz |
Size: |
2971KB |
Download: |
Download |
|
Extract:
# tar ZXVF mini_rootfs.tar.gz
The second type:
Step 1: Building the directory structure