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. Even With Re-Clocking, Nouveau Remains Behind NVIDIA's Proprietary Linux Driver
  2. The Power Consumption & Efficiency Of Open-Source GPU Drivers
  3. AMD R600g/RadeonSI Performance On Linux 3.16 With Mesa 10.3-devel
  4. Intel Pentium G3258 On Linux
Latest Linux Articles
  1. Updated Source Engine Benchmarks On The Latest AMD/NVIDIA Linux Drivers
  2. Nouveau vs. Radeon vs. Intel Tests On Linux 3.16, Mesa 10.3-devel
  3. KVM Benchmarks On Ubuntu 14.10
  4. X.Org Server 1.16 Officially Released With Terrific Features
Latest Linux News
  1. GNOME/GTK On Wayland Gains Focus At GUADEC
  2. GNOME Stakeholders Take Issue With Groupon Over their Gnome
  3. GStreamer VA-API Plug-In Update Adds New Features
  4. Qt 5.4 Going Into Feature Freeze Next Week With Exciting Changes
  5. OpenSUSE Factory Turns Into Rolling Release Distribution
  6. "The World's Most Highly-Assured OS" Kernel Open-Sourced
  7. NVIDIA Is Working Towards VDPAU H.265/HEVC Support
  8. Hawaii Bug-Fixes Start Hitting Mainline RadeonSI Gallium3D
  9. The FFmpeg vs. Libav War Continues In Debian Land
  10. Grand Theft Auto Running On Direct3D Natively On Linux Shows Gallium3D Potential
Latest Forum Discussions
  1. Linus Torvalds On GCC 4.9: Pure & Utter Crap
  2. AMD Athlon 5350 APU On Linux
  3. Updated and Optimized Ubuntu Free Graphics Drivers
  4. Debian + radeonsi
  5. Open-source drivers on ATI R7 260X
  6. List of Linux friendly Kickstarter projects
  7. Porting Mesa to the Playstation 2
  8. ASRock AM1H-ITX: One Of The Best AM1 Mini-ITX Motherboards