TODAY -

Windows/Linux Booting process
- Part 1 -

sinuxs *



There're lot of interesting (for me; i don't know for others) things hapenning under the hoods of a computer, a fraction of second after we press the power button (to start the computer). The decription explained here is a gleam of my experience on my own machine and from other sources; and is taken Intel(including AMD) as an example.

While the PC architecure is open since its inception in the early 80s, the explanation here is assumed to be consistent for my machine but may possibly be inaccurate for other. However, one can take a general perception though.

When you press the power button, the AC current from your wall socket surges into your power supply (or adapter, in case of laptop) and gets converted into various DC supplies which are eventually fed into the Motherboard and its various hardware components. This is where your computer is ready to start off. Your computer at this stage is suffering from 'Amnesia'- Loss of memory.

It doesn't remember anything which was happened before your last shutdown. you can blame(or flame?) it to the non-volatile nature of the RAM sticks! As this is so, it has to start loading the OS to run any user applications.

The next obvious question is - what is the first address the CPU accesses when your computer is started for the first time? Depends on the architecture. For the Intel(x86 from now on) architecture, the designer has been hardcoding the intial address to be : 0xFFFFFFF0 (reset vector), which is just a 16 byte down the 4GB. This address contains a JUMP to the first instruction of BIOS which is located at the last 64K segment of the first 1MB.

Why a JUMP? Is this necessary or is it that the Intel designers are a JUMPER . It's necessary because the x86 computer following a restart starts from 16 bit processor called 'Real mode' which sees only 1MB of memory space. And you may logically asks me how the CPU starts first with the address '0xFFFFFFF0'(see above) in this 1MB restricted mode.

Again, blame on to the Intel designers. They hardwired all the x86 procesors to anyhow starts the computer with this exceptional protected mode address. A protected mode is the full 32 bit processor with the 4GB address space. Coming to the point, we need a JUMP so that the CPU will restrictively operate in real mode and hence points to the last 64K segment of the first 1MB memory. The BIOS loads there so that the CPU will always execute the BIOS code following a restart/power-on of a computer.

Now, after the JUMP, the control (of execution) will go to the first instruction of BIOS and from now on, BIOS will take the control of execution. If you ask me why only the 1MB address space in real mode, I would say this time to blame on Intel(Early PC) and Microsoft(DOS). Actually, it's not their faults. During the early 80's when the PC was introduced, 1MB of memory was just unthinkabl!y and unanimously a huge memory then and had taken off with the decission.

The intention was to divide the 1MB address space into 16 segments of 64k bytes. We called them as the 16 segments of real mode. The Intel/Microsoft strategy was to allocate the first 10 segments (10*64k = 640K) called a 'conventional memory' to user programs and DOS and the remaining 6 segments(6*64k = 384K) to BIOS and BIOS areas. The last segment (16th segment) is the BIOS area where the computer first jumps into following a computer restart.

The last 6 segments of the real mode cannot be accessible even to DOS and other user programs and hence we could say that there is a HOLE in the first 1MB address space from 640K to 1023K (1MB). Somebody has rightly said this as the infamous 384K HOLE of real mode. A memory hole, in general, is a region of physical memory where an OS cannot allocate it to a user application. They can be because of the above ROM BIOS mapping or because of I/O device mapping.

I/O devices like Video RAM are often mapped into the physical RAM for effeciency purpose(through ioremap() in Linux kernel) and these are treated as 'Reserved' and hence treated as a 'HOLE' regions.

Now, let's come to the booting process. We jump into the BIOS code post restart. The BIOS code, as we're refering currently, is the Motherboard BIOS which comes with a chip embedded on it. It consists of POST code and 16bit drivers of all legacy hardware components - Keyboard, Mouse, Disk, various controllers and a setup-program called CMOS/BIOS setup. A computer system also has other BIOS code coming in along with Adapter cards like Video card, SCSI controller etc.

Motherboard BIOS has roughly the following responsibilites:-
= Execute other BIOS code(Video BIOS, SCSI BIOS etc), if present and as and when required.
= Check whether the booting is 'Cold boot' or 'Warm boot'.
= POST (Power-On Self Test) - Detecting, Initializing hardware components.
= IVT(Interrupt Vector Table) Setup - Loading 16 bit BIOS drivers. (part of POST)
= Allows the user to configure the BIOS setting through CMOS/BIOS editor utility.
= Displays the available final hardware settings - CPU, Memory, PCI controllers, SCSI controllers etc.
= Read the bootable disks. Load the first sector of the boot disk and pass on the control to it.

