Widely Vision

  • Real History of Israel

  • Poll

  • Get a PDF version

  • Follow This Blog

  • October 2017
    S M T W T F S
    « Mar    
    1234567
    891011121314
    15161718192021
    22232425262728
    293031  

HOWTO GCC & GDB

Posted by aboelnour on October 15, 2009


gcc_sm

peace upon you:

As they say Linux for developers.

so it’s an article to help any Beginner to Began developing C/C++ Under Linux.

————————-

Your distro comes often with the GCC (GNU Compiler Collection) and with the GDB (GNU Debugger) This tools is very important to any C/C++ developer turned to Linux.

1) The GCC:

First: Make sure the build-essential package is installed:

sudo apt-get install build-essential

Second: Compiling a Simple Program :

take this Hello World program and Copy and Paste it in a File Called main.c

#include<stdio.h>

int main()

{

printf(“Hello World!\n”);

return 0;

}

to Compile and make the output named test

gcc main.c -o test

If it work without any Compilation errors you can run your program:

./test

NOTES:

1) if you don’t Determine the output file the compiler will name him “a.out” and if there is another file have the same name the Compiler will replace it.

2) you can give the Compiler the option -Wall to make the Compiler print any error message he would say.

2) The GDB:

When you successfully write your code you will need to debugging it so there is the GDB. to debug any code

gdb ./test

where test is the binary code which the Compiler produce it.

this command will open the gdb prompt to take your Commands:

run

to run your code and stop at any break point you put it.

list

show you the source code of your program with numbered lines to put break points.

break LINE_NUMBER

put a break point in the line number which you determine.

continue

to continue running your code after stopping at break point.

step

next

move one step in your program.

delete

delete all the break point in your program.

clear LINE_NUMBER

clear the break point at this line.

until LINE_NUMBER

run  your program until a the Determined line.

display EXPRESSION

to display the value of this expression.

info

this command give you more information about the gdb commands

quit

to quit from the gdb

IMP.NOTES

1) To use the debugger you should run the option -g while compelling

your code with gcc.

2) when you deal with C++ you can follow the same steps but instant using the gcc you will use the g++.

so that’s it any feedback is welcomed

best wishes ,

aboelnour.

archer

Advertisements

Posted in C/C++, linux | Leave a Comment »

“INIT” parent of your processes

Posted by aboelnour on September 27, 2009


init0

Peace be upon you:
Today we will talk about a process called Init .

Init  is  the  parent of all processes on the system, it is executed by
the kernel and is responsible for starting all other processes. it is the  parent  of all processes whose natural parents have died and it is responsible for reaping those when they die.

this process lunched by the kernel when the boot operation end and here is the steps:

1.  BIOS: The Basic Input/Output System is the lowest level interface between the computer and peripherals.
The BIOS performs integrity checks on memory and seeks instructions on the Master Boot Record (MBR) on the floppy drive or hard drive.

2. The MBR points to the boot loader (GRUB or LILO: Linux boot loader).

3. Boot loader (GRUB or LILO) will then ask for the OS label which will identify which kernel to run and where it is located (hard drive and partition specified). The installation process requires to creation/identification of partitions and where to install the OS. GRUB/LILO are also configured during this process. The boot loader then loads the Linux operating system.

4. The first thing the kernel does is to execute init program. Init is the root/parent of all processes executing on Linux.
5. Based on the appropriate run-level, scripts are executed to start various processes to run the system and make it functional.

After the kernel is booted and initialized, the kernel starts the first user-space application. This is the first program invoked that is compiled with the standard C library.

The init process is the last step in the boot procedure and identified by process id “1”. Init is responsible for starting system processes as defined in the /etc/inittab file. Upon shutdown, init controls the sequence and processes for shutdown. The init process is never shut down. It is a user process and not a kernel system process although it does run as root.

NOTE: In some modern distro’s there isn’t a /etc/inittab file like Ubuntu they used Upstart.
and there is /etc/event.d which configure init.

Linux init Run Levels:
~~~~~~~~~~~~~~~~~
there is a run levels that you can run your system on it.every runlevel has it’s Specifications:
runlevel 0 : System halt-> be safely powered down.
runlevel 1 : Single user-> login as root user.
runlevel 2 : Multiple users, no network.
runlevel 3 : Multiple users, command line -> the standard runlevel for most Linux-based server hardware.
runlevel 4 : User-definable
runlevel 5 : Multiple users, GUI -> the standard runlevel for most Linux-based desktop systems.
runlevel 6 : Reboot; used when restarting the system.

