What is linux from scratch

What is Linux From Scratch?

Linux From Scratch (LFS) is a project that provides you with step-by-step instructions for building your own customized Linux system entirely from source. Why would I want an LFS system?

Many wonder why they should go through the hassle of building a Linux system from scratch when they could just download an existing Linux distribution. However, there are several benefits of building LFS. Consider the following:

LFS teaches people how a Linux system works internally

Building LFS teaches you about all that makes Linux tick, how things work together and depend on each other. And most importantly, how to customize it to your own tastes and needs.

Building LFS produces a very compact Linux system

When you install a regular distribution, you often end up installing a lot of programs that you would probably never use. They’re just sitting there taking up (precious) disk space. It’s not hard to get an LFS system installed under 100 MB. Does that still sound like a lot? A few of us have been working on creating a very small embedded LFS system. We installed a system that was just enough to run the Apache web server; total disk space usage was approximately 8 MB. With further stripping, that can be brought down to 5 MB or less. Try that with a regular distribution.

LFS is extremely flexible

Building LFS could be compared to a finished house. LFS will give you the skeleton of a house, but it’s up to you to install plumbing, electrical outlets, kitchen, bath, wallpaper, etc. You have the ability to turn it into whatever type of system you need it to be, customized completely for you.

LFS offers you added security

You will compile the entire system from source, thus allowing you to audit everything, if you wish to do so, and apply all the security patches you want or need to apply. You don’t have to wait for someone else to provide a new binary package that (hopefully) fixes a security hole. Often, you never truly know whether a security hole is fixed or not unless you do it yourself.

What can I do with my LFS system?

A by-the-book LFS system is fairly minimal, but is designed to provide a strong base on which you can add any packages you want. See the ​ BLFS project for a selection of commonly used packages.

Who’s who:

Project Leader Gerard Beekmans
Project Co-leader Bruce Dubbs
Editor DJ Lucas
Editor Ken Moffat
systemd maintainer Douglas R. Reno

Plus numerous people who contribute to the book and its side projects.

Источник

What is Linux From Scratch?

Linux From Scratch (LFS) is a project that provides you with step-by-step instructions for building your own customized Linux system entirely from source.

Why would I want an LFS system?

Many wonder why they should go through the hassle of building a Linux system from scratch when they could just download an existing Linux distribution. However, there are several benefits of building LFS. Consider the following:

Читайте также:  Linux show all user history

LFS teaches people how a Linux system works internally
Building LFS teaches you about all that makes Linux tick, how things work together and depend on each other. And most importantly, how to customize it to your own tastes and needs.

Building LFS produces a very compact Linux system
When you install a regular distribution, you often end up installing a lot of programs that you would probably never use. They’re just sitting there taking up (precious) disk space. It’s not hard to get an LFS system installed under 100 MB. Does that still sound like a lot? A few of us have been working on creating a very small embedded LFS system. We installed a system that was just enough to run the Apache web server; total disk space usage was approximately 8 MB. With further stripping, that can be brought down to 5 MB or less. Try that with a regular distribution.

LFS is extremely flexible
Building LFS could be compared to a finished house. LFS will give you the skeleton of a house, but it’s up to you to install plumbing, electrical outlets, kitchen, bath, wallpaper, etc. You have the ability to turn it into whatever type of system you need it to be, customized completely for you.

LFS offers you added security
You will compile the entire system from source, thus allowing you to audit everything, if you wish to do so, and apply all the security patches you want or need to apply. You don’t have to wait for someone else to provide a new binary package that (hopefully) fixes a security hole. Often, you never truly know whether a security hole is fixed or not unless you do it yourself.

What can I do with my LFS system?

A by-the-book LFS system is fairly minimal, but is designed to provide a strong base on which you can add any packages you want. See the BLFS project for a selection of commonly used packages.

Who’s who:

  • Project Creator: Gerard Beekmans
  • Managing Editor: Bruce Dubbs
  • Editor: Ken Moffat
  • Editor: Pierre Labastie
  • Editor: DJ Lucas
  • Editor: Douglas R. Reno
  • Editor: Thomas Trepl
  • Editor: Tim Tassonis
  • Editor: Xi Ruoyao
  • Plus numerous people who contribute to the book and its side projects.

© 1998-2023 Gerard Beekmans. Website design by Jeremy Huntwork & Matthew Burgess.

Источник

Linux From Scratch

Linux From Scratch

The concept of Linux From Scratch is an installation in Linux which will install a full-fledged Linux system by building all the components of the Linux system manually. As we can purely understand that the making of Linux from scratch is a much longer process than actually install a Linux distribution in the system, but with this it brings the customization that might be required for the Linux which gets installed. The flexible, compact and secure system will be as per the requirement of the user and no extra components would be present and will also enable user or developer to learn how Linux systems work internally. With this, in this article, we will see the procedure to install and how this component works in general in a development environment.

