About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Documentation / arm / Booting




Custom Search

Based on kernel version 3.13. Page generated on 2014-01-20 22:00 EST.

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

Information is copyright its respective author. All material is available from the Linux Kernel Source distributed under a GPL License. This page is provided as a free service by mjmwired.net.