Every distro may has it’s own runlevel but it stay 7 runlevels from 0 to 6 for more detail you canCheck this .

By default Linux boots either to runlevel 3 or to runlevel 5. to know which runlevel you are in type:

runlevel

you can run your system on any runlevel by typping

init#

when # is the number of the runlevel you want.

Init in the / directory:
~~~~~~~~~~~~~~~~~
/etc/init.d: this directory contains every script that Init use it.

/etc/rc#.d : this directories contain the scripts which will be runed when you run your system in a specify runlevel

you can see the contents of this directories is a links which links to scripts in/etc/init.d.

/etc/rc#.d/README: this file contains an info about the parent directory.

/etc/init.d/README: this file contains an info about The Init process and the Scripts which located in /etc/init.d.

——

so it was a simple view over the Init process and how it works.

any feedback is welcomed.

Best wishes,

aboelnour

fig1

Posted in linux | Leave a Comment »

Freedom Day @ Alexandria University

Posted by aboelnour on September 6, 2009


n124455764728_397

Peace be upon you:

In last few Days a Big Event started at our university “SFD” Software Freedom Day.

It is a big and really good event it started 1st September and Last for 2 weeks.

The event contain presentations and study groups and a lot of nice things

talked about open source field .

Before the event started the Organizers announced that they need a speakers

to talk in Specific fields.

Among this fields there were”Linux” field.

so I become very happy so I started to build my presentation about Linux.

Saturday 6 September 11 A.M. was my time to give the presentation and it’s

1 hour long.

so I went and give the presentation it was really a nice day and the Attendance and my friends have a good Impression.

thanks allah.

Many thanks to the Organizers of this event.

Especially my friends Khaled , Emara and every one help me many thanks.

to Download the presentation here

Best wishes,

aboelnour

Posted in linux | 4 Comments »

/proc Tuning Your System Performance

Posted by aboelnour on August 24, 2009


19571-radio-tuning

Peace be upon you:

we will talk about the /proc directory in your file system in linux,so enjoy 🙂

I know the article is long but it really Deserves.

======

The /proc directory is a strange beast. It doesn’t really exist, yet you can explore it. Its zero-length files are neither binary nor text, yet you can examine and display them. This special directory holds all the details about your Linux system, including its kernel, processes, and configuration parameters. By studying the /proc directory, you can learn how Linux commands work, and you can even do some administrative tasks.

Under Linux, everything is managed as a file; even devices are accessed as files (in the /dev directory). Although you might think that “normal” files are either text or binary (or possibly device or pipe files), the /proc directory contains a stranger type: virtual files. These files are listed, but don’t actually exist on disk; the operating system creates them on the fly if you try to read them.

The /proc directory itself is created every time you boot your box. You need to work as root to be able to examine the whole directory; some of the files (such as the process-related ones) are owned by the user who launched it. Although almost all the files are read-only, a few writable ones (notably in /proc/sys) allow you to change kernel parameters. (Of course, you must be careful if you do this.)

/proc directory organization :
1

The numbered directories (more on them later) correspond to each running process.Some virtual files provide hardware information, such as /proc/cpuinfo, /proc/meminfo, and /proc/interrupts. Others give file-related info, such as /proc/filesystems or /proc/partitions. The files under /proc/sys are related to kernel configuration parameters.

The cat /proc/meminfo command might bring up something like this:
2

If you try the top or free commands, you might recognize some of these numbers. In fact, several well-known utilities access the /proc directory to get their information. For example, if you want to know what kernel you’re running, you might try uname -srv, or go to the source and type cat /proc/version.

Some other interesting files include:

/proc/apm: Provides information on Advanced Power Management, if it’s installed.

/proc/acpi: A similar directory that offers plenty of data on the more modern Advanced Configuration and Power Interface. For example, to see if your laptop is connected to the AC power, you can use cat /proc/acpi/ac_adapter/AC/state to get either “on line” or “off line.”

/proc/cmdline: Shows the parameters that were passed to the kernel at boot time. In my case, it contains root=/dev/sda10 ro quiet
which tells me which partition is the root of the filesystem,and more.

/proc/cpuinfo: Provides data on the processor of your box. For example, in my laptop, cat /proc/cpuinfo gets me a listing that starts with:

