User Tools

Site Tools


releases:3.2.0:developersguide:frompowerontologinprompt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

releases:3.2.0:developersguide:frompowerontologinprompt [2014/11/14 16:29] (current)
lionelsambuc created
Line 1: Line 1:
 +====== From power-on to the login prompt ======
 +===== Boot monitor =====
 +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/​c0d0p0s0'',​ ''/​dev/​c0d0p1s0'',​ ''/​dev/​c0d0p2s0'',​ or ''/​dev/​c0d0p3s0''​ (assuming the boot disk is attached to controller 0). Here, the "​s0"​ denotes the first subpartition,​ which stores the root filesystem on a default MINIX system.
 +
 +In Minix'​s case, that bootstrap code loads ''/​boot/​boot'',​ the MINIX 3 [[http://​www.minix3.org/​manpages/​man8/​monitor.8.html|Boot Monitor]]. The monitor has a command-line interface to allow the customisation and configuration of Minix, as described in the [[.:​..:​usersguide:​bootmonitor|Users'​ Guide]]. Eventually, it then loads the kernel binaries from ''/​boot/​image''​ -- or, one of the files in ''/​boot/​image''​ if it is a directory.
 +
 +===== System image =====
 +The MINIX 3 system image is made up of the catenation of several 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/​log''​ |//​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.
 +
 +===== System initialization,​ '​rc'​ scripts =====
 +The MINIX 3 system is running now, the different tasks initialize themselves. ''​rs''​ is the parent of all MINIX 3 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). ''​init''​ is responsible for starting login processes on each terminal; but first, it runs ''/​etc/​rc'',​ a shell script.
 +
 +==== Image ramdisk ====
 +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 |
 +
 +
 +
 +
 +It also needs several commands, to perform the initialization,​
 +|**Package** |**Source** |**On ramdisk** |**Comments** |
 +|cdprobe |''​src/​commands/​simple/​cdprobe.c''​ |''​bin/​cdprobe''​ | |
 +|dev2name |''​src/​commands/​simple/​dev2name''​ |''​bin/​dev2name''​ | |
 +|loadramdisk |''​src/​commands/​simple/​loadramdisk.c''​ |''​bin/​loadramdisk''​ | |
 +|newroot |''​src/​commands/​simple/​newroot.c''​ |''​bin/​newroot''​ | |
 +|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 |
 +
 +
 +
 +
 +==== Root file system initialization ====
 +''/​etc/​rc''​ checks the state of the system, and starts some daemons. First, it sets the keyboard translation to the mapping in ''/​etc/​keymap''​ if present, followed by a call to [[http://​www.minix3.org/​manpages/​man8/​readclock.8.html|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.
 +
 +==== Multiuser initialization ====
 +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 [[http://​www.minix3.org/​manpages/​man8/​update.8.html|update(8)]] and [[http://​www.minix3.org/​manpages/​man8/​cron.8.html|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 =====
 +''​Init''​ reads ''/​etc/​ttytab'',​ and starts a [[http://​www.minix3.org/​manpages/​man8/​getty.8.html|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 [[http://​www.minix3.org/​manpages/​man1/​login.1.html|login(1)]],​ changes to the user's home directory, and spawns a shell, as specified according to the [[http://​www.minix3.org/​manpages/​man5/​passwd.5.html|''/​etc/​passwd''​(5)]] file.
  
releases/3.2.0/developersguide/frompowerontologinprompt.txt · Last modified: 2014/11/14 16:29 by lionelsambuc