1. Computers
  2. Display Drivers
  3. Graphics Cards
  4. Memory
  5. Motherboards
  6. Processors
  7. Software
  8. Storage
  9. Operating Systems


Facebook RSS Twitter Twitter Google Plus


Phoronix Test Suite

OpenBenchmarking.org

Booting A Modern Linux Desktop In Just ~200MB

Tomas Matejicek

Published on 26 December 2012
Written by Tomas Matejicek
Page 2 of 3 - 10 Comments

Escaping Initramfs

At this moment, we have a fully initialized Linux Kernel running, the initramfs area in memory is populated by a temporary root filesystem with just the most basic Linux commands, and temporary init just started.

Having the temporary root filesystem in initramfs is not ideal, since it doesn't support pivot_root system call - an important operation which will be used later in the boot up process. We need to switch from initramfs to something else. To do that, the temporary init firstly mounts a tmpfs filesystem over /m, moves all files and directories in there including the init script itself, and uses switch_root to make this tmpfs /m the new root and to restart the init itself from there too. Blue star denotes the directory which is moved.

No matter how strange this whole action looks like (we've ended up with the very same directory structure like before, it seems like no improvement at all), the change is significant. Since now, the temporary root filesystem is on tmpfs instead of initramfs, and thus pivot_root operation will be available when needed in the future.

You may be wondering why is the current root filesystem still labeled as temporary. It's because we're still at the very beginning of the construction phase and we'll just build the real root filesystem later, as explained below, by combining Slax compressed data images to AUFS union.

Slax Data Lookup

Before the init process could start to search for Slax data on available devices, it needs to setup the working environment. The proc and sysfs filesystems are mounted over /proc and /sys respectively. Some important kernel drivers such as aufs, squashfs and loop are loaded using modprobe, and device files are created in /dev directory by the mdev command. Path to the mdev binary is also echoed to /proc/sys/kernel/hotplug, to make sure that the Linux Kernel automatically creates new device files in /dev for all the newly discovered disk partitions as soon as they become available later. That is specially needed for partitions on USB devices, since those can take few seconds to fully initialize.

As soon as storage devices are accessible through device files in /dev, the blkid command is used to filter out only those which can be mounted (which contain a filesystem known to the running kernel). The devices are examined (mounted read-only over /memory/data/) one after another, until a valid Slax data directory is found. Then, all files with .sb extension (Slax Bundles) are processed - for each Slax Bundle, a directory is created in /memory/bundles/ and the bundle (which in fact is a squashfs compressed image file) is loop-mounted over it. In the diagram below, squashfs content is green.

Latest Linux Hardware Reviews
  1. Btrfs On 4 x Intel SSDs In RAID 0/1/5/6/10
  2. AMD Radeon R9 290 On Ubuntu 14.10: RadeonSI Gallium3D vs. Catalyst
  3. MSI X99S SLI PLUS On Linux
  4. NVIDIA GeForce GTX 970 Offers Great Linux Performance
Latest Linux Articles
  1. 6-Way Ubuntu 14.10 Radeon Gallium3D vs. Catalyst Driver Comparison
  2. NVIDIA vs. Nouveau Drivers On Ubuntu 14.10
  3. Ubuntu 14.10 Offers AMD Radeon Driver Performance Improvements
  4. Btrfs RAID: Linux 3.10 To Linux 3.18 Benchmarks
Latest Linux News
  1. GLAMOR Acceleration Continues To Be Cleaned Up
  2. Russia's Yandex Web Browser Finally Released For Linux
  3. Linux Kernel Finally Being Optimized For SSHDs
  4. GPU Profiling Support Lands In Mozilla Firefox
  5. Kubuntu 15.04 Will Use KDE's Plasma 5 By Default
  6. KDBUS Submitted For Review To The Mainline Linux Kernel
  7. An Intel-Based Ubuntu Touch Tablet Is Planning To Launch Soon
  8. MIAOW: An Open-Source GPU Design Based On AMD's Southern Islands
  9. X.Org Server 1.17 RC1 Released, Exciting For GLAMOR & Modesetting
  10. OpenGL 4.x Support For Mesa Still Inching Along
Latest Forum Discussions
  1. Is foolish currently develop in machine code, hexadecimal and assembly?
  2. Reducing The CPU Usage In Mesa To Improve Performance
  3. Help diagnosing problems with a Readon HD 4670 on Mesa 10.3.2-1
  4. Advertisements On Phoronix
  5. nv and xorg.conf under Debian PPC
  6. Looking for a Open-Source AMD experienced Linux mentor
  7. Bad perfomance in gaming
  8. Dead Island for Linux (?)