Part 7 of 7 · 2 min read
Exercises
Easy
Easy 1: Order the stages (20 minutes)
Put these in order: kernel mounts the root file system, firmware self-test, systemd starts, boot loader loads the kernel, login prompt.
Done when: firmware, boot loader, kernel, systemd, login prompt.
Hint
The firmware always goes first and the login last.
Easy 2: Uptime (20 minutes)
A machine reports an uptime of 200,000 seconds. Give days, hours and minutes.
Done when: you write 2 days, 7 hours, 33 minutes.
Hint
200,000 minus 2 × 86,400 leaves 27,200 seconds.
Easy 3: Share of the boot (20 minutes)
Firmware 5 s, loader 1 s, kernel 3 s, services 9 s. Give the total and the share of the services.
Done when: you write 18 seconds and 50 per cent.
Hint
Add the four times, then divide 9 by the total.
Medium
Medium 1: Read your own boot (30 minutes)
On a Linux machine, read /proc/cmdline, then run ps -p 1 and dmesg | head. Write what each tells you.
Done when: three observations: the kernel file and root setting, the first process name, and the first kernel message.
Hint
Use cat /proc/cmdline and ps -p 1 -o comm.
Medium 2: Match symptom and stage (30 minutes)
For each symptom, name the stage: "No bootable device", "Kernel panic: unable to mount root fs", "Login service failed to start".
Done when: firmware, kernel and first-process stages.
Hint
Match each message to the part that was running.
Medium 3: Memory before the disk (30 minutes)
A kernel unpacks to 55 MB and the initramfs is 25 MB. Memory used before the real disk is reachable? Memory freed after the switch?
Done when: you write 80 MB and 25 MB.
Hint
Add the two sizes.
Hard
Hard 1: Explain the puzzle (60 minutes)
Write a short explanation, with a diagram, of why Linux needs an initial RAM file system. Include what would go wrong without it.
Done when: a diagram showing kernel, initramfs, driver and real disk, and a clear statement of the missing-driver problem.
Hint
The driver is a file on the disk the kernel cannot yet read.
Hard 2: Speed up a boot (60 minutes)
A boot takes 40 seconds: firmware 10, loader 3, kernel 7, services 20. Services run one after another, and 12 of the 20 seconds can run in parallel with the rest of boot. Estimate the best new total and describe what you change.
Done when: a new total near 28 seconds with the reasoning (20 − 12 = 8 seconds of services remain on the critical path).
Hint
The parallel work overlaps with the other stages.
Hard 3: Design a boot for a phone (60 minutes)
Compare the boot of a Linux laptop and of an Android phone. List three steps they share and two that differ.
Done when: three shared steps (firmware, kernel, first process) and two differences (boot loader choice, initramfs kept as root).
Hint
Android uses vendor boot loaders and keeps its initial RAM file system.