Solve the problem of environment variables after mounting the root file system

Source: Internet
Author: User
Solve the problem of environment variables after mounting the root file system-Linux general technology-Linux programming and kernel information. The following is a detailed description. Previously, after being started using a friendly file system through NFS, it was found that the/bin/qtopia script file and the environment variables set in the rfms did not work at all, today, I tried to add these environment variables to the/etc/profile file to solve the problem. In addition, I tried to delete linuxrc in the file system and found that the deletion had no effect. The deletion of/sbin/init is faulty.

In the file system, configuration files are mainly stored in the/etc directory. The file system described in the Linux full-line transplantation document based on S3C2410 has to use the/mnt/etc script because the/mnt/etc directory is copied to the/etc directory when the file system needs to be loaded, however, if this is the case, you need to set init =/linuxrc in the kernel transmission parameters, this is because the/sbin/init initialization script is started by default. (The linuxrc file generated after compilation and installation of busybox is the symbol file pointing to/bin/busybox. Delete it and rewrite the script by yourself ). This method is not used in my file system, so you do not need to set init =/linuxrc.

The Busybox init process is introduced in the book "building an embedded linux system". Here I will briefly describe it: if linuxrc is not used, the/sbin/init script (busybox init) will be executed. It will analyze the/etc/inittab script (if not, it will be replaced by the default one, generally, you do not need to write this script for it by yourself. Use it by default), and then run/etc/init. d/rcS command (the configuration is written to this file in my file system ).

As for the compiling of the "RFM" directory, the main task is to arrange which directories are mounted and which sub-file systems are mounted, for example, if/proc is used to mount the proc file system,/sys is used to mount sysfs,/dev/shm is used to mount tmpfs, And/tmp is used to mount ramfs. In addition, you can also re-mount the root file system in the kernel. For details, refer to the content in the script "rcS". I wrote it by referring to the friendly one. In addition, you can execute some commands in this script, such as setting the ip address and creating a symbolic link (I specially set the/dev/sda1 symbolic link for the mounting of the usb device) set the host name. Busybox init also calls/etc/profile to set the PATH. For details, see the file.

In building an embedded linux system, we mentioned how to create and create device files. But because of the existence of devfs, we can no longer bother with these device files. Because the kernel will apply for the corresponding device file from devfs when applying for a device, and devfs will help us create the corresponding device file in the/dev directory, the number of devices used by the kernel is the number of device files, which is not as old as creating a large number of device files that you don't need in advance (but starting from 2.6.12 kernel, this devfs option is deleted from the Kernel configuration. It seems that it is replaced by udevfs, but many people prefer to use devfs back.

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.