in init/init.c [395:442]
int main() {
// Block all signals in init. SIGCHLD will still cause wait() to return.
sigset_t set;
sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, 0);
// Set up the minimal dependencies to start a container
// Init /dev and start /dev/console for early debugging
init_dev();
init_console();
// Insert the Nitro Secure Module driver
init_nsm_driver();
// Signal nitro-cli that the enclave has started
enclave_ready();
FILE *env_file = fopen("/env", "r");
FILE *cmd_file = fopen("/cmd", "r");
// env should be an array of "VAR1=string1", "VAR2=string2", ...
// The array should end with NULL
char **env = read_config(env_file);
// cmd should be an array of "command", "param1", "param2", ...
// The array should end with NULL
char **cmd = read_config(cmd_file);
fclose(env_file);
fclose(cmd_file);
unlink("/env");
unlink("/cmd");
die_on(chdir("/rootfs") != 0, "chdir /rootfs");
die_on(chroot("/rootfs") != 0, "chroot /rootfs");
// At this point, we need to make sure the container /dev is initialized
// as well.
init_dev();
init_fs(ops, sizeof(ops) / sizeof(ops[0]));
init_cgroups();
pid_t pid = launch(cmd, env);
//// Reap until the initial child process dies.
reap_until(pid);
reboot(RB_AUTOBOOT);
}