boot process

Legacy boot vs SMF:
In earlier versions of Solaris(9 & earlier), system uses series of scripts to start and and stop process linked with the run levels(located in /sbin directory). The init daemon is responsible for starting and stopping the service.
Solaris 10 uses SMF(Service Management Facility) which begins service in parallel based on dependencies. This allows faster system boot and minimizes dependencies conflicts.

SMF contains:
A service configuration on repository 
A process restarter  
Administrative Command Line Interpreter(CLI) utilities 
Supporting kernel functionality

These features enables Solaris services to:
1. specify requirement for prerequisite services and system facilities and services.
2. identity and privilege requirements for tasks. 
3. specify the configuration settings for each service instance.

Phases of the boot process:
The very first boot phase of any system is Hardware and memory test done by POST (Power on Self Test) instruction.
In SPARC machines, this is done by PROM monitor and in X86/x64 machines it is done by BIOS.

In SPARC machines, if no errors are found during POST and if auto-boot? parameter is set to true, the system automatically starts the boot process.
In X86/x64 machines, if no errors are found during POST and if /boot/grub/menu.lst file is set to positive value, the system automatically starts the boot process.

The boot process is divided into five phases:
Boot PROM Phase
Boot programs Phase
Kernel intialization phase
init phase
svc.startd phase


Note: The fist two phases, boot PROM & boot programs, differ between SPARC & X86/64 systems.

SPARC Boot PROM Phase:
The boot PROM phase on a SPARC system involves following steps:
1. PROM firmware runs POST
2. PROM displays the system identification banner which includes:
   Model Type
   Keyboard status
   PROM revision number
   Processor type & speed
   Ethernet address
   Host ID
   Available RAM
   NVRAM Serial Number
3. The boot PROM identifies the boot-device PROM parameter.
4. The PROM reads the disk label located at sector 0 of the default boot device.
5. The PROM locates the boot program on the default boot device.
6. The PROM loads the bootblk program into memory.

x86/x64 Boot PROM Phase:
The boot PROM phase on a x86/x64 system involves following steps:
1. BIOS ROM runs POST & BIOS extensions in ROMs, and invokes the software interrupt INT 19h, bootstrap.
2. The handler for the interrupt begins the boot sequence
3. The processor moves the first byte of the sector image in memory. The first sector on on a hard disk contains the master boot block. This block contains the master boot(mboot) program & FDISK table.

SPARC Boot Program Phase:
The boot Program phase involves following steps:
1. The bootblk program loads the secondary boot program, ufsboot from boot device into memory.
2. The ufsboot program locates & loads the kernel.

x86/x64 Boot Program Phase:
The boot Program phase involves following steps:
1. The master boot program searches the FDISK table to find the active partition and loads GRUB stage1. It moves the first byte of GRUB into memory.
2. If the GRUB stage1 is installed on the master boot block, stage2 is loaded directly from FDISK partition.
3. The GRUB stage2 finds the GRUB menu configuration file (/boot/grub/menu.lst) and displays the GRUB menu. This menu selects the options to boot from a different partition, a different disk or from the network.
4. GRUB executes commands from /boot/grub/menu.lst to load an already constructed boot archive.
5. The multiboot program is loaded.
6. The multiboot program collects the core kernel module, connects the important modules from the boot archive, and mounts the root file system on the device.

Kernel initialization phase:
The Kernel initialization phase involves following steps:
1. The kernel reads /etc/system configuration file.
2. The kernel initializes itself and uses ufsboot command to load modules.When sufficient modules are loaded, kernel loads the / file system & unmaps the ufsboot program.
3. The kernel begins the /etc/init daemon

Note: The kernel's core is divided into two pieces of static codes: genunix & unix. The genunix is platform independent generic kernel file & the unix file is platform specific kernel file.

init phase:
The process is initiated when the init daemon initiates the svc.startd daemon that starts & stops service when requested. This phase uses information residing in the /etc/inittab file. Fields in inittab file are:
id: A two character identifier for the entry.
rstate: Run levels to which the entry applies.
action: Defines how the process filed defines the command to execute process.

svc.startd phase:
It is the master of all services and is started automatically during start up. It starts, stops & restarts all services. It also takes care of all dependencies for each service. 

The /etc/system file:

It enables the user to modify the kernel configuration, including the modules and parameters that need to be loaded during th system boot.