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. Rosewill RS-MI-01: An Ultra Low-Cost Mini-ITX Chassis
  2. D-Link DCS-2330L HD Wireless Network Camera
  3. Gigabyte AM1M-S2H
  4. AMD's New Athlon/Semprons Give Old Phenom CPUs A Big Run For The Money
Latest Linux Articles
  1. Red Hat Enterprise Linux 7.0 RC Benchmarks
  2. AMD Catalyst 14.4 Brings Few Linux Performance Improvements
  3. The Performance Of Fedora 20 Updated
  4. Clang Fights GCC On AMD's Athlon AM1 APU With Jaguar Cores
Latest Linux News
  1. More Steam Linux Tests/Benchmarks Might Be Coming
  2. NVIDIA's Amazing Single-Board ARM Computer Might Be Delayed
  3. Fedora 21 To Get A Playground, New Features
  4. PC-BSD Is Developing Its Own Desktop Environment
  5. Valve Is Bringing VOGL To Windows & Working On Regression Tests
  6. Canonical Is Taking Over Linux 3.13 Kernel Maintenance
  7. Google Web Designer Is Now Natively Available On Linux
  8. Ubuntu 14.10 Is Codenamed The Utopic Unicorn
  9. Audacious 3.5 Lightweight Audio Player Released
  10. Steam Updated For Ubuntu 14.04 LTS, SteamOS
  11. DNF 0.5 Yum Replacement Now Supports Groups
  12. Red Hat Enterprise Linux 7.0 Is Looking Fantastic
Latest Forum Discussions
  1. HTPC-upgrade advice: AMD Richland A8-7600 or Kaveri A10-6700T ???
  2. The GNOME Foundation Is Running Short On Money
  3. What Else Would You Like To See On Phoronix This Spring?
  4. Linux Kernel Developers Fed Up With Ridiculous Bugs In Systemd
  5. The Most Amazing OpenGL Tech Demo In 64kb
  6. Announcing radeontop, a tool for viewing the GPU usage
  7. New card. Open source drivers only.
  8. Script for Fan Speed Control