Linux experience using LFS

Source: Internet
Author: User
Use LFS to create your own Linux experience-general Linux technology-Linux technology and application information. The following is a detailed description. Author: radish. net

I first saw the term LFS three years ago when I was still working on it. NET, just a simple look at the meaning of LFS, thought it was another release of Linux, did not care. Recently I suddenly thought of it. I read its manual carefully and found that it is just a manual that guides users to create a Linux system from scratch. So I started according to the manual.

From the beginning, there are still some basic environments. For example, you must have at least a set of Linux compiling environments, such as glibc and gcc, because gawk is required for Configure scripts of some installation packages, grep and other tools, so you need to check these tools before starting the entire task. Fortunately, all the required tools have been listed in the beginning of the LFS manual. You only need to check whether there are any tools in your environment. If you use LiveCD of LFS, it already contains these basic tools, so you do not need to install anything else. At the beginning, I jumped out of this chapter. As a result, during a later compilation, I found an unknown BUG and checked it online for a while, it was found that the gawk tool was missing. Later, I saw this chapter and regretted that I had no patience to finish it. Therefore, if LFS is used for the first time, it must be implemented step by step, which can save a lot of trouble, but the trouble is also relative, it won't fully understand why these tools are needed.

I will not talk about the detailed steps. The LFS manual has already been clearly written. Here I will mainly talk about some problems and solutions I encountered during the compilation process.

The first problem occurs when GCC is compiled. There is an option -- with-local-prefix =/tools, in fact, there is no glibc header file or linux kernel header file in the/mnt/lfs/tools/include directory at this time, the entire manual does not explain when these include files are copied to this directory. I think they may be copied from the system/user/include. Because glibc is in/usr/lib at the beginning of compilation. In this way, we don't just need to copy the include file but the lib file. At this time, there is a problem. What lib files should I copy? There are many library files in the entire directory, there are various links, so I tried to start from scratch, install the linux api before compiling glibc, except for -- prefix =/tools, if no other parameters are added, the first step in the Start manual after compilation is successful. In this way, the parameter -- with-local-prefix =/tools will not cause errors during subsequent compilation. Afterwards, I found out the steps for gcc upgrade. We also first compiled glibc (provided that glibc since gcc needs to be updated) and then compiled gcc.

The second problem occurs when glibc is compiled for the second time (glibc is compiled for the first time according to the manual order). An error occurs during make. I searched the internet and found that gawk was missing On debian, so I installed one and re-configure it and compiled it. As mentioned earlier, do not miss the LFS manual header.

The third problem is about environment variables. The LFS manual repeatedly emphasizes that an lfs user should be created, and all the first compilation must be performed by this user. I switched to the root node to copy some files and forgot to switch back. This caused the cannot compute sizeof (double long) error when compiling a tool. There was no problem before and after the check. Later, I suddenly found that I was not using lfs users, and then I checked the environment variables, which is much different from lfs. After the lfs is switched, the system re-configure and the compilation is successful. The cause of the absence of the Environment Variable LC_ALL = POSIX may be an afterevent analysis (speculation ).

The above three are the three major problems that I have encountered over the past few days. They also appeared in the first round. The second round of compilation went smoothly. Basically, it was the work of compiling, then typing, and then compiling. I spent two weekends and two and a half working days in the whole process. Finally, at noon today, I successfully started my own compiled Linux system and registered a user on the LFS website. My ID is 20188. Hey hey, I feel pretty good. Next, I want to add the part in the manual that I was lazy or didn't have a detailed study. Then I will continue to study the BLFS manual.

I feel that I have learned a lot about Linux over the past few days, including the use of tools and the organization of file structures in Linux. This is a power-off for my Linux journey.

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.