First stage and second stage bootloader

1,381 views
Skip to first unread message

Amrit Pal Singh

unread,
Dec 20, 2016, 12:03:18 PM12/20/16
to Anil Kumar Pugalia, inside...@googlegroups.com
Hi,

Is there any article that explains a first stage and a second stage bootloader vis-a-vis with reference to am arm based Embedded board.


Thanks & Regards,
Amrit Pal Singh.

Anil Kumar Pugalia

unread,
Dec 20, 2016, 11:33:24 PM12/20/16
to Amrit Pal Singh, inside...@googlegroups.com
What special thing are you looking specifically for ARM? Otherwise,
reading about uboot gives the appropriate info.

Regards
Anil

Passion: http://sysplay.in (Playing with Systems)

Amrit Pal Singh

unread,
Dec 21, 2016, 12:07:51 AM12/21/16
to Anil Kumar Pugalia, inside...@googlegroups.com
Hi Anil,
I just want to know if the First Stage and second stage are stages of a bootloader say uboot or are different bootloaders. Like that.

If you can refer an aritcle that says what happens in the first stage and second stage of uboot, then that will also be fine.
Someone asked this question that is why.
Basically the differences between first and second stage of a bootloader.
Thanks & Regards,
Amrit Pal Singh.

Mogasati Gopikrishna

unread,
Dec 21, 2016, 12:59:25 AM12/21/16
to inside...@googlegroups.com
Hi Amrit ,

Both of these boot loaders have different functionalities.Please find the points below :

1)When system is started , the Program counter is loaded with all zeros which says to fetch an instruction from this location .IT is the Boot ROM chip location by default (ie.., like BIOS chip in x86).

2)This location in the BOOT ROM has an instruction says  to jump to a location where the code to be executed when reset happens.The PC is loaded with this address.

3) The basic required peripheral initialization happens and then the boot ROM code searches for a valid boot partition location(like from eeprom or sdcard  ) when it doesn't find a valid partition , it waits for    some thing to be transmitted over UART as a last option.(we can pass FSBL over UART also)

4)suppose say if SDcard is detected it searches for a file called MLO (Memory loader) which is the first stage boot loader .

First stage boot loader :-

The first stage boot loader is required because there will be different RAM types of various sizes , so different RAMs have different initialization things need to taken care of before we make RAM available to system.The FSBL is loaded in the internal RAM ,which initializes the external RAM .We can do this this in BOOT ROM code also but since the contents of the BOOT ROM code cannot be changed once flashed for good flexibility to initialize various RAM types having FSBL is a nice option.This is how we have from same company mobile sets with different RAM sizes .This also adds to production cutting cost for industries. 

The FSBL after initializing external RAM will bring the SSBL (uboot) to the RAM and now uboot starts executing .

Second Stage Boot Loader (UBOOT) :-

The SSBL brings the uImage (linux kernel  image) to the RAM. Kernel requires some parameters to be passed for it to execute(like ROOT FS location or saying it to fetch from network etc..,) , the SSBL takes this responsibility of passing these parameters to kernel ,then the kernel boots up and now the system is in hands of kernel.


Thanking,
Gopikrishna.

--
You received this message because you are subscribed to the Google Groups "SysPlay's Inside Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inside_linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anish Khurana

unread,
Dec 21, 2016, 1:02:05 AM12/21/16
to inside...@googlegroups.com
Amrit( Cognizant rt ?) ,

you can look into this link for basic understanding  :


Thanks,
Anish

Amrit Pal Singh

unread,
Dec 22, 2016, 1:44:53 AM12/22/16
to inside...@googlegroups.com
Hi Gopal,

That was precise and informative.

If you can also ans the following queries, I will be very thankful.

I want to know what kind of peripherals are initialized before the FSBL???
Say if it waits for UART then UART must be configured even before the FSBL...
Rty?

What peripherals are initialized in the FSBL and in the SSBL...

I understand that we can vary the DDRAM size in the uboot i.e the SSBL.
I was of the understanding that the uboot only initlialised the UART. And it can act both as first stage and second stage bootloader. May be a part of uboot code is executed from processor RAM and rest is executed on the external DDRAM or main memory. Is my understanding correct?

Thanks & Regards,
Amrit Pal Singh.

Amrit Pal Singh

unread,
Dec 22, 2016, 1:45:25 AM12/22/16
to inside...@googlegroups.com
HI Anidh,

Yes I am in cognizant these days.
But how do you know??

Thanks & Regards,
Amrit Pal Singh.

Mogasati Gopikrishna

unread,
Dec 22, 2016, 2:34:12 AM12/22/16
to inside...@googlegroups.com
Hi Amrit ,


 what kind of peripherals are initialized before the FSBL:

ASFIK , as it searches for a valid partition across SDCard , eeprom and expecting some thing to be given over UART these peripherals will be initialized ,also u can see a smd light glowing when we switch on the board so gpios etc.., don't have any exhaustive list of what is initialized before fsbl , you can think of these as per observation.


What peripherals are initialized in the FSBL and in the SSBL...


 FSBL initializes external RAM also you can think of this use case :- when we power on our mobile phones we immediately get a logo image of the vendor and some welcoming sound so these will be initialized at FSBL stage . I too don't know  exhaustive list of peripherals initialized unless we go through the MLO code.

The devices which are not initialized at fsbl will be initialized by uboot.

May be a part of uboot code is executed from processor RAM and rest is executed on the external DDRAM or main memory. Is my understanding correct?

This is wrong understanding , u boot image is a big one and it will be executed in the external RAM only .


ALL the above statements are based on my observations , please check yourself for better clarity .

Thanking,
Gopikrishna.

Anil Kumar Pugalia

unread,
Dec 22, 2016, 3:50:32 AM12/22/16
to inside...@googlegroups.com

Regarding the third highlighted question below, in today's uboot, MLO is generated from uboot code itself - in a way making MLO as the initial minimal uboot to load the remaining uboot.

Regards
Anil
Passion: http://sysplay.in (Playing with Systems)
To unsubscribe from this group and stop receiving emails from it, send an email to inside_linux...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages