I am in between lot of questions, good sign of learning! 🙂
1) Where does u-boot execute it’s first CPU instruction?
2) Being a universal boot loader how does u-boot generically implement it’s start up sequence for various supported CPUs? What are the assumptions in this case?
3) u-boot is written in C, but how can a developer write a C function even before initializing the stack pointer?
4) I have heard that u-boot is very much portable, How does it handle board dependencies like, memory devices used, total available memory, board specific peripherals (USB, ETH Serial port etc)?
5) I know that u-boot maintains lot of environment variables. How are they stored in flash?
6) How can I add a CPU support in u-boot?
7) How can I add a new board support for an existing CPU in u-boot?
8) How does U-boot support any OS or standalone application booting?
I started with the README in u-boot source and the top level Makefile. I will mention few important points I noticed in this document. Currently there is no automated configuration tool available for u-boot. The build configuration (to chose the combination of board and CPU type) is done manually using lot of #defines in the board specific header file. All such information is kept in a configuration file “include/configs/<board_name>.h”. There are two classes of configuration variables:
* Configuration _OPTIONS_:
These are selectable by the user and have names beginning with
* Configuration _SETTINGS_:
These depend on the hardware etc. and should not be meddled with if
you don’t know what you’re doing; they have names beginning with
Eg: CFG_HUSH_PARSER Define this variable to enable the “hush” shell (from Busybox) as command line interpreter, thus enabling powerful command line syntax like if…then…else…fi conditionals or `&&’ and ‘||’ constructs (“shell scripts”).
In the top level make file we can find lot of <board>_config labels which define board specific make rules.
This way u-boot abstracts the board and cpu configuration which makes it possible to use for many CPU architectures and board variants.