/proc/filesystems: Shows which filesystem types are supported by your kernel. A portion of this file might look like this:
3

The first column shows whether the filesystem is mounted on a block device. In my case, I have partitions configured ext3 mounted.

/proc/mounts: Shows all the mounts used by your machine (its output looks much like /etc/mtab). Similarly, /proc/partitions and /proc/swaps show all partitions and swap space.

What’s in a process?

As I said, the numerical named directories represent all running processes. When a process ends, its /proc directory disappears automatically. If you check any of these directories while they exist, you will find plenty of files, such as:

cmdline: Contains the command that started the process, with all its parameters.

cwd: A symlink to the current working directory (CWD) for the process; exe links to the process executable, and root links to its root directory.

environ: Shows all environment variables for the process.

fd: Contains all file descriptors for a process, showing which files or devices it is using.

Conclusion

The /proc special directory provides full detailed information about the inner workings of Linux and lets you tuning many of its configuration. If you spend some time learning all the possibilities of this directory, you’ll be able to get a more perfect Linux box. And isn’t that something we all want?

======

it was a simple look on the /proc directory 😀 any feedback is welcomed.

regards,

aboelnour.

Posted in linux | Leave a Comment »

Be root in Debian Using sudo

Posted by aboelnour on August 23, 2009


Peace be upon you:

In last few days I installed Debian 5.0 and as usual I need to deal with System Files.

so I Opened my Dear Terminal and typing sudo and the surprise become there is no Sudo in Debian so How can I get the root privileges?

Run in terminal:

su –

and enter your root Password and deal.

The hyphen argument (-) to su instructs it to behave as if root had logged in on the console, so that it executes whatever shell customizations are set up. The root user has the home directory /root by default, and using su - will place you in that directory. Terminate the root session by exiting the shell with Ctrl-D or exit.

Using su to start a root shell session is almost as tempting for bad habits as a console login, however. Although you can give the --command option to su to execute a single command, rather than entire shell, retyping root’s password each time becomes tiresome. Furthermore, using su means that you have to share the root password with anyone else who wants to run a program as root. Additionally, you can’t restrict what those users can do as root. It may well be that you want them to run only one or two commands that require root privileges, not have dominion over your entire system.

The sudo program provides a solution to these problems and allows a more flexible and controllable approach to get root privileges. Install it by becoming root with su and using the aptitude package manager to install the software.

To install sudo Run in terminal:

su –

aptitude install sudo

then Run in terminal:

su –

visudo

this will start up text editor showing sudo’s configration file which is /etc/sudoers

find the line which contain this line:

root ALL=(ALL) ALL

copy it ,substituting your username for root and paste it under this line.

then save and exit.

now test if sudo work or not Run in terminal:

whoami

the answer must be your user name

now run in trminal:

sudo whoami

the answer must be root if sudo work.

so that’s it any feedback is welcomed

regards,

aboelnour

sudo_square_0

Posted in linux | Leave a Comment »

APT (Advanced Packaging Tool)

Posted by aboelnour on August 8, 2009


apt

Peace be upon you:

last Article we talked about installing a program from it’s source code and we said that way become recursive 😀 and more difficult so there is a magic stick in Linux called PMS (Package Management system) this tool enable the users to deal with programs without suffering .

A package management system is often called an “install manager”.This can lead to confusion between
a package management system and an installer.

The PMS :

1) Typically part of the operating system.

2) Can verify and manage all packages on the system.

The installer :

1) Each product comes bundled with its own installer.

2) Only works with its bundled product.

we will talk about the APT (Advanced Packaging Tool) the PMS for Debian distribution and other distribution which based on Debian like ubuntu.

======

1) APT :

* Definition:

– The Advanced Packaging Tool, or APT, is a free user interface that works with libraries to handle the installation and removal of software on the Debian GNU/Linux operating system and its variants.

– APT simplifies the process of managing software on your computer systems by automating the removal ,configuration and installation of packages, either from binary files or by compiling source code.

* Functions :

– Apt can be functionally considered to be a front-end to dpkg, While dpkg performs
actions on individual packages, apt tools manage relations (especially dependencies) between them.

Apt have alot of tasks like:

