I. Overview
1.Minimum Linux System summary
We always talk about Linux system, but what exactly is Linux system? What is a minimal linux system?
An operating system is macroscopically divided into two parts: kernel and shell (core and shell).
The kernel is the operating system kernel. The shell is on top of the kernel and provides an interface for interacting with users, including CLI (command line interface) and GUI (graphical user interface). In addition, there are basic runtime libraries (such as C library, posix) and other basic software.
Minimal Linux System is an ultra-small system that uses the Linux system kernel and some necessary packages (programs, drivers, etc.) to replace a complex operating system. A minimal Linux system is a runtime environment that does not support multi-user mode, does not run the X graphical interface, only uses a server or terminal user interface, and only runs N. Minimal Linux systems can achieve good performance on low-power devices and facilitate the deployment of Linux systems into existing environments. Minimal Linux systems boot more quickly and configuration changes can be completed in less time.
The minimum Linux system consists ofkernel, root file system, user space, driver, etc.. The kernel is stored on disk as an executable program and is responsible for handling hardware requests and virtual memory management. The root file system is used to store system files, including system applications, user accounts, and file manager configuration files. User space includes some application compilers, such as GCC, and corresponding library functions that can be used to run applications in kernel space. Finally, the driver controls the hardware through the Linux system kernel to enable the normal operation of these devices.
Using a minimal Linux system is an easy way to get the best performance and reliability for a variety of devices. This is because it can efficiently utilize the resources of low-power devices, reduce the time required for installation and configuration, and reduce maintenance costs. In addition, it can use virtual machines to run multiple applications, as well as allow developers to dynamically deploy and debug applications, which helps them better take advantage of the flexibility and reliability of Linux systems.
In short, a minimal Linux system is an ultra-small, efficient, and reliable Linux system that can easily run on a variety of low-power devices, using virtual machines to run multiple applications, allowing developers to easily install and configure the system , as well as implement configuration changes, etc. in less time. Therefore, minimal Linux systems provide the best operating environment and performance for such devices, making them relatively stable solutions.
2. Busybox Tool introduction
Creating a file system requires the use of the Busybox tool. BusyBox is a software that integrates more than a hundred of the most commonly used linux commands and tools. BusyBox Contains some simple tools, such as ls, telnet, and mount , grep, findecho etc., as well as some larger and more complex tools, such as and cat BusyBox the Swiss Army Knife of Linux tools. Simply put, BusyBox is like a big toolbox. It integrates and compresses many tools and commands of Linux . Contains the Android system’s own shell.
The download URL for Busybox is http://www.busybox.net/. This is an open source program and is constantly being updated. , the version used here is busybox-1.22.1.tar.bz2.
Second,BusyBox Minimum production structure
1. Create Busybox in the virtual machine
tar -xvf busybox-1.22.1.tar.bz2
2. PlacementBusybox
The operation here is the same as the transplantation of the root file system.
Enter the busybox-1.22.1 directory, as shown in the figure below.
Modify some configurations shown in the figure below, save and exit. As shown below. Execute the following command " source /etc/profile " to make the compiler take effect. As shown below
source /etc/profile
Enter the Busybox root folder and open the Makefile with gedit, as shown below:
make menuconfig
As shown above, select Busybox Settings, and then press Enter to enter Busybox Settings interface, as shown below.
Enter the cross-compilation tool used arm-none-linux-gnueabi-, as shown below.
Then press Enter to return to the Build Options configuration interface. At this time, you can see the cross-compilation tool you just set, as shown below.
Then use the left and right keys of the keyboard to select Exit, as shown below.
Then press Enter to return to the Busybox Settings settings interface, as shown below.
SelectInstallation Options as shown above, then press Enter to enter Installation Options Configuration interface, is as shown below.
Delete./_install in the above picture, and then enter "../system", That is to say, the final generated binary file will be installed in the system directory under the directory one level above the current directory. Note two points, system a> as shown below.
Then press Enter, return toInstallation Options, then use the right arrow key on the keyboard to move the cursor to "Exit", and then press Press Enter and return to Busybox Settings. Use the right direction key on the keyboard to move the cursor to "Exit a>”, as shown below.
Then press Enter to save the configuration and exit the configuration interface. As shown below.
3. Japanese style BusyBox
NowBusybox configuration has been completed, now start compiling Busybox< a i=4>, enter the " make " command in the terminal of Ubuntu to start compilation Busybox, as shown below.
As shown below, the compilation is completed.
Now that the compilation is completed, you need to install the binary file generated by the compilation into the " ../system " directory just specified, use the command " < a i=2>make install ” Install the binary file to the “../system” directory, as shown below.
make install
As shown in the figure below, the execution is completed.
3.Perfect minimum Linux Series sentence case
mkdir dev etc lib mnt proc sys tmp var
Go to the etc folder you just created, as shown in the figure below.
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
Then save and exiteth0-setting, use " chmod 755 eth0-setting , as shown below. eth0- setting ” command modifies the permissions of
Use " mkdir init.d etc directory >" command to create the init.d folder, and use the command " cd init.d" command to enter < /span> folder, as shown in the figure below. init.d
Use " vim ifconfig-eth0< under the init.d folder a i=4>” command to create the ifconfig-eth0 file, as shown in the figure below.
#!/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 use " vim rcS ” command to create the rcS file, as shown below.
#! /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
Next, use the command “vim passwd etc directory 4>”Create file passwd, as shown below.
root::0:0:root:/:/bin/sh
bin:*:1:1:bin:/bin:
daemon:*:2:2:daemon:/sbin:
nobody:*:99:99:Nobody:/:
Then save and exitpasswd, use " chmod 755 passwd ” command to modify the permissions of passwd , as shown in the figure below.
Then use the command “ vim profile ” in etc Directory creation profile file, as shown in the figure below.
Then enter the following content in profile .
#Ash profile
#vim: syntax=sh
#No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`" LOGNAME=$USER
PS1='[$USER@$HOSTNAME] \w# '
PATH=$PATH
HOSTNAME=`/bin/hostname` export USER LOGNAME PS1 PATH
Then save and exitprofile, use " chmod 755 profile ” command to modify the permissions of profile , as shown in the figure below.
Next use the " mkdir rc.d " command in etc Directory creates folderrc.d, as shown in the figure below.
Then in the init.d folder, use “ vim netd ” command to create netd file, as shown in the figure below.
Then enter the following content in the netd file.
#!/bin/sh
base=inetd
# See how we were called. case "$1" in
start)
/usr/sbin/$base
;;
stop)
pid=`/bin/pidof $base`
if [ -n "$pid" ]; then
kill -9 $pid
fi
;;
esac
exit 0
Then save and exitnetd, use " chmod 755 netd ” command to modify the permissions of netd , as shown in the figure below.
Using adhesive “ cd ../../../ ” Command returned system Meme. Like below.
Then use the " cd lib " command to enter lib Directory, as shown below.
cp -P /usr/local/arm/arm-2009q3/arm-none-linux-gnueabi/libc/lib/* ./ -lr
The execution result is shown in the figure below.
After the library file copy is completed, use the " cd ../ var " command to enter the var directory in the upper directory system.
then used “ mkdir lib lock log run tmp ” instruction present var < a i=4>erect under the eye lib, lock, tmp 5th page , Shown below. , run, log
At this step, the folder "system" is created. As shown below.
4.Installation and packaging software and compilation
torture package “ linux_tools.tgz ” to Ubuntu Regular “/” Please note that “/ ”.
Note that the root directory cannot be copied and pasted directly. You can copy it to the desktop first and then use the copy command to copy to the root directory. As shown below, this is one of the methods for reference only.
Use the decompression command " tar -vxf linux_tools.tgz " to decompress, as shown in the figure below.
After installing the packaging and compilation tool “ make_ext4fs ”. Use the command " cd /home/minilinux/ " to enter the directory "/home/minilinux/", and then use the command " make_ext4fs -s -l 314572800 -a root -L linux system.img system ” generates system.img file System image, as shown below.
Then you can use the ls command to view the generated system.img.
So far, the production of linux file system has been completed, and the final generated binary file is system.img .
Five,Minimum Linux Linux
1. Brief introduction to Qt
2. Programming method and process
As shown in the figure below, enter the command:ext3format mmc 0:4
As shown in the figure below, in the HyperTerminal, enter the command:fastboot
(4) As shown below, you can find the applet "cmd.exe" of the user's own operating system.
As shown in the figure below, enter the flash system file system command: fastboot.exe flash system system.img
As shown in the figure below, enter the erase command:fastboot -w
Note: The above fastboot.exe flash commands can be executed separately, so that only a single image can be burned.
6) In the Windows command line, enter the restart development board command: fastboot reboot
So far, the Linux minimum system has been programmed. After restarting the development board, you will enter the minimum system non-graphical interface. The super terminal is as shown below:
The development board is as shown below, that is, the minimum Linux system has been successfully produced and programmed.