When the power is turned on, the typical PC will try to read the first sector from the BIOS's boot device, such as the first floppy disk or the first hard disk, into memory, and execute it. The code obtained from the hard disk (from the so-called master boot sector) immediately will replace itself by the code found in the first sector of the active partition. Thus, the PC now is executing the bootstrap code found in the first sector of /dev/fd0
, /dev/c0d0p0
, /dev/c0d0p1
, /dev/c0d0p2
, or /dev/c0d0p3
(assuming the boot disk is attached to controller 0).
In Minix's case, that bootstrap code loads the NetBSD boot loader, a multiboot-compliant boot loader that is able to boot Minix. The multiboot protocol loads the kernel and executables of boot-time processes (modules) somewhere in memory, according to the configuration settings and the commands entered.
/!\ Slightly stale: informations about criticity, order, and numbers are out of date.
The MINIX 3 system is made up of the union of several independent programs:
Package | Source | Resiliency | Comments |
Kernel | src/kernel | Critical | |
Process Manager server | src/servers/pm | Critical | Should be number 0 (just after kernel), API calls assume it. |
Virtual File System server | src/servers/vfs | Critical | Should be number 1, API calls assume it. |
Resurrection Service | src/servers/rs | Critical | |
src/drivers/memory | unknown | ||
src/drivers/tty | unknown | ||
src/servers/ds | unknown | ||
Minix File System service | src/servers/mfs | Fail-safe | For the root file system on /dev/imgrd |
Virtual Memory manager | src/servers/vm | Critical | Should be number 8, mmap*() API calls assume it. |
src/servers/pfs | unknown | ||
Init process | src/servers/init | unknown |
Critical above means that a panic()
inside that server will bring the whole system down. Fail-safe, on the other hand, means that MINIX 3 should be able to handle a failure of that server, usually by re-starting the driver.
The MINIX 3 system is running now, the different tasks initialize themselves. rs
is the parent of all MINIX 3 system processes, while init
is the grandparent of all user processes; note that the word user is used here in constrast to system processes; and, does not refer to the user-mode - kernel-mode distinction (all processes are user-mode in MINIX). A small file system, contained in RAM inside the 'memory' driver, is mounted as /
. init
is responsible for starting login processes on each terminal; but first, it runs /etc/rc
, a shell script.
The ramdisk itself is build within the src/drivers/ramdisk
directory.
The image ramdisk contains several drivers which are used to boot the system fully:
Package | Source | On ramdisk | Comments |
at_wini | src/drivers/at_wini | bin/at_wini | |
bios_wini | src/drivers/bios_wini | bin/bios_wini | |
floppy | src/drivers/floppy | bin/floppy | |
pci | src/drivers/pci | bin/pci | Usually needed by the at_wini driver |
Minix File System service | src/servers/mfs | sbin/mfs | For the real root file system |
Ext2 File System service | src/servers/ext2 | sbin/ext2 | If real root is using EXT2 (Linux) |
It also needs several commands, to perform the initialization,
Package | Source | On ramdisk | Comments |
cdprobe | src/commands/cdprobe/cdprobe.c | bin/cdprobe | |
loadramdisk | src/commands/simple/loadramdisk.c | bin/loadramdisk | |
ash | src/commands/ash/* | bin/sh | |
service | src/servers/rs/service.c | bin/service | |
sysenv | src/commands/simple/sysenv.c | bin/sysenv |
and several support files
Package | Source | On ramdisk | Comments |
Access Control List | src/etc/system.conf | etc/system.conf | |
src/etc/mtab | etc/mtab | Empty file | |
src/etc/passwd | etc/passwd | Needed for running service | |
src/drivers/memory/ramdisk/rc | etc/rc | Actual instructions |
/etc/rc
checks the state of the system, and starts some daemons. It sets the system timezone if needed, the keyboard translation to the mapping in /etc/keymap
if present, followed by a call to readclock(8) to set MINIX 3's time from the hardware clock. Next, the file systems are checked if necessary, and the /usr
file system is mounted.
The system now is ready for multi-user start-up. /etc/rc
calls /usr/etc/rc
. That cleans out /tmp/
and /usr/tmp/
, and resets or cycles log files (by running /usr/etc/daily
), starts the update(8) and cron(8) daemons, and initializes the network services.
/usr/etc/rc
runs any scripts that might have been installed into /usr/local/etc/rc.d/
by packages.
Finally, /etc/rc
runs /usr/local/etc/rc
to initialize the system in a site- or host-dependent way.
Init
reads /etc/ttytab
, and starts a getty(8) for each enabled terminal line, in order to allow a user to log in. Getty
asks for a user-name, checks a password with login(1), changes to the user's home directory, and spawns a shell, as specified according to the ''/etc/passwd''(5) file.
The shell is a command interpreter, which is a waiting process. Then the waiting process interprets and executes what the user typed. Programs that the user may run are stored by the file system. Execution of a program is accomplished by forking a child process. Then the child can access the system calls. After returning from the system call and ending of the child process the shell waits user input.
The shell starts by interpreting the /etc/profile
and $HOME/.profile
scripts, which sre used to set up respectively the system and user default values and parameters. On MINIX, $HOME/.profile
also executes the instructions from $HOME/.ashrc
.