1)  Update is used to resynchronize the package index files from their sources from /etc/apt/sources.list.
2) Upgrade is used to install the newest versions of all packages currently installed on the system from the sources listed in /etc/apt/sources.list.
3) dist-upgrade in addition to performing the function of upgrade,also intelligently handles changing dependencies with new versions of packages.

* Configuration and files :

/etc/apt : has the apt configuration folders and files.
/etc/apt/ : sources.list : Locations to fetch packages from.
/etc/apt/apt.conf : APT configuration file.
/var/cache/apt/archives/ : storage area for retrieved package files.
/var/lib/apt/lists/ : storage area for state information for each package resource specified in sources.list.

* Sources :

so the important Question now is from where the APT gets it’s archives

and packages ?

it gets it’s programs from Repositories In order to give users more control over the kinds of software that they are allowing to be installed on their system , software is often downloaded from a number of software repositories.

– APT relies on the concept of repositories in order to find software and resolve dependencies.
For APT, a repository is a directory containing packages along with an index file.
This can be specified as a networked or CDROM location. The Debian project keeps a central repository
of over 25,000 software packages ready for download and installation.

– For extra packages, any number of additional repositories can be added to APT’s sources.list configuration
file (/etc/apt/sources.list) and then be queried by APT.

– Graphical front-ends (like Synaptic Package Manager) often allow modifying source.list more simply(apt-setup).

Once a package repository has been specified, packages in that repository can be installed without specifying a source.

2) APT Throw The Terminal :

NOTE : The next commands must insert sudo before it to obtain the root privileges.

a) commands dealing with installing and removing :

apt-get update

to refresh the repositories.

apt-get install programName

to install new program.

apt-get upgrade

to upgrade all packages on your system

apt-get dist-upgrade

to upgrade your distribution like your kernel version

apt-get remove programName

to remove a program but this command will keep the program confi files in your home

apt-get –purge remove programName

to remove a program and remove his config files from your home

b) commands dealing with programs database (searching ,….) :

apt-cache search programName

to search on program with his name.

apt-cache showpkg programName

to view every information about this package and it’s libraries and dependencies.

apt-cache dumpavail

to view every package come with your distribution and view information about it.

apt-cache pkgnames

to view all package which is one your system.

apt-get autoclean

to remove the unneeded .deb packages ,when you install a program the apt download the .deb package and the libraries which program need then install the program and he left the .deb package, so this command will remove

the unneeded .deb packages

======

so that’s it any feedback is welcomed .

best wishes,

aboelnour.

Posted in linux | Leave a Comment »

Setup from a source file

Posted by aboelnour on August 3, 2009


final

Peace be upon you:

Our article today is about install programs and applications from their source code in Ubuntu .

Requirements: basic knowledge about APTand Packages.

======

1) why install from the source?

some programs don’t exist as .deb package, so the default way is the program come in source code and can be used on different distributions and different OS’s.

2) How can i differentiate between the package and the source code files?

The package file come with extension .deb , .rpm , .tgz , .bin, but the source file come with extension .tar.gz , .tar.bz2 , .zip

and after extract it you will find files like README ,INSTALL , configure , makefile.

3) How can i install a program from package file or a source file?

from package file just let your dpkg work by double click on the package will finish your installation.

from a source file it is what the article talked about.

4 stages and you will finish your installation from source:

Stage #1 >> preparation :

just extract the source file with your desktop environment or with your terminal

tar xvzf  fribidi-0.10.9.tar.gz

tar xvjf  fribidi-0.10.9.tar.bz2

unzip fribidi-0.10.9.zip

it will generate a new file called  fribidi-0.10.9 so run in terminal:

cd fribidi-0.10.9

Stage#2 >> read instructions and sure from the dependents :

every program to run need a libraries so how you know the libraries needed?

* read the instructions on the web site which you download the file.

* read the README , INSTALL file.

some things is required to install from source:

GCC, build-essential (for distributions which based on debian),make,g++ , automake , autoconf , glibc-devel

Don’t started without be sure that you provide this requirements and the program dependencies.

Stage#3 >> Installation :

a) the configuration operation

run in terminal:

./configure

this command task is to be sure that the program requirements and libraries are exist.

if the requirements and libraries are exist a new file will be created called “MakeFile”.

if not an error message will appear.

NOTE : There’s a possibility that you don’t have a configure file. Anyway,still you have autogen.sh ,Type ./autogen.sh to generate configure file.

b) the Build operation

run in terminal:

make

here the program be built .may this operation take a long time depends on the program size.

