U-boot Analysis Two
Following the previous launch, this blog post aims to:
Learn the U-boot directory structure, from the code architecture on the U-boot have a overall grasp and understanding.
First, learn u-boot, ask, what is U-boot?
U-boot is an open source program.
Universal boot Loader, Universal boot program. is a very common boot program that can be used as a mainstream system bootstrapper, such as OpenBSD, NetBSD, Freebsd,4.4bsd, Linux, SVR4, Esix, Solaris, and so on, while also supporting a variety of common CPU processors, such as MIPS, x86, ARM, NIOS, XScale and so on.
U-boot is a commonly used in embedded systems Bootloader,bootloader is a small program executed before the operating system, through which we can initialize the hardware device, build the memory space mapping table, so as to establish the appropriate software and hardware environment, Prepare for the final call to the operating system kernel. The main running task of the Boot loader is to read the kernel image from the hard disk (e.g. NAND Flash or EMMC) into RAM, and then jump to the kernel entry point to run, starting the operating system. The system usually starts from the address 0x00000000 when power-on or reset, and at this address is usually the system's boot loader program.
Second, U-boot directory structure
U-boot source code, either from the Web download (ftp://ftp.denx.de/pub/u-boot/) or from a previous blog share (http://pan.baidu.com/s/1kUhYmEj), The first sight of the landscape is basically like this:
U-boot directory structure, starting from the u-boot-2010.06 version, compared to the older version of the CPU and Lib_arch, named Arch Add include folder separate the common Library folders Lib
u-boot-2010.06 and later versions, basic directory structure as follows table
examples
Name |
Description |
API |
This directory stores u-boot-provided interface functions |
arch |
architecture-related code, core folder 。 s5p4418 is the ARM architecture. |
Board |
This folder is a custom code based on a different concrete development board, with a lot of code |
Common |
general code, covering all aspects, with command line handling primary |
disk |
partition related code |
doc |
common features And the description of the problem documentation, a bunch of readme at the beginning of the file |
drivers |
commonly used device drivers, each type of device driver occupies a subdirectory |
Sample program |
FS |
file system, support for embedded development Common FS (CRAMFS,EXT2,EXT3,JFFS2,ETC) |
include |
globally required header file definition here |
lib |
Universal library file |
net |
Network-related code, small protocol stack |
post |
power On self test, open shop self-test |
Tools |
Helper, for compiling and checking the uboot target file |
Ask yourself, learn u-boot is why.
There is no denying that a great opportunity is to transplant u-boot to its own development board.
So, we'll have to analyze /arch,/board two folder
/arch
Each folder corresponds to an architecture, such as/arm, which is the architecture covered in this article. Enter/arch/arm
Note that this figure is truncated from the U-boot source code that the blogger shares, the code has removed the irrelevant arch folder, leaving only arm folder to facilitate better learning. the CPU subdirectory corresponds to a different product model or series of the processor; The Include subdirectory is the header file used by the processor, and the code that the Lib directory applies to the processor public;
Continue to expand the CPU folder, that is,/arch/arm/cpu/slsiap/s5p4418/
Where the Start.s file is the entry point for the entire u-boot code.
/board
This figure is truncated from the U-boot official website download source code, visible inside there are a lot of ready-made development Board configuration, very spectacular. And our example is not included in it, so look back at the source code (HTTP://PAN.BAIDU.COM/S/1KUHYMEJ) that the blogger shared in the previous article. For the convenience of learning, only left the relevant files and folders/u-boot/board/s5p4418/...
Let's summarize, from the directory structure, U-boot includes two/arch and/board directories that often need to move, and other folders that are not moving. As a beginner, or has not involved u-boot cutting, we try to figure out the first two folder code principle can understand the U-boot workflow.
Finally, U-boot.lds
There is also a document that must be known, namely U-boot/arch/arm/cpu/slsiap/u-boot.lds
U-boot.lds is the LD program is the connector of the script file, this file describes how to connect the target file, the LD program according to the instructions of the file according to the requirements of the different target files connected together to generate for burning write to the Development Board image.
Backtracking this article, what is U-boot? U-boot directory structure. What U-boot.lds is for.
Finish