SPL(辅助程序加载器)有什么用 [英] what is the use of SPL (secondary program loader)

查看:188
本文介绍了SPL(辅助程序加载器)有什么用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对清除关于这三个问题的概念感到困惑

I am confused in clearing my concepts regarding these three questions

  1. 为什么需要辅助程序加载器?

  1. why do we need a secondary program loader ?

它将在哪个内存中加载并重新放置?

in which memory it gets loaded and relocated ?

据我了解,通过阅读链接是

.当系统内部内存无法完全容纳uboot时需要SPL,因此我们需要使用最少的一段称为SPL的代码来初始化内存. SPL是否真正重定位,还是只有与自身相关的uboot?

as far as I understand via reading links is .. SPL is required when the system internal memory can not hold the uboot completely so we need to initialize memory using a minimal piece of code called SPL. Does SPL actually relocate or it is only uboot which relates itself?

推荐答案

让我使用 OMAP 平台为例(仅提供一些实际背景,而不仅仅是理论或常识). 看一下入门的一些事实:

Let me explain it using OMAP platform as an example (just to provide some actual background rather than just theory or common knowledge). Take a look at some facts for starters:

  • 在基于OMAP的平台上,开机后运行的第一个程序是 ROM代码(类似于PC上的BIOS).
  • ROM代码查找引导加载程序(引导加载程序必须是名为"MLO"的文件,并且位于MMC的活动第一个分区上,该分区的格式必须为FAT12/16/32,但这是详细信息)
  • ROM代码将该"MLO"文件的内容复制到静态RAM (因为常规RAM尚未初始化).下一张图片显示了OMAP4460的SRAM存储器布局 SoC :
  • On OMAP-based platforms the first program being run after power-on is ROM code (which is similar to BIOS on PC).
  • ROM code looks for bootloader (which must be a file named "MLO" and located on active first partition of MMC, which must be formatted as FAT12/16/32, -- but that's details)
  • ROM code copies content of that "MLO" file to static RAM (because regular RAM is not initialized yet). Next picture shows SRAM memory layout for OMAP4460 SoC:

  • SRAM内存有限(由于物理原因),因此引导加载程序我们只有48 KiB.通常,常规的引导加载程序(例如U-Boot)二进制文件要大得多.因此,我们需要创建一些其他的引导加载程序,这些引导加载程序将初始化常规的引导加载程序,并将常规的引导加载程序从MMC复制到RAM,然后跳转到执行该常规的引导加载程序.这种额外的引导加载程序通常称为第一阶段引导加载程序(在两阶段引导加载程序中).
  • SRAM memory is limited (due to physical reasons), so we only have 48 KiB for bootloader. Usually regular bootloader (e.g. U-Boot) binary is bigger than that. So we need to create some additional bootloader, which will initialize regular RAM and copy regular bootloader from MMC to RAM, and then will jump to execute that regular bootloader. This additional bootloader is usually referred as first-stage bootloader (in two-stage bootloader scenario).

因此,该一级引导加载程序 U-Boot SPL ;并且第二阶段引导程序常规U-Boot (或 U-Boot适当).需要明确的是:SPL代表二级程序加载器.这意味着ROM代码是加载(并执行)其他程序的第一件事,而SPL是加载(并执行)其他程序的第二件事.因此通常是下一个引导顺序:ROM代码-> SPL-> u-boot->内核.实际上,它与PC启动非常相似,它是:BIOS-> MBR-> GRUB->内核.

So this first-stage bootloader is U-Boot SPL; and second-stage bootloader is regular U-Boot (or U-Boot proper). To be clear: SPL stands for Secondary Program Loader. Which means that ROM code is the first thing that loads (and executes) other program, and SPL is the second thing that loads (and executes) other program. So usually boot sequence is next: ROM code -> SPL -> u-boot -> kernel. And actually it's very similar to PC boot, which is: BIOS -> MBR -> GRUB -> kernel.

更新

为了使完全清楚,这是描述启动顺序所有阶段的表(以澄清所用术语的不确定性):

To make things absolutely clear, here is the table describing all stages of boot sequence (to clarify possible uncertainty in terminology used):

+--------+----------------+----------------+----------+
| Boot   | Terminology #1 | Terminology #2 | Actual   |
| stage  |                |                | program  |
| number |                |                | name     |
+--------+----------------+----------------+----------+
| 1      |  Primary       |  -             | ROM code |
|        |  Program       |                |          |
|        |  Loader        |                |          |
|        |                |                |          |
| 2      |  Secondary     |  1st stage     | u-boot   |
|        |  Program       |  bootloader    | SPL      |
|        |  Loader (SPL)  |                |          |
|        |                |                |          |
| 3      |  -             |  2nd stage     | u-boot   |
|        |                |  bootloader    |          |
|        |                |                |          |
| 4      |  -             |  -             | kernel   |
|        |                |                |          |
+--------+----------------+----------------+----------+

因此,我只是将 bootloader 用作 U-Boot 的同义词,而将 Program Loader 用作任何加载其他程序的通用术语程序.

So I'm just using bootloader as synonym for U-Boot, and Program Loader as common term for any program that loads other program.

另请参阅:

[1] SPL(在Wikipedia上)

[2] TPL:SPL加载SPL-Denx

[3] Bootloader(来自OSDev Wiki)

[4] 引导ROM vs Bootloader

这篇关于SPL(辅助程序加载器)有什么用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