c) The installation operation

run in terminal

make install

Stage#4 >> clean :

run in terminal

make clean

task: to remove the unneeded files after installation.

to remove your program run in terminal

make uninstall

====

Disadvantage of setup from source:

the main problem is in the Stage#2 because the program may want a lot of  libraries and this libraries want another libraries so the Stage will become recursion 😀 so in some times this Stage become impossible.

so there is the magic stick  PMS (Package management system ) like APT,RPM and yum.

this tools save your time and your efforts to bring the program to you and install it.

====

Methods can help you to install from source:

1) if you want a source file from a repository you have :

to bring the source file from the repository run :

sudo apt-get source programName

and to install the source file run :

sudo apt-get build-dep programName

if you want to make a package to this source file run :

dpkg-buildpackage -rfakeroot

you can install the .deb package that you made by running :

sudo dpkg -i programeName.deb

2) if you have a source file you can use the tool “auto-apt” run :

sudo apt-get install auto-apt

and redo the 4 stages but with this commands with the same arrange :

auto-apt run ./configure
make
sudo make install

this tool make Stage#2 more Easier by bring the Headers that your program need.

======

so that’s it any feedback is welcomed

Best wishes,

aboelnour.

Posted in linux | 2 Comments »

your fstab file

Posted by aboelnour on August 1, 2009


One cogwheel

Peace be upon you:

our article today is about the /etc/fstab file.

Target: to get a good knowledge about the fstab file to deal with partitions and mounting.

Requirements: knowledge with the mounting commands and Basic Knowledge about hard partitioning in linux.

======

the fstab file is one of very important files in linux directory structure

The file pass his configurations to the kernel to deal with different file systems ,links the hard disk partitions with others and it has many operations on this partitions.

The main function of this file is used in dual-booting systems where there is more than operating system and each operating system have its partitions with their own format .

if you want to share a partition from operating system to another operating system you need to mount this partition and the mount configurations saved in the fstab file to mount this partition every the system boot.

you can show the contact of the /etc/fstab file

by running in terminal :

cat /etc/fstab

so you will see something like this :

# <file system> <mount point>   <type>   <options>       <dump>   <pass>

proc                         /proc                      proc         defaults            0                  0

/dev/hda1             /                               ext3          defaults,errors=remount-ro 0

1)  fstab syntax :

(Device)   (mount point)   (file system type)   (options)       (dump)   (pass)

-> Device :

The device/partition (by /dev location or UUID) that contain a file system (The physical path).

By Default Ubuntu Using the UUID to identify partitions.

to list your devices by UUID run in terminal:

sudo blkid

->Mont Point:

The location that you created to mount in it the Device the default location is /media you can use /mnt or your /home

as a mount point

->File Sytem type:

You may either use auto or specify a file system. Auto will attempt to automagically detect the file system of the target file system and in general works well. In general auto is used for removable devices .

Exampels:

  • auto
  • vfat – used for FAT partitions.
  • ntfs, ntfs-3g – used for ntfs partitions.
  • ext2, ext3, jfs, etc.
  • iso9660 – for CD/DVD.
  • swap

-> Options:

Mount options of access to the device/partition.

Examples:

1) defaults

the option “defaults” contain other options in it :

rw : that’s mean the mounted device will have the permission to read and write

auto : that’s mean the device will mounted automatically

and other options like : suid, dev, exec, nouser, and async.

2) ro

that’s mean the mounted device will be read-only

3) noauto

that’s mean the mounted device won’t mount when Booting

4) user

that’s mean any user in the system can mount this device but the one who mount the device only he can unmount it

5) users

that’s mean any user can mount this device and any user can unmount it

6) exec / noexec

Permit/Prevent the execution of binaries from the device.

NOTES:

1) you can use many options seperate between every option” , ” COMMA.

2) for more options run in terminal man mount

-> Dump:

this field take only 0 or 1.

1 : The backup utility dump will backup file system.(to use this the tool dump must be installed).

0 : Ignore backing up the device.

-> Pass

this field also take only 0 , 1 and 2 and indicating if the device must be checked in booting stage or not

0 : Device ignored.

1 : Check this device first.

2 :  Check this partition(s) next ,all partitions marked with a “2” are checked in sequence and you do not need to specify an order.

2) related commands :

to edit in the fstab file:

sudo gedit /etc/fstab

