Today we begin to demonstrate how to build a minimal Linux Distribution
To start, we will get the kernel to boot and run a stub userspace init program
The minimum you need to get this to work is as follows:
Set up the QEMU emulator
Compile the Linux kernel for your architecture
Currently the example architecture is ARM64, later in the course we are going to discuss another architectures
We discuss how to set up the configuration file (.config) for kernel compilation
We write a minimal program P ("call exit") in ARM64 assembly for the kernel to invoke as the init process
In order to give the kernel access to program P to use as an init process, we package P in a CPIO archive.
We tell the QEMU to boot the kernel and pass our cpio archive as the inital RAM disk, confusingly though the initrd
option
The kernel panics immediately since the init
process dies which is illegal
To exit our init program with correct protocol for the kernel, we use the reboot(2)
syscall
When we invoke QEMU using a new initramfs containing the rebooting program, the kernel exits successfully
Finally, we have a basic stub of a kernel and root filesystem we can build on to create a minimal Linux distribution
msg = (silence)
whoami = None
singularity v0.5 https://github.com/underground-software/singularity