Userspace Initialization

Advanced Operating Systems and Virtualization Alessandro Pellegrini A.Y. 2018/2019 BIOS/UEFI The actual Hardware Startup Boot Sequence Executes the Stage 2 bootloader Bootloader Stage 1 (skipped in case of UEFI)

Bootloader Stage 2 Loads and starts the Kernel

The Kernel takes control of and initializes the machine Kernel Startup (machine-dependent operations)

First : basic environment initialization (e.g., SystemV Init, )

Initializes the user environment /Targets (e.g., single-user mode, multiuser, graphical, ...) Back to Kernel Initialization rest_init() • – We have to “leave” the infinite loop in pid 0 kernel thread • We need to start other processes than idle! kernel_init() • A new is created, referencing schedul aes( i)ts entry point A call to is issued, to start • scheduling the newly-created process cpu_idle() This is done right before PID 0 calls into /sbin/init • /sbin/iSntiatrting • is the first userspace process ever started • This process is commonly stored into the ramdisk, to speedup the process • init will have to load configuration files from the hard drive Tbehfiosr me eans that the VFS, Device Management, and Interrupt subsystems must be initialized loading init BIOS/UEFI The actual Hardware Startup Boot Sequence Executes the Stage 2 bootloader Bootloader Stage 1 (skipped in case of UEFI)

Bootloader Stage 2 Loads and starts the Kernel

The Kernel takes control of and initializes the machine Kernel Startup (machine-dependent operations)

First process: basic environment initialization Init (e.g., SystemV Init, systemd)

Initializes the user environment Runlevels/Targets (e.g., single-user mode, multiuser, graphical, ...) • • Startup Services Hostname • Timezone • Check the hard drives • Mount the hard drives • Remove files from /tmp • Configure network interfaces Start daemons and network services Startup Run Levels 1 (S) Single user 2 Multiuser (no networking) 3 Full Multiuser 4 Unused 5 X11 6 Reboot 0 Halt • /etc/rc.d/init.d/ • /etc/rc.dR/rucn#. Ld/evel Scripts A–ctual scripts placed in: /e:tc/init.d – Symbolic links to scripts – S## - Start scripts – /etc/sysconfig/ K## - Stop scripts : script configuration files • chkconfig