To get a list of all the UUIDs, use one of the following two commands:

sudo blkid

ls -l /dev/disk/by-uuid

To list the drives and relevant partitions that are attached to your system, run:

sudo fdisk -l

To mount all file systems in /etc/fstab run:

sudo mount -a

======

so that’s it any feedback is welcomed

best wishes,

aboelnour

Posted in linux | Tagged: , , , , | Leave a Comment »

When your Linux Lock

Posted by aboelnour on July 31, 2009


blue_lock main

Peace be upon you:

How many times your system stop working suddenly?

sure a lot in windows and you will use the ALT+CTRL+DELETE to kill any harm process.

so there is any alternative way in linux?

linux rarely stop working and any harm process don’t give you a response Linux make a force quit to it

but… what can i do if the all system don’t give me a response ?

As i said ” linux rarely stop working ”  but may be there is an error with your GUI  – linux Separated between code and GUI Reverse Window$ if GUI fall all system fall – so what’s the solution?

press ALT+CTRL+F1

And run :

       

/etc/init.d/kdm restart

or

/etc/init.d/gdm restart

to restart your desktop environment .

#1 for KDA  And #2 for GNOME.

but what if it doesn’t work ? should i press the RESTART button?

No, there is a magic button call SysRq this button also called print Screen on your key bored

first you must know if your kernel support this button

run in terminal:

grep CONFIG_MAGIC_SYSRQ /boot/config-`uname -r`

if the answer was

CONFIG_MAGIC_SYSRQ=y

so your kernel support this button so you can follow

How to use this button?

Alt + SysRyq + button

Button is one of this options:

k : to kill any process

r : to reset your keybored

s : to Synchronize your hard disk (save any data in the buffer)

e : finish all process

i : finish all programs which hasn’t finished yet

u : make all your mounted devices READ-ONLY

b : restart your computer (last option)

o : shut down your computer

p : show an information about your processor

======

By the way how many one type his password in the login window and it didn’t written because the Numlock button is switched off ?!

here is the solution

run in terminal

sudo apt-get install numlockx

then run

gksudo gedit /etc/gdm/Init/Default

then add in the open file this:

if [ -x /usr/bin/numlockx ]; then

/usr/bin/numlockx on

fi

so the file will be on this form after editing in it :

#!/bin/sh

# Stolen from the debian kdm setup, aren’t I sneaky

# Plus a lot of fun stuff added

#  -George

if [ -x /usr/bin/numlockx ]; then

/usr/bin/numlockx on

fi

PATH=/usr/bin/X11:/usr/X11R6/bin:/opt/X11R6/bin:$PATH

OLD_IFS=$IFS

save , exit , restart your computer and see the result

so that’s it any feedback is welcomed

regards,

aboelnour

Posted in linux | Tagged: , , | Leave a Comment »

How Your Computer Boot?

Posted by aboelnour on July 30, 2009


boot

Peace be upon you:

How are you? in this article we will talk about the BOOT operation on your computer so read and enjoy 🙂

==========

History :
~~~~~~~~~~~~~~~~~~~~

* The Computer word boot is short for “bootstrap” (short for ‘bootstrap load”)

* The term bootstrap began as a metaphor derived from pull straps sewn onto the backs of leather boots with which a person could
pull on their boots without outside help

* In 1950’s when you press a bootstrap button caused a hardwired program to read a bootstrap program from apunched card
and then execute the loaded boot program which load ed a larger system of programs from a punched cards into memory ,
without further help from the human operator
so this word has been used at least 1958

Introduction :
~~~~~~~~~~~~~~~~~~~~

* A computer’s central processor can only execute program code found in Read-Only Memory (ROM) and Random Access Memory (RAM).
Modern operating systems and application program code and data are stored on nonvolatile data storage devices, such as hard disk drives,
CD, DVD, USB flash drive, and floppy disk. When a computer is first powered on, it does not have an operating system in ROM or RAM.
The computer must initially execute a small program stored in ROM along with the bare minimum of data needed to access the nonvolatile
evices from which the operating system programs and data are loaded into RAM.

* The small program that starts this sequence of loading into RAM, is known as a bootstrap loader, bootstrap or boot loader.
This small boot loader program’s only job is to load other data and programs which are then executed from RAM. Often,
multiple-stage boot loaders are used, during which several programs of increasing complexity sequentially load one after the other in a
process of chain loading.

