//文件位置: Documentation/arm/Booting
Booting ARM Linux
启动ARM Linux
=================
Author: Russell King
Date : 18 May 2002
The following documentation is relevant to 2.4.18-rmk6 and beyond.
下列文档与2.4.18-rmk6和更高版本的内核有关。
In order to boot ARM Linux, you require a boot loader, which is a small
program that runs before the main kernel. The boot loader is expected
to initialise various devices, and eventually call the Linux kernel,
passing information to the kernel.
为了能够启动ARM Linux,你需要一个启动器,这个启动器是一个非常轻型的程序能够在
主内核代码启动前启动。启动器能够初始化一些设备,并且最后能够调用linux内核,
同时将信息传递给内核。
Essentially, the boot loader should provide (as a minimum) the
following:
最重要的是,启动器应该能够至少提供:
1. Setup and initialise the RAM. 安装和初始化ARM
2. Initialise one serial port. 初始化一个序列端口
3. Detect the machine type. 检测机器类型
4. Setup the kernel tagged list. 安装内核标记列表
5. Call the kernel image. 调用内核镜像
1. Setup and initialise RAM
1. 安装和初始化ARM
---------------------------
Existing boot loaders: MANDATORY
New boot loaders: MANDATORY
存在的启动机: MANDATORY
新的启动机: MANDATORY
The boot loader is expected to find and initialise all RAM that the
kernel will use for volatile data storage in the system. It performs
this in a machine dependent manner. (It may use internal algorithms
to automatically locate and size all RAM, or it may use knowledge of
the RAM in the machine, or any other method the boot loader designer
sees fit.)
启动器应该能够找到并且初始化所有的ARM,内核将使用该ARM在系统中用于易变数据的
存储。它以一个机器独立的方式进行运行。(他可能使用内部的算法自动的定位和计算所有
ARM的大小,或者是使用在机器中有关ARM的信息,或者是使用启动机设计者其他的方法。)
2. Initialise one serial port
2. 初始化一个序列端口
-----------------------------
Existing boot loaders: OPTIONAL, RECOMMENDED
New boot loaders: OPTIONAL, RECOMMENDED
现有的引导装载程序: OPTIONAL, RECOMMENDED
新的引导装载程序: OPTIONAL, RECOMMENDED
The boot loader should initialise and enable one serial port on the
target. This allows the kernel serial driver to automatically detect
which serial port it should use for the kernel console (generally
used for debugging purposes, or communication with the target.)
引导加载程序应该在一个对象上初始化并且使能一个序列端口。这允许内核各种驱动
能够自动检测哪一个序列端口他应该使用在内核控制台上。(通常用于调试目的,
或者是与对象进行通信。)
As an alternative, the boot loader can pass the relevant 'console='
option to the kernel via the tagged lists specifying the port, and
serial format options as described in
linux/Documentation/kernel-parameters.txt.
作为一个可选的选项,引导启动程序能够将相关的' console='选项通过标记列表
上指定的端口号传递到内核,并且一些格式选项在linux/Documentation/kernel-parameters.txt
中进行描述。
3. Detect the machine type
3. 检测机器类型
--------------------------
Existing boot loaders: OPTIONAL
New boot loaders: MANDATORY
现有的引导装载程序: OPTIONAL
新的引导装载程序: MANDATORY
The boot loader should detect the machine type its running on by some
method. Whether this is a hard coded value or some algorithm that
looks at the connected hardware is beyond the scope of this document.
The boot loader must ultimately be able to provide a MACH_TYPE_xxx
value to the kernel. (see linux/arch/arm/tools/mach-types).
引导启动程序应该通过一些方法检测她正在运行的机器的类型。无论是一个硬件编码值
还是一些查看所连接硬件的算法都已经超越了这个文档的范畴。引导启动程序最后一定
能够向内核提供一个MACH_TYPE_xxx值。
4. Setup the kernel tagged list
4. 安装内核标记列表
-------------------------------
Existing boot loaders: OPTIONAL, HIGHLY RECOMMENDED
现有的引导装载程序: OPTIONAL, HIGHLY RECOMMENDED
The boot loader must create and initialise the kernel tagged list.
A valid tagged list starts with ATAG_CORE and ends with ATAG_NONE.
The ATAG_CORE tag may or may not be empty. An empty ATAG_CORE tag
has the size field set to '2' (0x00000002). The ATAG_NONE must set
the size field to zero.
引导启动程序一定能够创建并初始化一个内核标记列表。一个有效的标记列表以
ATAG_CORE开始和以ATAG_NONE结束。ATAG_CORE标签可能或者是可能不是空的。
一个空的ATAG_CORE标记有一个大小区域被设置成'2'(0x00000002).ATAG_NONE
标记的大小区域肯定被设置成0。
Any number of tags can be placed in the list. It is undefined
whether a repeated tag appends to the information carried by the
previous tag, or whether it replaces the information in its
entirety; some tags behave as the former, others the latter.
任何数量的标记都能被放置在列表中。无论是一个重复的依赖于被原来的标记
所带的信息的标记,还是在他的整体中替代的信息都没有被定义。一些标记作为
前者运行,其他的最为后者。
The boot loader must pass at a minimum the size and location of
the system memory, and root filesystem location. Therefore, the
minimum tagged list should look:
引导启动程序一定会以最小的尺寸和在系统内存位置还有根文件系统的位置
进行传递。因此,最小的标记列表应该参照:
+-----------+
base -> | ATAG_CORE | |
+-----------+ |
| ATAG_MEM | | increasing address(增加的内存)
| ATAG_NONE | |
+-----------+ v
The tagged list should be stored in system RAM.
标记列表应该在系统ARM中被保存。
The tagged list must be placed in a region of memory where neither
the kernel decompressor nor initrd 'bootp' program will overwrite
it. The recommended placement is in the first 16KiB of RAM.
标记列表内核解压程序的区域,又不能被放置在initrd 'bootp'程序重写的区域。
推荐使用得地方时ARM起始的16KiB的位置。
5. Calling the kernel image
5.调用内核镜像
现有的引导装载程序: MANDATORY
新的引导装载程序: MANDATORY
There are two options for calling the kernel zImage. If the zImage
is stored in flash, and is linked correctly to be run from flash,
then it is legal for the boot loader to call the zImage in flash
directly.
有两个调用内核zImage的选项。如果zImage被保存在闪存中,并且被正确连接
能够从闪存中正确运行的话,那么引导启动程序直接从闪存中调用zImage是合理
的。
The zImage may also be placed in system RAM (at any location) and
called there. Note that the kernel uses 16K of RAM below the image
to store page tables. The recommended placement is 32KiB into RAM.
zImage也许可能被放置在系统ARM中的任何地方并且在那里被调用。注意内核
使用在镜像下ARM的16k来存储页表。推荐的位置是进入ARM的32KiB处。
In either case, the following conditions must be met:
在其他情况中,下列条件应该要满足:
- CPU register settings
CPU寄存器设置
r0 = 0,
r0 = 0
r1 = machine type number discovered in (3) above.
r1 = 在上述(3) 中所发现的机器类型号
r2 = physical address of tagged list in system RAM.
r2 = 在系统ARM中标记列表的地址
- CPU mode
CPU模式
All forms of interrupts must be disabled (IRQs and FIQs)
关闭所有形式的中断(IRQs和FIQs)
The CPU must be in SVC mode. (A special exception exists for Angel) CPU一定要在SVC模式下。
- Caches, MMUs 高速缓存,内存管理单元
The MMU must be off. 内存管理单元必须关闭。
Instruction cache may be on or off. 指令缓存可能是开的或者是关闭的。
Data cache must be off. 数据缓存一定要是关闭的。
- The boot loader is expected to call the kernel image by jumping
directly to the first instruction of the kernel image.
引导启动程序通过直接跳转到内核镜像的第一条指令来调用内核镜像。