Code, called BIOS (for Basic Input Output Service) is stored in non-volatile memory such as a ROM, EEPROM, or flash memory. When the PC is turned on or rebooted, this code is executed.
It loads the first sector from the master boot record (MBR) on the boot drive.
The MBR contains the partition table, plus the stage 1 boot code
The standard hard drive MBR used by Windows operating systems checks the partition table to find a primary partition on the boot drive that is marked as active, loads the first sector from that partition, and passes control to the beginning of the loaded code - the stage 2 bootloader
The normal Windows stage 2 bootloader then boots the Windows O/S
Linux installs a bootloader such as lilo
or grub
which can offer a choice of
O/S systems (including Windows)
See Wikipedia Booting for a more detailed overview
The Grand Unified Boot Loader (GRUB) is the most common Linux bootloader now
GRUB has a configuration file. In FC 16 it is is /boot/grub2/grub.cfg which is usually stored in /boot/grub/grub.conf or /boot/grub/menu.lst
GRUB is normally put in place by the distro install process
grub.conf contains a list of partitions to boot from and description of the system it is booting
A simplified FC 16 entry is
Ubuntu 11.10 is similar.
This specifies the menu, which disk partition is used
(see later), which kernel (vmlinuz) is booted and which RAM-disk (initramfs) it uses
menuentry 'Fedora (3.2.5-3.fc16.x86_64)' {
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root 4ddd8d46-c346-4eb4-ae41-85d38fd56aae
echo 'Loading Fedora (3.2.5-3.fc16.x86_64)'
linux /boot/vmlinuz-3.2.5-3.fc16.x86_64 root=UUID=4ddd8d46-c346-4eb4-ae41-85d38fd56aae
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-3.2.5-3.fc16.x86_64.img
}
The boot program previously used to create a process init
which is the parent of all other Linux processes
and which continues the boot process
The boot program in Ubuntu 11.10 now creates a process
upstart
which is the parent of all other Linux processes
and which continues the boot process
The boot program in Fedora 16 now creates a process
systemd
which is the parent of all other Linux processes
and which continues the boot process
(View the tree of processes by pstree
)
Linux has a number of different possible run levels to control what type of multi-user system is running.
level 3: non-gui, command line interface
level 5: X Window interface
Others are 0 (shutdown), 1 (single-user). 6 (reboot)
The init process will set all other processes running in some versions of Linux e.g. xPUD
init reads the runlevel from /etc/inittab and other parameters and executes any commands in there
It will run some of the shell scripts in /etc/rc<runlevel>
Commands S20..., S30..., S40... will be run on startup
Commands K20..., K30..., K40... will be run on shutdown
If you want another service to start/stop, make a link from the files in /etc/rc.d to the runlevel directory
If you have "local" services, put them in /etc/rc.local
The upstart process will set all other processes running on Ubuntu, Debian, ... systems. See Upstart Intro, Cookbook and Best Practises
The runlevel is set to 2 (run "runlevel") - runlevels are not important in Debian systems
Upstart generates system events such as "start", "stop", "lid closing", "network up"
It will call a script in /etc/init
such as
/etc/init/network-interface to configure network devices as they are added/removed
The systemd process starts all other processes in Fedora and some other distros
The init/upstart/systemd process will set all other processes running. See Systemd
The configuration files are buried down in /etc/systemd/...
The script rc.local is run, allowing local customisation
In runlevels 2-5 Fedora init
sets up 6 virtual terminals
(access a virtual terminal by ctrl-alt-F1, etc.
F1 is the GUI, others are command line)
In runlevel 5, Fedora init
finally
calls the shell script /etc/X11/prefdm
which starts the preferred X display manager
(See http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-boot-init-shutdown-process.html)
Ubuntu: rc2.d - rc5.d include S30gdm which starts the Gnome Display Manager
You can usually shutdown by a menu entry or button
You can call halt
or reboot
or powerdown
You can control when a shutdown occurs by
using shutdown
e.g.
shutdown -s now
The "kill" scripts in the appropriate control system are called
UEFI replaces the standard BIOS firmware
It has several improvementds over BIOS, such as the ability to boot off disks larger than 2Tb and the removal of the 4 primary partitions limitation
Secure boot also prevents loading of drivers or OS loaders that are not digitally signed
This can reduce the chance of "rootkits" infecting the computer - the rootkit will not have an appropriate signature and so cannot boot
All computers with a Windows 8 sticker will have UEFI secure boot enabled, and a Microsoft certificate stored inthe UEFI
Linux/BSD/other will not be able to boot unless it uses a bootloader signed by MicroSoft
There are currently (20/2/2013) four ways to manage this (see Linux Foundation ships UEFI Secure Boot workaround