Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
[deliverable/linux.git] / Documentation / arm / Booting
CommitLineData
1da177e4
LT
1 Booting ARM Linux
2 =================
3
4Author: Russell King
5Date : 18 May 2002
6
7The following documentation is relevant to 2.4.18-rmk6 and beyond.
8
9In order to boot ARM Linux, you require a boot loader, which is a small
10program that runs before the main kernel. The boot loader is expected
11to initialise various devices, and eventually call the Linux kernel,
12passing information to the kernel.
13
14Essentially, the boot loader should provide (as a minimum) the
15following:
16
171. Setup and initialise the RAM.
182. Initialise one serial port.
193. Detect the machine type.
204. Setup the kernel tagged list.
215. Call the kernel image.
22
23
241. Setup and initialise RAM
25---------------------------
26
27Existing boot loaders: MANDATORY
28New boot loaders: MANDATORY
29
30The boot loader is expected to find and initialise all RAM that the
31kernel will use for volatile data storage in the system. It performs
32this in a machine dependent manner. (It may use internal algorithms
33to automatically locate and size all RAM, or it may use knowledge of
34the RAM in the machine, or any other method the boot loader designer
35sees fit.)
36
37
382. Initialise one serial port
39-----------------------------
40
41Existing boot loaders: OPTIONAL, RECOMMENDED
42New boot loaders: OPTIONAL, RECOMMENDED
43
44The boot loader should initialise and enable one serial port on the
45target. This allows the kernel serial driver to automatically detect
46which serial port it should use for the kernel console (generally
47used for debugging purposes, or communication with the target.)
48
49As an alternative, the boot loader can pass the relevant 'console='
50option to the kernel via the tagged lists specifying the port, and
51serial format options as described in
52
53 Documentation/kernel-parameters.txt.
54
55
563. Detect the machine type
57--------------------------
58
59Existing boot loaders: OPTIONAL
60New boot loaders: MANDATORY
61
62The boot loader should detect the machine type its running on by some
63method. Whether this is a hard coded value or some algorithm that
64looks at the connected hardware is beyond the scope of this document.
65The boot loader must ultimately be able to provide a MACH_TYPE_xxx
66value to the kernel. (see linux/arch/arm/tools/mach-types).
67
ede338f4
GL
684. Setup boot data
69------------------
1da177e4
LT
70
71Existing boot loaders: OPTIONAL, HIGHLY RECOMMENDED
72New boot loaders: MANDATORY
73
ede338f4
GL
74The boot loader must provide either a tagged list or a dtb image for
75passing configuration data to the kernel. The physical address of the
76boot data is passed to the kernel in register r2.
77
784a. Setup the kernel tagged list
79--------------------------------
80
1da177e4
LT
81The boot loader must create and initialise the kernel tagged list.
82A valid tagged list starts with ATAG_CORE and ends with ATAG_NONE.
83The ATAG_CORE tag may or may not be empty. An empty ATAG_CORE tag
84has the size field set to '2' (0x00000002). The ATAG_NONE must set
85the size field to zero.
86
87Any number of tags can be placed in the list. It is undefined
88whether a repeated tag appends to the information carried by the
89previous tag, or whether it replaces the information in its
90entirety; some tags behave as the former, others the latter.
91
92The boot loader must pass at a minimum the size and location of
93the system memory, and root filesystem location. Therefore, the
94minimum tagged list should look:
95
96 +-----------+
97base -> | ATAG_CORE | |
98 +-----------+ |
99 | ATAG_MEM | | increasing address
100 +-----------+ |
101 | ATAG_NONE | |
102 +-----------+ v
103
104The tagged list should be stored in system RAM.
105
106The tagged list must be placed in a region of memory where neither
107the kernel decompressor nor initrd 'bootp' program will overwrite
108it. The recommended placement is in the first 16KiB of RAM.
109
ede338f4
GL
1104b. Setup the device tree
111-------------------------
112
113The boot loader must load a device tree image (dtb) into system ram
114at a 64bit aligned address and initialize it with the boot data. The
115dtb format is documented in Documentation/devicetree/booting-without-of.txt.
116The kernel will look for the dtb magic value of 0xd00dfeed at the dtb
117physical address to determine if a dtb has been passed instead of a
118tagged list.
119
120The boot loader must pass at a minimum the size and location of the
121system memory, and the root filesystem location. The dtb must be
122placed in a region of memory where the kernel decompressor will not
123overwrite it. The recommended placement is in the first 16KiB of RAM
124with the caveat that it may not be located at physical address 0 since
125the kernel interprets a value of 0 in r2 to mean neither a tagged list
126nor a dtb were passed.
127
1da177e4
LT
1285. Calling the kernel image
129---------------------------
130
131Existing boot loaders: MANDATORY
132New boot loaders: MANDATORY
133
134There are two options for calling the kernel zImage. If the zImage
135is stored in flash, and is linked correctly to be run from flash,
136then it is legal for the boot loader to call the zImage in flash
137directly.
138
139The zImage may also be placed in system RAM (at any location) and
140called there. Note that the kernel uses 16K of RAM below the image
141to store page tables. The recommended placement is 32KiB into RAM.
142
143In either case, the following conditions must be met:
144
13fce806 145- Quiesce all DMA capable devices so that memory does not get
1da177e4
LT
146 corrupted by bogus network packets or disk data. This will save
147 you many hours of debug.
148
149- CPU register settings
150 r0 = 0,
151 r1 = machine type number discovered in (3) above.
ede338f4
GL
152 r2 = physical address of tagged list in system RAM, or
153 physical address of device tree block (dtb) in system RAM
1da177e4
LT
154
155- CPU mode
156 All forms of interrupts must be disabled (IRQs and FIQs)
6a6d55c3
DM
157
158 For CPUs which do not include the ARM virtualization extensions, the
159 CPU must be in SVC mode. (A special exception exists for Angel)
160
161 CPUs which include support for the virtualization extensions can be
162 entered in HYP mode in order to enable the kernel to make full use of
163 these extensions. This is the recommended boot method for such CPUs,
164 unless the virtualisations are already in use by a pre-installed
165 hypervisor.
166
167 If the kernel is not entered in HYP mode for any reason, it must be
168 entered in SVC mode.
1da177e4
LT
169
170- Caches, MMUs
171 The MMU must be off.
172 Instruction cache may be on or off.
173 Data cache must be off.
174
6a6d55c3
DM
175 If the kernel is entered in HYP mode, the above requirements apply to
176 the HYP mode configuration in addition to the ordinary PL1 (privileged
177 kernel modes) configuration. In addition, all traps into the
178 hypervisor must be disabled, and PL1 access must be granted for all
179 peripherals and CPU resources for which this is architecturally
180 possible. Except for entering in HYP mode, the system configuration
181 should be such that a kernel which does not include support for the
182 virtualization extensions can boot correctly without extra help.
183
1da177e4
LT
184- The boot loader is expected to call the kernel image by jumping
185 directly to the first instruction of the kernel image.
186
540b5738
DM
187 On CPUs supporting the ARM instruction set, the entry must be
188 made in ARM state, even for a Thumb-2 kernel.
189
190 On CPUs supporting only the Thumb instruction set such as
191 Cortex-M class CPUs, the entry must be made in Thumb state.
This page took 0.563305 seconds and 5 git commands to generate.