blob: 76850295af8f93b0627f8a220f90ee8c6a677e92 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001 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
Grant Likely7211da12011-02-14 08:13:20 -070068
694. Setup the kernel tagged list
70-------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
72Existing boot loaders: OPTIONAL, HIGHLY RECOMMENDED
73New boot loaders: MANDATORY
74
75The boot loader must create and initialise the kernel tagged list.
76A valid tagged list starts with ATAG_CORE and ends with ATAG_NONE.
77The ATAG_CORE tag may or may not be empty. An empty ATAG_CORE tag
78has the size field set to '2' (0x00000002). The ATAG_NONE must set
79the size field to zero.
80
81Any number of tags can be placed in the list. It is undefined
82whether a repeated tag appends to the information carried by the
83previous tag, or whether it replaces the information in its
84entirety; some tags behave as the former, others the latter.
85
86The boot loader must pass at a minimum the size and location of
87the system memory, and root filesystem location. Therefore, the
88minimum tagged list should look:
89
90 +-----------+
91base -> | ATAG_CORE | |
92 +-----------+ |
93 | ATAG_MEM | | increasing address
94 +-----------+ |
95 | ATAG_NONE | |
96 +-----------+ v
97
98The tagged list should be stored in system RAM.
99
100The tagged list must be placed in a region of memory where neither
101the kernel decompressor nor initrd 'bootp' program will overwrite
102it. The recommended placement is in the first 16KiB of RAM.
103
1045. Calling the kernel image
105---------------------------
106
107Existing boot loaders: MANDATORY
108New boot loaders: MANDATORY
109
110There are two options for calling the kernel zImage. If the zImage
111is stored in flash, and is linked correctly to be run from flash,
112then it is legal for the boot loader to call the zImage in flash
113directly.
114
115The zImage may also be placed in system RAM (at any location) and
116called there. Note that the kernel uses 16K of RAM below the image
117to store page tables. The recommended placement is 32KiB into RAM.
118
119In either case, the following conditions must be met:
120
Andrzej Zaborowski13fce802006-03-24 18:13:37 +0100121- Quiesce all DMA capable devices so that memory does not get
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 corrupted by bogus network packets or disk data. This will save
123 you many hours of debug.
124
125- CPU register settings
126 r0 = 0,
127 r1 = machine type number discovered in (3) above.
Grant Likely7211da12011-02-14 08:13:20 -0700128 r2 = physical address of tagged list in system RAM.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
130- CPU mode
131 All forms of interrupts must be disabled (IRQs and FIQs)
132 The CPU must be in SVC mode. (A special exception exists for Angel)
133
134- Caches, MMUs
135 The MMU must be off.
136 Instruction cache may be on or off.
137 Data cache must be off.
138
139- The boot loader is expected to call the kernel image by jumping
140 directly to the first instruction of the kernel image.
141