os211


Top 10 List of Week 09

  1. Linux From Scratch.
    Linux From Scratch (LFS) is a project that allows the user to build their own custom Linux system. Steps to build a Linux system from source codes are provided in the provided link above. LFS is a great way for users to learn how a Linux system works at its core. There are many packages and patches needed to do so, and they are provided on the website as well.

  2. Why build a custom Linux system?
    As mentioned above, utilizing LFS to build your own custom Linux system allows you to directly see how a Linux system works from the inside out. It also allows you to understand what constitutes a Linux system from the required packages and patches. Another thing to consider is that since the system is built by your own hands, you have the power to edit everything and apply whatever you want. This gives you freedom to do anything you want and also provides security protection to your data, since no one else has full access to your system.

  3. Steps to build LFS.
    • First, we have to prepare the host for LFS.
      • Create a file system on a pre-made partition.
      • Setting the $LFS variable.
      • Mounting the previously mentioned partition.
    • Second, we download required packages and patches needed to build the system.
    • Third, create a limited directory layout in the created filesystem and set up a user in the environment.
    • Fourth, compile a cross-toolchain.
      • Such as Binutils-2.35 - Pass 1, GCC-10.2.0 - Pass 1, etc.
      • Can be seen here.
    • Fifth, cross compile temporary tools.
      • E.g. M4-1.4.18, Ncurses-6.2, Bash-5.0, etc.
      • Can be seen here.
    • Enter chroot and build additional temporary tools.
      • Change ownership of the system and enter the chroot environment
      • Temporary tools can be seen here.
    • Install the basic system softwares.
      • E.g. Man-pages-5.08, Tcl-8.6.10, Expect-5.45.4, etc.
      • Full list can be seen here.
    • Configure the system
    • Make sure the built LFS system is bootable.
  4. Bootloaders
    A bootloader is a specific piece of code that will always run whenever an operating system is being started. Every operating system will have a set of bootloaders specific for it that will always run before the operating system is allowed to run. It will usually contain several ways in which the operating system kernel can be booted and commands to debug and modify the kernel environment.

  5. Bootloaders in Linux.
    Most common Linux distributions will have one of three bootloaders, which are GRUB, GRUB2, and LILO. GRUB2 is mostly preferred as it is the most modern one. Whenever Linux is going through its boot sequence. The boot sequence happens whenever the machine is started up and finishes when the kernel is initialized. After the boot sequence is properly completed, systemd will start and the startup sequence begins. The startup sequence will shift Linux into its operational state.

  6. GRUB2
    GRUB2 stands for Grand Unified Bootloader 2, meaning that it is the second version of GRUB published. GRUB2 is able to make the computer find the proper OS kernel, which will then be loaded into the memory. GRUB2 allows multiboot specifications, meaning that it is usable to boot many versions of Linux and other OSs. GRUB2 can also allow the user to boot any kernel from any Linux distribution to allow ease of access. There are several steps that will be executed by GRUB2.
    • Allows the BIOS to search attached disks for a boot record and loads it into the memory to be executed.
    • Beginning the execution with the filesystem drivers necessary to locate files necessary in the next step.
    • Loads the selected kernel into memory and switches contol of the computer to that kernel.
  7. systemd.
    systemd is where all processes start from and it will be responsible to bring Linux into a working state. systemd will first mount the selected filesystems and access provided config files. These files are used to determine which state the machine should boot into. These config files are located in the mounted filesystem, in the /etc directory.

  8. Firmware.
    Firmware is a type of software that is stored on a flashable hardware device, such as EEPROMs. This is the opposite of regular softwares, which are stored in the disk. The firmware is at its core, a specific set of instructions that will be loaded into the hardware in order to be executed. The y usually provide instructions on how the device is able to communicate with other hardwares.

  9. Controversies of systemd.
    Although systemd sounds useful, there are many developers out there that dislike it. It was first introduced as a method to improve bootup times and improve loggings. Opinions on this matter differ however, as some people report that systemd does allow faster bootup times, while other people report no differences at all. While this change should not matter if nothing is affected, it is only true if systemd itself is not inflexible and convoluted to maintain. Most Linux users still prefer the older methods to boot, such as SysVInit and BSD init. With more and more versions of Linux adapting systemd, many people has had to change their systems to adapt systemd as well.

  10. systemd command examples.
    • # systemctl start [name.service] –> used to start a specific service.
    • # systemct1 stop [name.service] –> used to stop a specific service.
    • # systemctl restart [name.service] –> used to restart a specific service.
    • # systemct1 reload [name.service] –> used to reload a specific service.
    • $ systemct1 status [name.service] –> displays the current status of a specific service.
    • # systemctl is-active [name.service] –> checks whether a specific service is active or not.
    • $ systemctl list-units --type service --all –> displays all units available.