Running other BIOSes (Adapter's):
= The first of the activities done by the Motherboard(main) BIOS is to jump into the video BIOS code. This is when the screen shows the BIOS manufacturer Logo(Phoenix, in my case) and telling you that the video adapter is initializing and off course is workng properly!

The main reason the adapter card(like Video card/controller) has their own BIOS is probably the way to extend the main BIOS code and may be for some other extra features, the manufacturers(of the cards) want to initiate while the card is initialized with. How did the main BIOS finds the locations of other adapter's BIOS? The x86 architecture insists the adapter card manufacturers to map their BIOS from 0xC000(12th segment) to 0xF0000(15th segment).

The 16th segment, as mentioned earlier, is for the BIOS(main) code. The main BIOS starts looking for other adapter's BIOS from 0xC000. The main BIOS starts looking from this address a signature "0xAA55" for every 2K bytes successively till 0xF0000.The signature, if there, identifies that the segment is an adapter's BIOS. The following byte after this signature will give the size of the BIOS in 512 bytes chunks.So,the main BIOS will start looking for this signature for the video BIOS code at 0xC0000. It jumps into it and initializes the video card and all those logo (Energy),BIOS manufacturer details, CPU vendor and speed, Memory size etc. are shown up.

This is the first phase of POST. Once the video BIOS is executed, the control comes back to the main BIOS code. POST (Power-On Self Test): = POST test (a black screen at the computer startup) is done to find and initialize the hardware components(Physical drives, RAM, CD/DVD drives, Expansion slots, Keyboard, Mouse etc) so that an OS can be loaded. It consists of various POST tasks and any one of them fail would bring down the system. The error code of, if any of them is failed, will be written to '0x80h'(this is for Phoenix BIOS - mine. you may see your BIOS manufacturer datasheet to verify the same).

The error handler of the POST routine will decode the error codes and send to the display(if video adapter is working) or into a beep codes. Some of the POST tasks are mentioned below:-
- Initialize CPU registers
- Initialize I/O component
- Initialize the local bus IDE
- Initialize Power Management
- Initialize PCI Bus Mastering devices
- Initialize keyboard controller
- 8254 timer initialization
- 8237 DMA controller initialization
- Reset Programmable Interrupt Controller
- Test DRAM refresh
- Test CPU bus-clock frequency
- Advanced configuration of chipset registers
- Initialize interrupt vectors
- Initialize hard-disk controllers
- Set up Power Management
- Initialize the chipset
- Initialize the CPU
- Initialize PCI and DMA

You may check your BIOS manaufacturer manual for finer detail on the possible POST activitied from the error codes your BIOS is hardcoded.

One of the important functions done during POST is the initialization of IVT (Interrupt Vectore Table). The IVT is an array of 4 bytes pointers to interrupt routines. There is 4bytes for each IVT entry because the first 2bytes will give the segment address and the remaining two bytes will give the offset in the segment.

There are 256 interrupts define for real mode and hence the first 1024bytes (256*4) is occupied by IVT. You cannot press 'F2' or 'DEl' or 'F10' to enter the BIOS configuration without this IVT setup. The pressing of keystroke (will invoke IRQ1) fires the keyboard driver and displays the BIOS/CMOS configuration utility. Hence,

IVT setup is necessarily done before the computer displays something like, "Press 'F10' to enter BIOS/CMOS" etc. When all hardware components are set and proper, the BIOS code will determine the boot-disk sequence from the CMOS RAM. Well, before going further, let's go into a little bit about CMOS/RAM. CMOS/RAM is a chip comprises of RTC (Real Time Clock) and a RAM.This chip is powered by a button-like baterry. The CMOS chip is consuming a very low power(CMOS technology) that a battery can power it upto a maximum of 5-10 years.

With this battery,your computer can remember all the hardware components configurations and most importantly the date and time of the day. There are two parts of CMOS/RAM - user configurable data and static hardware configuration data. The user configurable data is the one we can change by pressing 'DEL' or 'F10' or 'F2' (depends on your BIOS manufacture). Here, you can change the booting sequence, master/secondary slave of IDE controller, change the date/time and some other parameters.

The other part of CMOS/RAM contains the non-changeable data of your hardware components like - the type of hard disk, the type of RAM(SDRAM, DDRAM,RDRAM etc), keyboard/mouse type,video display type(MDA/CGA/VGA etc) to name a few. The BIOS during its POST activity needs to know the type of your hardware to properly called its corresponding driver and probing as to whether it's correct or not. Any inconsistency with the hardware information present in CMOS/data and what's actually found after probing will halt the POST process.

In a sense, what we can conclude with this CMOS/RAM information is that there's a fair chance your computer will not boot properly if there's a problem in your button-battery causing the loss of CMOS/RAM data and ultimately (your) BIOS will not continue its POST activities. Now, coming to booting procedure, the BIOS after POST, will keep on searching a bootable disk from the sequence and load the first one which is found.

How does the BIOS code determines a bootable disk? Good question. A disk having a magic number "0xAA55" at the end of its first sector is a bootable disk. So, every bootbale disk will have this signature at the end of their first sector and this is how a BIOS knows and displays "No bootable disk ..." in the absence of any bootable disk or when a bootable disk drive is corrupted.

(Next: Windows vs Linux booting)
Linux kernel is an addict. Hardware is the driver of its existency. Join the community to make this open-source kernel, the best of its kind, as it is and for will be in the future.

Sign-off,
A Kernel junky.


* sinuxs (A pseudonym and a "kernel junky" ) contributes to e-pao.net regularly. The writer can be contacted at sinuxs(at)yahoo(dot)com
This article was webcasted on November 16th, 2009.




* Comments posted by users in this discussion thread and other parts of this site are opinions of the individuals posting them (whose user ID is displayed alongside) and not the views of e-pao.net. We strongly recommend that users exercise responsibility, sensitivity and caution over language while writing your opinions which will be seen and read by other users. Please read a complete Guideline on using comments on this website.




LATEST IN E-PAO.NET
  • Lok Sabha polls in Manipur #2 : Gallery
  • Violence in Manipur 2023-2024 : Timeline
  • The Taj Mahal that bans Lovers !
  • Importance of bees !
  • Massive hailstorm in Jiribam
  • The messiah of hapless children
  • Attack on fuel tankers & blasting bridge
  • Blame it on Meetei
  • The Happiness Code : Download
  • NH-2 Bridge bombed @Sapermeina : Gallery
  • Crop/animal for higher productivity in NE #1
  • Training Programme under SPARK concluded
  • Why environment control is so difficult
  • 4th Foundation Day- Young Minds Collective
  • All set for second phase poll
  • The Nongsaba phenomenon
  • Khongjom Day @Khebaching #1 : Gallery
  • India's responsibility to end Manipur violence
  • Migrant worker could access TB services only
  • Importance of reading magazines as student
  • SHG pioneering agricultural innovation
  • Nearing the one year mark
  • The enemy within
  • Id-ul-Fitr @Hatta #2 : Gallery
  • Workshop @ NSU Manipur : Gallery
  • 15th Manipur State Film Awards 2023
  • "ST status for Meetei" at Panthoibi Shanglen
  • GSDP doubles, health shines
  • Vote has been cast, repoll held
  • Two faces of democracy
  • Laurels for Scientist Ngangkham Nimai
  • Crime against women in Manipur
  • "ST status for Meetei" at Sugnu
  • Creativity & innovation for vibrant career
  • 4th Foundation Day of YMC
  • Racing towards one year mark
  • Prophetic words, indeed
  • Nupi Landa Thaunaphabishing #14 :: Book
  • 174th Anniv Maharaj Narasingh #1 : Gallery
  • Ensuring Fair Voting in Hills of Manipur
  • Dr Irengbam Mohendra's latest book :: Rvw
  • NDA has the advantage in both
  • Lok Sabha polls in Manipur #1 : Gallery
  • L Rup's Robot 'Kangleinganbi' in Manipuri
  • Art- means of connecting hearts in Manipur
  • Is it Living Alive or Living Death ? :: Poem
  • Rabies - A preventable zoonotic disease
  • April 19, 2024: The blackest day of all
  • Ugly turns on voting day
  • Children Camp @JNMDA Imphal #2 : Gallery
  • The chasm between TB & HIV continues
  • Parliament and its Members
  • Kimchi for health and glowing skin
  • LS election with a difference
  • To vote, or not to vote ?
  • Sajibu Cheiraoba Chak Katpa #2 : Gallery
  • "ST status for Meetei" at Lamjao, Kakching
  • The Power of Poppy - 27 :: Poem
  • Mother Language based education essential
  • Modi's warriors wear regional hats
  • Nest Asia promoting Northeastern Cuisine
  • Now look beyond LS poll
  • The rot in the system
  • Scientists of Manipur : Laitonjam Warjeet
  • Community seed bank @Umathel : Gallery
  • 10 candidates cracked Civil Services Exam
  • Milk of Paradise: History of Opium : Rvw
  • How plastics find their way into our bodies
  • Condemning attack on Trucks along NH-37
  • Cong looking to buck the trend
  • Saving Manipur
  • Sajibu Cheiraoba: 1 occasion, 2 narratives #2
  • Election Duty :: Travellog
  • 1st Nagas' Meet in Punjab
  • How to select right MP to represent Manipur
  • "ST status for Meetei" at Tejpur
  • Bats are Keystone species for the Planet
  • The '15 days' conundrum
  • Free but not so fair
  • Descent of Radha-Krishna #30: Download
  • Before You Vote : My Rumbling Thoughts
  • "ST status for Meetei" at Kakching
  • Meiraba wins All India Sr tournament
  • Finding light in dark through my daughter
  • Navigating life's unreasonable expectations
  • Test of people's character
  • BJP's election manifesto
  • Athoubasingi Numit #1 : Gallery
  • Black rice & Glycemic Index
  • What Nadda should speak at Dimapur rally
  • Open Letter to CM Office Manipur
  • Meghalaya unveils Strawberry festival
  • Benefits of maths newspapers for students
  • Id-ul-Fitr @Hatta #1 : Gallery
  • Are you a good person ?
  • Physics Academy of NE : Executive Body
  • "ST status for Meetei" at Moirang
  • Cherrapunji Eastern Craft Gin launched
  • Cong on cautious path
  • Botox for Hair
  • Posers voters should raise now
  • The lull before the storm
  • 80th Anniv- Battle of Kanglatongbi @UK
  • Vir Chakra Ngangom Joydutta's bust unveiled
  • Hun - Thadou Cultural Festival : Gallery
  • "ST status for Meetei" at Singjamei
  • Election Eclipses: Ballad of Battle & Loss
  • Our voices are equal at the ballot box
  • Scientists of Manipur : Ngangkham Nimai
  • Urgent Call for Solidarity in Manipur
  • Meitei Nongsha #2 :: An Artwork
  • "ST status for Meetei" at Waikhong
  • About NPF-BJP-NPP alliance & why ?
  • World Veterinary Day, 2024
  • The heavy stake behind the LS polls
  • The politics of lying & deception
  • Sajibu Cheiraoba Chak Katpa #1 : Gallery
  • Hun-Thadou Cultural Fest @ Delhi: Report
  • Appeal to Parties & Candidates
  • "ST status for Meetei" at Wangoo
  • Establishment of community seed bank
  • Awareness Programme on new Criminal Laws
  • Make a right choice at the Lok Sabha election
  • Sajibu Cheiraoba: 1 occasion, 2 narratives #1
  • RIST talk-58 : Support systems of elderly
  • "ST status for Meetei" at Hiyanglam
  • Vote, do not boycott !
  • Lok Sabha election: A new dawn in politics ?
  • IIT-Guwahati Half Marathon report
  • Taking ST demand to the election ring
  • Lesson to be learnt from across border
  • Mirabai: Poised for Paris Olympics
  • Legal position for protection of environment
  • "ST status for Meetei" at Keisamthong
  • Heterocyclic compound & biochemical science
  • Inner, torn between two lovers
  • Certification Music Therapy Workshop
  • NOTA as a choice
  • Caesar's wife must be above suspicion
  • Descent of Radha-Krishna #29: Download
  • World Health Day 2024
  • "ST status for Meetei" at Pangantabi
  • The Power of Poppy - 26 :: Poem
  • Fulbright Fellowship Outreach at Arunachal
  • Id-ul Fitr da namaz nattana..
  • Nupi Landa Thaunaphabishing #13 :: Book
  • Lok Sabha election is coming, be prepared
  • 6th Hun-Thadou Cultural Festival
  • Let There Be Free & Fair Election
  • "ST status for Meetei" at Lamlong
  • Science magazines are important for student
  • Interesting choice of candidates
  • The power of We, the voters
  • Inspirations from Scientists of Manipur #1
  • The Case for Amendment of Article 371-C
  • Meitei Nongsha #1 :: Artwork
  • Link between forest & conflict in Manipur
  • Final Call for Application MFA - Phase-2
  • ST for Meiteis call before elections
  • Passing the buck
  • Beating of the Retreat #1 : Gallery
  • Life of our Lives in Ethnic Strife Era! :: Poem
  • IIT-Guwahati annual Half Marathon
  • Follow up: European Parliament on Manipur
  • Yoga & Kegel exercise: Pelvic floor workout
  • Opting for the NOTA button
  • Yearning of the displaced people
  • Kenedy Khuman (Singer) : Gallery
  • 5th NE Women's Peace Congregation
  • World Autism Awareness Day 2024
  • Election fever grips Manipur despite unrest
  • Looking for a decent election hustings
  • Clock ticking towards voting day
  • An exemplary directive
  • Children Camp @JNMDA Imphal #1 : Gallery
  • Memo to Election Commission of India
  • Easter & Holi echo in Nilgiris
  • Holiday Camp for children at JNMDA, Imphal
  • Zero waste is our moral responsibility
  • Elections & loyalty vis-a-vis Manipur crisis
  • Show of strength without unity
  • Yaoshang Pichakari #2 : Gallery
  • Panthoi Chanu : 1st to play in Australia
  • Intensive labs in film preservation
  • Building bridges with books
  • Need of the hour: Political maturity
  • Accepting defeat before the election
  • Descent of Radha-Krishna #28: Download
  • April Calendar for Year 2024 : Tools
  • Natural packaging from bamboo : Gallery
  • The Power of Poppy - 25 :: Poem
  • Everyone has their own Bharat Ratna
  • Nupi Landa Thaunaphabishing #12 :: Book
  • Demand- Manipuri as classical language
  • The Drummer from Odisha
  • Beauty benefits of lemon
  • Yaoshang Mei Thaba #2 : Gallery
  • Manipur's original Ponies : Gallery
  • Yaoshang & Dance of Democracy loom
  • Symposium on Jagadguru Shankaracharya
  • Choosing ITI as a campus after X
  • Yaoshang Pichakari #1 : Gallery
  • Yaoshang @Nabadwip Dham : Gallery
  • How oral health affects your pregnancy
  • Two faces of Holi
  • Prawaas 4.0, Multimodal Transport Show
  • A decade of development of higher education
  • Yaoshang Mei Thaba #1 : Gallery
  • Our Eternal Kangleipak :: Poem
  • Micro-livestock for livelihoods: For NE States
  • The fun of Holi used to be monotonous
  • 2nd Annual Art Exhibition #1 : Gallery
  • About the "Meitei" community from Manipur
  • Unveiling the medicinal benefits of honey
  • The incalculable value of wildlife
  • Promises of true love
  • Trends, Alliances, & Challenges in Elections
  • Meitei Goddess Ngaleima : An Artwork
  • Lamta Thangja @ Imphal : Gallery
  • Meira Paibis of Manipur
  • North East Film Festival #2 : Gallery
  • Students @ Class X Exam : Gallery
  • Saroi Khangba @ Kangla : Gallery
  • Protest for scrapping SoO #2 :Gallery
  • Shopping List for Shivaratri : Gallery
  • N Tombi Equestrian C'ships #1 : Gallery
  • Featured Front Page Photo 2024 #1: Gallery
  • Radio E-pao: Manipuri Film OST (130+ song)
  • Save Manipur : Protest [Feb 15] #3 : Gallery
  • Naorem Roshibina- Wushu Medallist : Gallery
  • GHOST of PEACE :: Download Booklet
  • List of Kings of Manipur: 33 - 1984 AD