Skip to content

How ARM based device starts?

November 15, 2012

Hi guys…have you ever wandered how the embedded dev kit starts up when we plug the power supply?.. well let’s discuss about it.

Now, when we plug in the power to the device, the cpu code initializes and looks for the boot select configured. Now this boot select might be some switch or jumper or software auto boot select. There are many boot options available on device like device can get booted from flash memory or memory card or serial flash or from USB. Based on the device hardware we can choose one of them.

Now let us understand the key components who helps an embedded device to be up and running.
1. Primary boot loader
2. Secondary boot loader
3. Kernel image
4. File system

The cpu code will execute the primary boot loader and also initializes required peripherals to do that like flash chip or mmc interface etc.
The duty of primary boot loader is to load secondary boot loader and initialize required hardware for that. (Just like passing the duty)
X-loader is a popular primary boot loader for ARM. Primary boot loader is also referred as bootstrap mostly.

Now, the job of secondary boot loader is to provide configurable environment to user so that he/she can load OS kernel from where ever he wants or however he wants. For example if I want to load kernel from network, I can do it from this secondary boot loader. Same as if I want to allocate certain amount of memory I can do it from here.
U-boot is a popular secondary boot loader for ARM devices. We will discuss more about this configuration stuff later(in my other post may be).

Now let us assume that u-boot (now i will refer secondary boot loader as u-boot) is configured properly. So it will read the kernel image and pass the control of hardware to the kernel. Kernel will also get some configurations from u-boot. Based on that it will initializes hardware and required device drivers and tries to mount the file system. After mounting the file system successfully it will continue normal Linux init stuff and after that your device is up and running.

So, simply the procedure is,

x-loader –> U-boot –> kernel OS

Let’s take an example scenario which will help you understand more better,

I have one development kit named Tsunamipack-XL. It supports boot from NAND flash or MMC or USB stick.

I have my all system is NAND memory. So when I will plug in the power supply to that kit the CPU will first look for bootfiles on mmc card. Here bootfiles means x-loader, U-boot and Kernel Image. If it doesn’t find them on MMC card it will go to the first memory location of NAND memory and reads x-loader from there and executes it assuming x-loader is there on that location. After that x-loader will read the U-boot from next NAND memory locations and passes control to U-boot. Now U-boot will provide user a console based interface to configure the system. So I will configure my system such a way that it will read the kernel image from NAND memory, provide the file system partition location on NAND memory with some other kernel options and executes the kernel image. Rest of the procedure is same as I explained earlier.

If you noticed, here from the u-boot I can change the kernel image location and tell it to read it from mmc card or from network. so that is the advantage of u-boot. There is a lot of things more that u-boot can do.

So that was the brief info about how ARM based device starts.

I will discuss Linux init process and other concepts is my other post. So stay in touch for that.


From → Linux

  1. I thought the first stage will be to jump to the BOOT ROM and not the first stage bootloader

    • Yes!.. That’s correct!.. BOOT Rom can load primary bootloader a.k.a first stage bootloader from various media.

  2. It would be helpful is you can explain what kind of details u-boot can pass to the Kernel and why @ all we need 2 boot loaders? cant we implement the same functionality in Linux Kernel?? will it work or not?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: