SPL Analysis of U-boot

Source: Internet
Author: User
Tags spl
SPLSPL is the code that executes the first phase of uboot. It is primarily responsible for moving the code in the second phase of uboot to memory. SPL is guided by the ROM that is solidified inside the chip. We know that many chip manufacturers have cured ROM support from Nandflash, SDcard and other external media boot. The so-called start-up is the removal of a fixed size (4k/8k/16k, etc.) code from these external media to run in internal RAM. The move here is SPL.  In the latest version of Uboot, you can see that SPL also supports Nandflash, SDcard and many other startup methods. When the SPL itself is moved to internal RAM, it moves uboot second-stage code into external memory from external media such as Nandflash, SDcard, and so on.
SPL File CompositionWhen we execute the make command under Uboot, its core function is to compile the corresponding file by executing the all target in makefile. Let's take a look at this all target. [Plain]View Plain Copy all: $ (all-y) $ (subdir_examples)
All depends on $ (all-y) and $ (subdir_examples), here I only focus on all-y, as follows: [Plain]  View plain  copy   # always append all so that arch config.mk ' s  can add custom ones   all-y += $ (obj) u-boot.srec $ (obj) u-boot.bin  $ (obj) system.map      all-$ (config_nand_u_boot)  += $ (obj) u-boot-nand.bin    all-$ (config_onenand_u_boot)  += $ (obj) u-boot-onenand.bin   all-$ (CONFIG_SPL)  += $ (obj) spl/u-boot-spl.bin   all-$ (config_spl_framework)  += $ (obj) u-boot.img    all-$ (CONFIG_TPL)  += $ (obj) tpl/u-boot-tpl.bin   all-$ (config_of_separate)   += $ (obj) u-boot.dtb $ (obj) u-boot-dtb.bin   ifneq  ($ (config_spl_target),)    all-$ (CONFIG_SPL)  += $ (obj) $ (subst  ",, $ (config_spl_target))    endif       # enable combined spl/u-boot/dtb rules for tegra   ifneq  ($ ( CONFIg_tegra),)    ifeq  ($ (config_of_separate), y)    all-y += $ (obj) u-boot-dtb-tegra.bin   else   all-y += $ (obj) u-boot-nodtb-tegra.bin   endif   endif  
Because this section is about SPL, so we're only interested in one of the sentences all-$ (CONFIG_SPL) + = $ (obj) Spl/u-boot-spl.bin This sentence indicates that CONFIG_SPL must be defined to compile the SPL bin: generally in the "include/ Configs/${config_name}.h "The bin that defines SPL depends on u-boot-spl.bin and then looks down [Plain]View plain copy $ (obj) Spl/u-boot-spl.bin: $ (subdir_tools) depend $ (make)-C SPL All can be found here, U-boot-spl.bi N Dependent on $ (subdir_tools) depend $ (subdir_tools): Temporarily not analyzed
Depend: Refer to the depend in the appendix to enter the SPL directory, execute make all next go to the SPL directory and see its makefile: only the SPL-related parts are analyzed here [Plain]View plain copy config_spl_build: = y export Config_spl_build export config_spl_build: In the next compilation, this variable is y. From the following analysis, you can see that the Uboot stage1, Stage2 stage code with the same start.s, but in Start.s with #ifdef config_spl_build This conditional compilation to distinguish. There are some other files like that. [Plain]View Plain Copy have_vendor_common_lib = $ (if $ (wildcard $ (srctree)/board/$ (VENDOR)/common/makefile), y,n) [CPP]View Plain Copy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.