Lfs6.1 learning memorandum (Step 3: Building Basic System Software)

Source: Internet
Author: User
Tags virtual environment

Author: lvjinhua

Date: 2005.11.13

The main content of the last review is: a temporary development environment is built under the $ LFS/tools directory using the cross-compilation technology under the LFS user, this development environment contains various C/C ++ compilers, various library files, connectors, text compilers, and some common tool software in Linux that will be used in subsequent steps, note that these tools are independent from the host system. A symbolic connection/tools is created for $ LFS/tools to facilitate reference. this time, we will use these/tools to build our basic system software. Note that the software constructed in this time is already the final software. Let's talk about it.->

Note: At this step, the LFS user of the previous record is no longer used, but the chroot user is used to switch to a virtual system. This system uses the $ LFS directory as its root directory for operations, therefore, the/bin directory below is no longer the/bin directory of the host system. Our subsequent operations will be completed in some virtual systems.

1. Mount the virtual Kernel File System (this step is still completed by the LFS user of the host system)

A virtual Kernel File System is a file system generated by the kernel but not on the disk. It can be used to communicate with the kernel.

First create the Mount Directory: mkdir-p $ LFS/{proc, sys}, and then load them: Mount-T proc $ LFS/proc; mount-T sysfs $ LFS/sys. The subsequent operations will mount some additional file systems under the virtual system, and then complete: Mount-T tmpfs $ LFS/dev; mount-T tmpfs $ LFS/dev/SHM; mount-T devpts-O gid = 4, mode = 620 devpts $ LFS/dev/PTS

2. Enter the chroot Virtual Environment

Haha, the preparation work has been completed in half. All the temporary compilation environments have been built. All subsequent compilation operations under the/tools directory use this tool, including various libraries, which are completely independent from the host system. We have also created a necessary virtual Kernel File System for switching to the virtual system. Now, we exit the LFS user in the host system and return to the root user, run the following command to enter the virtual system:

Chroot "$ LFS"/tools/bin/env-I home =/root term = $ term PS1 = '/u:/W/$ 'path =/bin: /usr/bin:/sbin:/usr/sbin:/tools/bin/Bash -- login + H

The preceding command: "$ LFS" indicates that the environment variable LFS is used as the root directory of the virtual system. Here, the/mnt/LFS directory is used as the root directory of the virtual system. -I indicates clearing all environment variables inherited from the host system. PS1 = '/u:/W/$' indicates that the command line indicator Displays the current user name and current working directory. put/tools/bin in the PATH variable at the end to try to use the new compiled tool. + H is used to disable Bash's hash memory function, make it search again by path every time, without memorizing the previously used command location.

To ensure security, change the owner of the/tools Directory: chown-R 0: 0/tools. 0: 0 indicates root: Root.

The next step is to create the directory tree structure required for the virtual environment, the necessary configuration files and symbolic connections to make them comply with FHS standards.

3. required tools and libraries for installing the system.

Finally, install all the tools and libraries according to the installation instructions of LFS. Once again, all the compilation tools and libraries used here come from the/tools directory and are not associated with the host system.

Directory tree of the virtual system. All required tools and libraries are installed. Go to the next step.

Related Article

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.