"Go" embedded Linux boot configuration files and scripts

Source: Internet
Author: User

Original URL: http://blog.csdn.net/shuaishuai80/article/details/6202497

The/etc directory is very important when using BusyBox to make the root file system, which contains the configuration files and scripts required for embedded Linux boot. Because of the init process, or the LINUXRC program will parse the Inittab file, start with the/etc/inittab file .
(1) file/etc/inittab
This file is the file that the Init process needs to parse, each of its entries is a script or executable program, see the blog "Inittab file".

     ::sysinit:/etc/init.d/rcS
     ::respawn:-/bin/login
     ::ctrlaltdel:/bin/umount -a -r

(2) file/etc/init.d/rcs
There are two main functions of the file, one is to attach different file systems to a directory under the root file system, and the other is the directories required for the new kernel, which are necessary for the kernel to run.

#! /bin/sh

/bin/mount-n-T Ramfs ramfs/var #在不同的目录内挂载不同的文件系统
/bin/mount-n-T Ramfs ramfs/tmp
/bin/mount-n-T Sysfs None/sys
/bin/mount-n-T Ramfs None/dev
#在不同的目录内新建文件夹
/bin/mkdir/var/tmp
/bin/mkdir/var/modules
/bin/mkdir/var/run
/bin/mkdir/var/log
#在不同的目录内递归新建文件夹
/bin/mkdir-p/dev/pts
/bin/mkdir-p/DEV/SHM

/sbin/mdev-s
/bin/mount-a #当执行命令 "Mount-a", the system automatically reads the configuration file fstab.
Echo/sbin/mdev >/proc/sys/kernel/hotplug

(3) file/etc/fstab
When Mount–a is executed in file/etc/init.d/rcs, the corresponding file system is mounted according to the file/etc/fstab content.

         proc        /proc        proc      defaults   0 0
         none        /dev/pts    devpts     mode=0622  0 0
        tmpfs        /dev/shm    tmpfs     defaults    0 0

<1> fstab file format:
   device mount point filesystem parameters  dump fsck
    proc   /proc      proc     defaults   0    0
<2> file/etc/ Fstab is the command content required to load a device into a system's load point using mount, which is written into the/etc/fstab, allowing the system to load proactively as soon as it is started.
<3> The value of the parameter dump indicates whether the dump command is allowed to be used for system backups. The dump command is based on the set value of the/etc/fstab. Select whether you want to back up the partition. 0 means do not dump backup, 1 or 2 means dump backup.
<4> The value of the parameter fsck indicates whether FSCK is allowed to verify the integrity of the file system within the partition. Where the root filesystem must be inspected, other file systems may not need to be inspected. 0 means no test, 1 or 2 indicates that a test is to be performed.

(4) File/etc/passwd
When the user logs on to the host with telnet or SSH, a login screen will appear to enter the account, and after entering the account and password, Linux will perform the following actions:
<1> First find the/etc/passwd within the account, if so, then the account with the corresponding UID (user ID) and GID (Group ID) read out, and the home directory of the account and shell settings are also read out.
<2> Check the password list, at which time Linux will go into the/etc/shadow to find the corresponding account and UID, and then check the password entered is consistent with the password inside.
<3> If all matches, enter the shell control phase.
Here is a brief description of the meaning of these two documents respectively.
<1>/etc/passwd

root:x:0:0:root:/root:/bin/sh

The file is constructed as shown above, each line represents an account, and a few lines indicate that there are several accounts in the system. Note that many of the accounts in the system must be used, called the system account. In each Linux system there will be the first row, the root system administrator row, each line has 7 parts, separated by ":".
1.Account Name: Root indicates the default system administrator's account name.
2.Password: x indicates that the password has been moved to shadow in this encrypted file.
3.UID: When uid=0, indicates root
4.GID: Related to/etc/group, used to standardize user groups.
5.User Information Description bar: Used to explain the meaning of the account.
6.Home directory: The user's home directory. The root user's home directory is/root.
7.Shell: Use/bin/bash to execute commands by default. <2>/etc/shadow

root:$1$HNeU8jpc$RyzTN856sZiO.LCN2BZuZ0:14880:0:99999:7:::

This file belongs to the encrypted file, each account password is in the file, here no longer repeat. (5)/etc/profle

    echo
    echo -n "Processing /etc/profile... "
    # no-op
    echo "Done"
    echo
    PATH=/bin:/sbin:/usr/bin:/usr/sbin
    export LD_LIBRARY_PATH=/lib:/usr/lib

"Go" embedded Linux boot configuration files and scripts

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.