Читайте также:  Realtek 8811au driver linux

Web development, programming languages, Software testing & others

Requirements and Procedure

Here we will go through the requirements which is necessary for building your own Linux from scratch. The list of all the software are mentioned in the book Linux from scratch including the minimum version which is mentioned so that the Linux build is spotless.

Software Version
Bash 3.2
Binutils 2.25
Bison 2.7
Bzip2 1.0.4
Coreutils 6.9
Diffutils 2.8.1
Findutils 4.2.31
Gawk 4.0.1
GCC 6.2
Glibc 2.11
Grep 2.5.1a
Gzip 1.3.12
Linux Kernel 3.2

Now, once the requirement is fulfilled, following steps are followed.

Here, we would also see about any specific syntax that would be required for fulfilling the build.

  • In the current operating system, or the Virtual Box or VM, a partition is created and then the correct file format is set up. Basic directories like the bin folder, the place where binaries of the files need to be installed, usr folder where the user related data resides etc. are created and kept ready.
  • The compressed source code which is available on GitHub or any private repository is downloaded as .tar.gz or .tar files.
  • While downloading the tar file, one needs to keep in mind to verify the integrity of the tarball by doing a hash check to look for any tampering in the compressed file.
  • The compressed file is extracted for getting the source code for the desired process or command’s source code.
  • make command (syntax: make check) is run to perform a check on the source code. Post that (syntax: make install) is run for building and installing the required process and store the binaries in the bin folder.
  • The steps 2 to 5 is repeated for any other command or process that one would need to install in the Linux system.

How does Linux From Scratch work in Linux?

In Linux from scratch it is undoubtedly about understanding the working of LFS-Bootscripts. These Bootscripts are installed as a part of the Step 5. LFS-Bootscripts are a set of scripts which are installed in order to perform some basic yet important tasks. These SysV type scripts performs various tasks like performing check on the filesystem integrity during boot, loading of keymaps, setting up of networks, and halting process in case of shutdown. These, although looks primal tasks, but are equally important for smooth functioning of the Linux system.

Before we see the working, it is imperative to know about the different set of scripts which are installed as a part of LFS-Bootscripts.

Given below we have some set of scripts which are basic yet the most important ones.

  • checkfs: Looks for any issues in a file system before they are mounted.
  • cleanfs: Removes any files which need not be preserved between reboots.
  • halt: Helps in halting the system.
  • network: Helps in setting up of network interfaces.
  • localnet: Makes sure that hostname and local device for loopback is correctly set up.
  • reboot: Helps in rebooting the system.
  • halt: Helps in halting the system.
Читайте также:  Linux based open source projects

The above list is not exhaustive, and reader should be mindful of the same.

Now that we have a brief idea on what Bootscripts are, let us know on how these Bootscripts work? The booting facility of Linux is a special one which is known as SysVinit and the running concept is based on run-levels. Here, there are 7 run-levels where each of these level corresponds to a state and also refers to the actions that needs to be performed when the operating system starts up.

The run-levels are as follows.

  • 0: To halt the computer.
  • 1: Allow only a single user.
  • 2: Allows multiple users but with no networking.
  • 3: Allows multiple users with networking.
  • 4: Placeholder for any customized option.
  • 5: Again, a placeholder but most likely used for logging in using GUI.
  • 6: To reboot the computer.

Using init command one can easily modify the run levels as per the requirement of the use case. In the location /etc/rc.d there are numerous files present like rc?.d where? signifies the run level one is looking for. This also consists of rcsysinit.d which contains symbolic links having a nomenclature which helps in determining the order in which the scripts in the directory needs to run in. The lower the number in the nomenclature the earlier the file gets executed.in the folder /etc/rc.d/init.d the actual scripts are stored. The symbolic links points to the scripts stored here, and these are the scripts which does the entire work as desired by the developer.

This is where, the customization kicks in, one can choose the lifestyle it needs for its Linux system by choosing the way the boot process works. After all this is one’s own system where one can put all creativity to bring something to life.

Conclusion

In this article though there is no example, but nevertheless the article focusses on a project named Linux from Scratch (LFS) and how one can build customized Linux system which can suits one’s requirement and is free of any unwanted components in the Linux system getting developed. There are above and beyond LFS, for example, BLFS (Beyond Linux From Scratch), ALFS (Automated Linux From Scratch) etc. which is outside the scope of the article, but is a preferred read for our readers.

This is a guide to Linux From Scratch. Here we discuss the introduction, requirements and procedure, how does linux from scratch work in linux? You may also have a look at the following articles to learn more –

502+ Hours of HD Videos
54 Courses
4 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5

57+ Hours of HD Videos
15 Courses
9 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5

Источник

Оцените статью
Adblock
detector