Hikey : Boot U-Boot without ATF, fastboot, l-loader and other components


#1

The Documentation on U-Boot has a nice Wiki to build and run U-Boot on Hikey Lemaker : https://github.com/qemu/u-boot/tree/master/board/hisilicon/hikey.
However it uses lots of other components which I guess are not mandatory :

git clone https://github.com/96boards-hikey/edk2 -b testing/hikey960_v2.5
git clone https://github.com/ARM-software/arm-trusted-firmware 
git clone https://github.com/96boards-hikey/l-loader -b testing/hikey960_v1.2 
git clone https://github.com/96boards-hikey/OpenPlatformPkg -b testing/hikey960_v1.3.4 
git clone https://github.com/96boards-hikey/atf-fastboot

However, I want to get rid of these components here as my sole objective here is to run U-boot, as I want to understand U-Boot flow.

Similar to BeagleBone black, I just want to create an SPL like MLO , which then loads U-Boot. Is there a way to run U-Boot directry from Hikey ROM code and get rid of these additional components (ATF, l-loader,etc.)?


#2

For 64-bit ARMv8 systems u-boot is designed to run at EL2 (for a system with virtualization) or EL1 (no virtualization). Hikey implements EL3 (secure monitor state) which is not supported by u-boot. The “correct” u-boot flow it to get the TF-A to load u-boot.

In other words I don’t see how removing TF-A can help you understand how a 64-bit system should boot. Instead I would advise reading the TF-A documentation!

Daniel.

PS Hikey boots in 32-bit mode… the job of l-loader is simply to reset into EL3 so that TF-A can work.

PPS Beaglebone Black is a 32-bit ARMv7 system without virtualization support… its boot approach is way simpler and is like a 64-bit ARMv8 system booting into EL1 (this is how qemu boots by default but I am not aware of any real silicon that boots into EL1).


#3

Thanks Daniel,
You seem to have answers to all of my questions.

However, I was not able to make much sense. If I am not asking too much, can you please guide me to understand the boot flow and how EL1,EL2 or anything else, relate with each other… I understand that it would be a huge domain in itself, but since you have great experience, you can just draw a learning map for me.

Can you please give me a high level chronological order to understand boot flow .e.g
Learn X ----> then learn Y ----> then learn Z —> then learn B —> then finally learn C
something like this.

Then I can google things to find resources and learn them. I have 1 year plan to understand pre-kernel bootstrapping. Waiting to get a patient answer, as I am highly curious to learn all the bootstrapping stuff.


#4

Not sure I can offer the whole curriculum up front but as a starting point I’d recommend that:

  1. You ignore l-loader for now. Just assume for now that it simply sends a message to the UART (Switch to aarch64 mode. CPU0 executes at 0x........) and reboot the device into 64-bit mode ready to load BL1 from TF-A (you can come back later if you like but it is not a great place to start because it is undocumented, slightly weird, written in assembler and unique for hikey so it gives you no useful info about other ARMv8 platforms).

  2. Watch an introductory video on TF-A (which back then was known as Arm Trusted Firmware[1]): https://www.youtube.com/watch?v=q32BEMMxmfw . Note that this video is pretty old now so some of the subtle details will have changed but I have picked it because it is old enough not to assume that the audience already knows about ARMv8 exception levels :wink: . The bootloader for Beaglebone Black probably looks like the ARMv6 picture on slide 5 (C-A8 can support TrustZone but I think the TI boot ROM hides this so it will look like an ARMv6 system from a boot architecture point of view). Finally note that this video shows EDK2 running as BL33, in a system running u-boot then it is u-boot rather than EDK2 loaded as BL33.

  3. Having watch that you will hopefully have enough understanding to read and navigate the current TF-A documentation and perhaps to fill in small gaps in your knowledge from the “ARM ARM” (the ARMv8 Architecture Reference Manual… not easy to read as a beginner but definitive).

  4. I’m not sure how much documentation there is to help you with u-boot itself but https://www.kernel.org/doc/Documentation/arm64/booting.txt is useful (it describes what u-boot needs to do to get the kernel to load).

Have fun!

[1] If you are interested the A in TF-A is not Arm it is for “Application class processors”. Arm TF was renamed when TF-M (for microcontrollers) was introduced to avoid confusion. When searching for videos avoid reading about TF-M… it is not helpful for you present goal.