Eudyptula Challenge: superfast Linux kernel booting

Vincent Bernat

The Eu­dyp­tula Chal­lenge is a se­ries of pro­gram­ming ex­er­cises for the Linux ker­nel, that start from a very ba­sic “Hello world” ker­nel mod­ule, mov­ing on up in com­plex­ity to get­ting patches ac­cepted into the main Linux ker­nel source tree.

One of the first tasks of this quite in­ter­est­ing chal­lenge is to com­pile and boot your own ker­nel. eudyptula-boot is a self-con­tained shell script to boot any ker­nel im­age to a shell. It is packed with the fol­low­ing features:

  • It boots al­most any Linux ker­nel, from dis­tri­bu­tion-pro­vided ker­nels to cus­tom ker­nels1 built to hack on some feature.

  • It uses the host root filesys­tem as the guest root filesys­tem. No disk im­ages are needed as they take a lot of space, need to be main­tained, be­come clut­tered and the tools you need the most are never in­stalled. To avoid any al­ter­ation, by de­fault, the host filesys­tem is mounted read-only. If avail­able, OverlayFS or aufs are used to add a writable over­lay on top of it. It is also pos­si­ble to use any di­rec­tory as the root filesystem.

  • Your home di­rec­tory is also avail­able. This pro­vides has­sle-free shar­ing of scripts and re­sults with the host system.

  • It starts a min­i­mal sys­tem. Only the bits needed to start a shell will be in­volved.2 The whole sys­tem is able to boot in less than 5 seconds.

In the fol­low­ing video, eudyptula-boot is used to boot the host ker­nel and ex­e­cute a few commands:

In the next one, we use it to boot a cus­tom ker­nel with an ad­di­tional sys­tem call. This is the fif­teenth task of the Eu­dyp­tula Chal­lenge. A test pro­gram is used to check that the sys­tem call is work­ing as ex­pected. Ad­di­tion­ally, we demon­strate how to at­tach a de­bug­ger to the run­ning kernel.

While this hack could be used to run con­tain­ers3 with an in­creased iso­la­tion, the per­for­mance of the 9p filesys­tem is un­for­tu­nately quite poor.

virtme-ng is a sim­i­lar project.