This article is transferred from the iTOP-4412 Development Board real-combat tutorial Books
Http://www.topeetboard.com
Not only can the ITOP-4412 board run Android, but it can also run a simple Linux minimum file system.
Minimal Linux system "small, perfectly formed", it does not have a graphical interface of the Linux system, eliminating the interference factor is easy to understand, to learn the Linux system programming is very appropriate.
In addition, the Linux minimum system occupies very little memory space and is often used for projects without a graphical interface.
1. Introduction to the minimum Linux system
Creating a file system requires the use of the BusyBox tool.
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, and Echo, among others, including larger, more complex tools, such as grep, find, Mount, and Telnet. Some people refer to BusyBox as 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 are built into Linux, and also includes the Linux system's own shell.
BusyBox Download URL is http://www.busybox.net/, this is an open source program, and has been in the update, the version used here is busybox-1.21.1.tar.bz2.
2. Configure the minimum system
In the virtual machine's Ubuntu directory "Home" under the new directory "MkDir minilinux", this directory can be established according to personal habits, not mandatory requirements.
Copy busybox-1.21.1.tar.bz2 (this software under the corresponding experimental video directory file) to the virtual machine's Ubuntu system directory "/home/minilinux", and then under the directory "/home/minilinux", perform the decompression command " TAR-XVF busybox-1.21.1.tar.bz2 "Unzip, into the extracted busybox-1.22.1 directory.
The BusyBox compiler configuration and the Linux kernel compilation configuration use the same commands, the following configuration BusyBox, as shown, using the command "Make Menuconfig", will appear BusyBox configuration interface, as shown in.
Select BusyBox Settings to enter the BusyBox Settings interface.
Then go to the build optiions-> cross Compiler prefix Configuration interface, which is specifying what compiler to compile, and the input used by the crossover compiler tool "arm-none-linux-gnueabi-".
Then go back to the BusyBox settings Setup interface, go to the Installation Options configuration screen, select BusyBox installation prefix, then go to busybox installation Prefix Configuration interface (this interface is set to compile the BusyBox, the final generated binaries installed under which directory).
Delete the default./_install inside, and then enter ".. /system "(the resulting binaries will be installed in the system directory at the top-level directory in the current directory).
Exit the Menuconfig configuration interface and save the configuration.
3. Compiling and installing
BusyBox configuration is complete, next compile BusyBox, in Ubuntu terminal input make command to start compiling busybox.
Once the compilation is complete, you will need to install the compiled binaries to the specified. /system directory, use the command "make install" to install binary files to ". /system "directory. Open the. /system "directory, you can see the installed files as shown in.
4.PerfectMinimum system
This section describes how to add the network files, user files, libraries, and so on that are required by the minimum system.
Under the system directory, use the command "mkdir Dev etc lib mnt proc Sys tmp var" to create the folder.
Go to the ETC folder that you just created, create the eth0-setting file in the ETC directory, and enter the following content in the Eth0-setting file, and then change the permission bit 755 after saving.
ip=192.168.1.230
mask=255.255.255.0
gateway=192.168.1.1
dns=192.168.1.1
Mac=08:90:90:90:90:90
In the ETC directory, set up the Init.d folder, go to the Init.d folder, create a Ifconfig-eth0 file under the Init.d folder, and then enter the following content in the Ifconfig-eth0 file. Save and exit, modify the Ifconfig-eth0 file's permission bit 755.
#!/bin/sh
Echo-n Try to bring eth0 interface Up......>/dev/ttysac2
if [-f/etc/eth0-setting]; Then
Source/etc/eth0-setting
If Grep-q "^/dev/root/nfs"/ETC/MTAB; Then
Echo-n NFS root ... >/dev/ttysac2
Else
Ifconfig eth0 Down
ifconfig eth0 hw ether $MAC
Ifconfig eth0 $IP netmask $Mask up
Route add default GW $Gateway
Fi
echo nameserver $DNS >/etc/resolv.conf
Else
If Grep-q "^/dev/root/nfs"/ETC/MTAB; Then
Echo-n NFS root ... >/dev/ttysac2
Else
/sbin/ifconfig eth0 192.168.253.12 netmask 255.255.255.0 up
Fi
Fi
echo Done >/dev/ttysac2
Then create the RCS file under the Init.d folder, enter the following content in the RCS file, save and exit RCS, and modify the RCS permissions to 755.
#! /bin/sh
Path=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:
Runlevel=s
Prevlevel=n
Umask 022
Export PATH runlevel Prevlevel
#
# Trap Ctrl-c &c only in this shell so we can interrupt subprocesses.
#
Trap ":" INT QUIT TSTP
/bin/hostname iTOP-4412
#/bin/mount-n-T proc None/proc
#/bin/mount-n-T Sysfs None/sys
#/bin/mount-n-T Usbfs none/proc/bus/usb
#/bin/mount-t Ramfs None/dev
[-E/PROC/1] | | /bin/mount-n-T proc None/proc
[-e/sys/class] | | /bin/mount-n-T Sysfs None/sys
[-e/dev/tty] | | /bin/mount-t Ramfs None/dev
Echo/sbin/mdev >/proc/sys/kernel/hotplug
/sbin/mdev-s
#/bin/hotplug
# mounting File system specified In/etc/fstab
Mkdir-p/dev/pts
Mkdir-p/DEV/SHM
/bin/mount-n-T devpts none/dev/pts-o mode=0622
/bin/mount-n-T Tmpfs tmpfs/dev/shm
#/bin/mount-n-T Ramfs none/tmp
#/bin/mount-n-T Ramfs None/var
Mkdir-p/var/empty
Mkdir-p/var/log
Mkdir-p/var/log/boa
Mkdir-p/var/lock
Mkdir-p/var/run
Mkdir-p/var/tmp
Ln-sf/dev/ttys2/dev/tty2
Ln-sf/dev/ttys2/dev/tty3
Ln-sf/dev/ttys2/dev/tty4
Syslogd
/etc/rc.d/init.d/netd start
echo "" >/dev/tty1
echo "Starting networking ..." >/dev/tty1
#sleep 1
#/etc/rc.d/init.d/httpd start
#echo "" >/dev/tty1
#echo "Starting Web server ..." >/dev/tty1
#sleep 1
#/etc/rc.d/init.d/leds start
#echo "" >/dev/tty1
#echo "Starting LEDs service ..." >/dev/tty1
#echo ""
#sleep 1
#echo "*************************************" >/dev/ttysac2
#echo "http://www.topeet.com.cn" >/dev/ttysac2
#echo "*************************************" >/dev/ttysac2
#echo "*************************************"
#echo "http://www.topeet.com.cn"
#echo "*************************************"
Mkdir/mnt/disk
Sleep 1
/sbin/ifconfig Lo 127.0.0.1
/etc/init.d/ifconfig-eth0
Return to INIT.D, etc, next in the ETC directory to establish the file passwd, as shown, save and exit, modify the passwd permissions to 755.
Root::0:0:root:/:/bin/sh
Bin:*:1:1:bin:/bin:
Daemon:*:2:2:daemon:/sbin:
nobody:*:99:99:nobody:/:
Then, in the ETC directory to establish the profile file, the following content input, save and exit, modify the profile of the permissions of 755.
# Ash Profile
# Vim:syntax=sh
# No core Files by default
Ulimit-s-C 0 >/dev/null 2>&1
User= "' Id-un '"
Logname= $USER
Ps1= ' [[email protected] $HOSTNAME]# '
Path= $PATH
Hostname= '/bin/hostname '
Export USER LOGNAME PS1 PATH
Next in the ETC directory to set up a folder Rc.d, go to the Rc.d folder you just created. Set up the Init.d folder under the RC.D directory and enter the INIT.D folder. Then in the Init.d folder, create the netd file, enter the following in the netd file. Save and exit netd, modify the permissions for netd to 755.
#!/bin/sh
Base=inetd
# See how we were called.
Case "$" in
Start
/usr/sbin/$base
;;
Stop
Pid= '/bin/pidof $base '
If [-N "$pid"]; Then
Kill-9 $pid
Fi
;;
Esac
Exit 0
Enter the System/lib directory. Because the cross-compilation environment used is the same as the compiled kernel, the compiler runs as a/usr/local/arm/arm-2009q3,busybox compiled binary 11 dynamic-link library, so you need to copy the library files from the compiler to the Lib directory, using the command
"cp/usr/local/arm/arm-2009q3/arm-none-linux-gnueabi/libc/lib/*./" Copy.
After the library file copy is complete, return to the System/var directory and build the Lib,lock,log,run,tmp five directory under the Var directory. At this point, the files required by the file system have been created.
5.installing packaged software and compiling
Packaging tools Make_ext4fs can be made into binary files system, first to install the Make_ext4fs tool.
Copy the compression package "linux_tools.tgz" to the Ubuntu system "/" directory and then extract, note that the directory is "/", if the previous in the compilation of Qte has been decompressed, here can jump over. After you have installed the package compilation tool "Make_ext4fs".
Use the command to enter the directory "/home/minilinux/", using the command
The "make_ext4fs-s-l 314572800-a root-l Linux system.img system" generates a SYSTEM.IMG filesystem image as shown in.
The production of the Linux file system has now been completed.
6.MinimumLinuxsystem Burn-Write
In the end, we need to write the system.img to the iTOP-4412 Development Board, burning the same way as the Android file system burning write.
Uboot files without burning, is generic, kernel zimage and ramdisk-uboot.img files using Qte can.
[Embedded Development Primer]4412 Development Board build Linux minimum system from zero