Second-stage boot loader :
~~~~~~~~~~~~~~~~~~~~

* The small program which loaded is most often not itself an operating system, but only a second-stage boot loader, such as GRUB, BOOTMGR, LILO or NTLDR.
It will then be able to load the operating system properly, and finally transfer execution to it. The system will initialize itself, and may load device
drivers and other programs that are needed for the normal operation of the OS.

* Many bootloaders (like GRUB, BOOTMGR, LILO, and NTLDR) can be configured to give the user multiple booting choices. These choices can include
different operating systems (for dual or multi-booting from different partitions or drives), different kernel versions of the same operating system
(in case a new version has unexpected problems), different kernel options (e.g., booting into a rescue or safe mode) or some standalone program that can
function without an operating system, such as memory testers (e.g., memtest86+) or even games.[9] Usually a default choice is preselected with a time delay
during which you can press a key to change the choice, after which the default choice is automatically run, so normal booting can occur without interaction.

* The boot process is considered complete when the computer is ready to interact with the user, or the operating system is capable of running ordinary
applications. Typical modern PCs boot in about one minute (of which about 15 seconds are taken by a power-on self test (POST) and a preliminary boot loader
, and the rest by loading the operating system, pre-OS time can be considerably shortened by bringing the system with all cores at once, as with coreboot[10]
in as little as 3 seconds[11]; whereas, large servers may take several minutes to boot and start all their services.

Boot device :
~~~~~~~~~~~~~~~~~~~~

* The boot device is the device from which the operating system is loaded. A modern PC BIOS supports booting from various devices,
typically a local hard disk drive (or one of several partitions on such a disk), an optical disc drive, a USB device
(flash drive, hard disk drive, optical disc drive, etc.), or a network interface card (using PXE). Older, less common bootable devices include
floppy disk drives, SCSI devices, Zip drives, and LS-120 drives.

* Typically, the BIOS will allow the user to configure a boot order. If the boot order is set to “firstly, the DVD drive; secondly, the hard disk drive”,
then the BIOS will try to boot from the DVD drive, and if this fails (e.g. because there is no DVD in the drive), it will try to boot from the local hard drive.

Booting Sequence  :
~~~~~~~~~~~~~~~~~~~~

* Upon starting CPU runs the instruction located at the memory location  of the BIOS It typically contains a jump instruction that transfers
execution to the location of the BIOS start-up program. This program runs a power-on self test (POST) to check and initialize required devices.
The BIOS goes through a pre-configured list of non-volatile storage devices (“boot device sequence”) until it finds one that is bootable.
A bootable device is defined as one that can be read from, and the last two bytes of the first sector contain the word 0xAA55 (also known as the boot signature).

* Once the BIOS has found a bootable device it loads the boot sector and transfers execution to the boot code.
In the case of a hard disk, this is referred to as the master boot record (MBR) and is often not operating system specific The conventional MBR code
checks the MBR’s partition table for a partition set as bootable (the one with active flag set)[12]. If an active partition is found, the MBR code loads
the boot sector code from that partition and executes it. The boot sector is often operating system specific, however in most operating systems its main
function is to load and execute the operating system kernel, which continues startup. If there is no active partition, or the active partition’s boot sector is invalid,
the MBR may load a secondary boot loader which will select a partition (often via user input) and load its boot sector, which usually loads the corresponding operating system kernel.

Rebooting  :
~~~~~~~~~~~~~~~~~~~~
Hard reboot :

A hard reboot is when power to a computer is cycled (turned off and then on) or a special reset signal to the processor is triggered. This restarts the
computer without first performing any shut-down procedure. (With many operating systems, especially those using disk caches, after a hard reboot the
filesystem may be in an “unclean” state, and an automatic scan of on-disk filesystem structures will be done before normal operation can begin.)

Soft reboot :

A soft reboot is restarting a computer under software control, without removing power or (directly) triggering a reset line. It usually,
though not always, refers to an orderly shutdown and restarting of the machine.
This kind of reboot will not usually reset the hard disks, so that they have time to update their write cache to permanent storage.
Hard disks will also keep their configuration (like C/H/S adjustments, HPA, DCO, internal passwords…) over these reboots.

==========

For the old days take this one 😀

AwardBIOS_startup

so that’s the end for now any feed back are welcomed

best wishes,

aboelnour

Posted in general | Leave a Comment »

 
%d bloggers like this: