Monday, June 30, 2014

Boot up and Shutdown process Linux:


You can use the following two files regarding boot logs:

/var/log/boot.log
/var/log/dmesg

On a Ubuntu/Debian, Bootlog is turned off by default. Turn it on like this:

vi /etc/default/bootlogd

# Run bootlogd at startup ?
BOOTLOGD_ENABLE=Yes

Following stages for boot up for an x86 system:



1.System BIOS(Basic Input Output System) checks the system and launches the first stage boot loader on the MBR(Master Boot Record) of the primary hard disk.

2.First stage boot loader loads itself into memory and launches the second stage boot loader from the /boot/ partition.

3.Second stage boot loader loads the kernel into memory, which in turn loads any necessary modules and mounts the root partition read-only.

4.The boot loader often presents the user with a menu of possible boot options. The boot loader can be configured to time out if the user does not interact with the boot loader, thus selecting a default kernel and system configuration. After the selection is made, or after reaching a selection time-out, boot loader loads the kernel, which decompresses itself and sets up system functions such as essential hardware and memory paging, before calling start_kernel().

5.start_kernel() then performs the majority of system setup (interrupts, the rest of memory management, device and driver initialization, etc.) before spawning separately, the idle process and scheduler, and the /sbin/init process (which is executed in user space).
6.The /sbin/init program loads all services and user-space tools, and mounts all partitions listed in /etc/fstab.
7.The user is presented with a login screen for the freshly booted Linux system.

Beginning of boot process is different for different hardware platform .However, once the kernel is found and loaded by the boot loader, the default boot process is identical across all architectures.Here we are focusing on x86 architecture.

Wednesday, June 25, 2014

Boot loader

A boot loader is a computer program that loads an operating system or some other software for the computer after completion of the self-tests. Within the hard reboot process, it runs after completion of the self-tests, then loads and runs the software. A boot loader is loaded into main memory from persistent memory, such as a hard disk drive or, in some older computers, from a medium such as punched cards, punched tape, or magnetic tape. The boot loader then loads and executes the processes that finalize the boot. Like POST processes, the boot loader code comes from a "hard-wired" and persistent location; if that location is too limited for some reason, that primary boot loader calls a second-stage boot loader or a secondary program loader.

On modern general purpose computers, the boot up process can take tens of seconds, and typically involves performing a power-on self-test, locating and initializing peripheral devices, and then finding, loading and starting an operating system. The process of hibernating or sleeping does not involve booting. Minimally, some embedded systems do not require a noticeable boot sequence to begin functioning and when turned on may simply run operational programs that are stored in ROM. All computing systems are state machines, and a reboot may be the only method to return to a designated zero-state from an unintended, locked state.

Boot is short for bootstrap or bootstrap load and derives from the phrase to pull oneself up by one's bootstraps. The usage calls attention to the requirement that, if most software is loaded onto a computer by other software already running on the computer, some mechanism must exist to load the initial software onto the computer. Early computers used a variety of ad-hoc methods to get a small program into memory to solve this problem. The invention of read-only memory (ROM) of various types solved this paradox by allowing computers to be shipped with a start up program that could not be erased. Growth in the capacity of ROM has allowed ever more elaborate start up procedures to be implemented.