U-boot. Where does it all start?

New question here.

I am watching a u-boot file, and it has many functions.
For instance; board_mmc_init(), enet_board_init(), setup_splash_img(), etc.

Most of these functions are not called from within the boardfile. They are called from another place. But I can’t understand where.

Linux kernel files in Linux have a machine structure. There we could have .init_machine = myboard_init. Then myboard_init(void) will call other functions, which in turn will call other functions. I find this style easy to read.

My question is: does u-boot have the equivalent .init_machine? Where can I see where it all starts? Who names all these free features dumped together in the u-boot boardfile?

-Andy

+4
source share
4 answers

Firstly, uboot will start from start.S of the specified CPU, for example: http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=arch/arm /cpu/armv7/start.S;h=ef62fc83270a327bc7df970f598540f1d7ce0fe2;hb=HEAD

It will do some things like pointer vector, cache settings, etc.

Then it will jump over http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=arch/arm/lib/crt0.S do some runtime setting,

Then he will return to the beginning. S, after some different material you can refer to the comments, it will jump to lowlevel_init.S http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f = arch / arm / cpu / armv7 / lowlevel_init.S; h = 82b2b86520eb2b2d63c2478145b625a49f931542; hb = HEAD

Then .. it will go to soc (very common in ARM) init, like this: http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f = arch / arm / cpu / armv7 / mx6 / soc.c

After soc init finishes, he will go to some board connected with init, at the beginning of the board he will call some peripheral device / driver init.

Hope this affects the uboot process.

+12
source

I have a raspberry pi board that comes with bcm283x widecom architecture and arm arm. So start.S is located in arch / arm / cpu / arm1176 / start.S. This will initialize critical registers and disable mmu. Then it will execute lowlevel_init, and then branch to _main, which is defined in the case of raspberry pi, located in arch / arm / lib / crt0.S This initializes the stack pointer and global data and calls board_init_f to initialize system RAM (DRAM) to execute the u code -boot. It must use the global_data pointer to execute.

+1
source

In u-boot-2013.04, board_mmc_init is called from the drivers /mmc/mmc.c, the mmc_initialize (...) function.

To find this, "grep -r" (recursive) is your friend.

"Where can I see where it all starts?"

Not sure, but look at the ENTRY (_start) lines.

0
source

Check for the “Board Initialization Stream” section in the README Uboot.

0
source

Source: https://habr.com/ru/post/1499101/


All Articles