! I6 a, y% i$ W: cLinux内核是由Uboot进行调用的,在执行内核前,需要满足什么条件呢? ~+ f' ]5 [5 j) Q
( d& h; @& a) k1 f: G* R6 o
我们来看下内核文档Documentation/arm/booting。内核版本为3.7.6。7 s' ]6 s& ^+ S! W) H; Q
* {$ P& }6 `+ F$ u. B Y" Y
。。。。。。& ^) e& e! ^% f5 E% n% {! S# B2 n
" B) z7 t; U6 y% ^
* ? Y! d i+ n( e: k$ \, }
0 d- N% c' ^; Q! `* l) E
5. Calling the kernel image 0 J$ ] x( n# n---------------------------3 Q, Q7 g+ {4 [
3 e0 ?; Z) K, F8 x' z, s) Z
Existing boot loaders: MANDATORY , p' r9 g+ r% G: z V4 XNew boot loaders: MANDATORY 6 B0 }6 Y" L8 \) a5 [4 u$ E% d, U( B
There are two options for calling the kernel zImage. If the zImage + z% p3 P6 X( R# Ois stored in flash, and is linked correctly to be run from flash, & ~6 m! _' v; ^7 G. g4 ithen it is legal for the boot loader to call the zImage in flash 7 |0 F6 Q8 z7 B# Tdirectly. 0 y$ g2 A0 ]" e- Q0 p3 ^/ C+ Y% L$ ^* q) \: M2 u
The zImage may also be placed in system RAM (at any location) and , l( e, g w; Q- ncalled there. Note that the kernel uses 16K of RAM below the image/ q8 u ~! y: p2 F) W% u
to store page tables. The recommended placement is 32KiB into RAM.# K( c" O; Q" K7 f, X
. @, m) p. Q; V1 z8 N+ b3 ^
In either case, the following conditions must be met: : q- M$ f9 O5 `- o) D" ^8 ]! A" C, ^9 n4 r% G
- Quiesce all DMA capable devices so that memory does not get1 _4 `, a1 b' I+ z
corrupted by bogus network packets or disk data. This will save% U1 G( l6 v; ~& j
you many hours of debug. # ?& I% [* v: W& y: P, b( D) l7 o( v- l6 V6 p7 h9 i
- CPU register settings " Q0 k) d- ^0 F# q% H r0 = 0,6 i) v H' r; K5 a* G7 M h8 G
r1 = machine type number discovered in (3) above.! L# @* l+ S" ]$ V( R1 v' _
r2 = physical address of tagged list in system RAM, or( n( L5 ]- Z1 o
physical address of device tree block (dtb) in system RAM 2 R; R) Y( S" O9 `3 A) F; q , m; U: a. n2 C/ ]- CPU mode8 t2 P; w0 c* R0 h
All forms of interrupts must be disabled (IRQs and FIQs) 2 b( ^ h0 ^1 t' |* U7 l + b" ^: g: T1 C+ `( j For CPUs which do not include the ARM virtualization extensions, the, r L0 v. A" s# Z$ b% p1 f
CPU must be in SVC mode. (A special exception exists for Angel) 0 i0 b( J5 ]6 S( Z6 Q 4 i( ]6 p8 }! N& Q5 t2 O- o" V CPUs which include support for the virtualization extensions can be , K7 d b: u' v& n6 W5 v2 M7 K entered in HYP mode in order to enable the kernel to make full use of & O2 E V0 ]2 H+ i these extensions. This is the recommended boot method for such CPUs, 6 W" o7 ^; m( q( N& Z5 r unless the virtualisations are already in use by a pre-installed : p& R+ A, @1 } hypervisor.5 e/ i4 C4 o0 \) e* b* i/ d. w
( Z' c4 R+ v8 ~( W If the kernel is not entered in HYP mode for any reason, it must be/ \0 x* c+ J4 u* p4 d
entered in SVC mode.8 l) @1 u! T+ X: b- G, b7 d M& d
3 ]( V: E1 v* f5 W) w
- Caches, MMUs" U* g) a5 M. Z! z. j$ X6 c& r+ |
The MMU must be off. : I5 s/ z( ^8 S& ^ Instruction cache may be on or off. 9 Q: i: B9 _" p: D' V. u Data cache must be off. 2 b! o! ]( @3 v, P Y ( C6 I; U/ O" u N; [3 x If the kernel is entered in HYP mode, the above requirements apply to 4 Z! |' \6 t/ \% y( Q the HYP mode configuration in addition to the ordinary PL1 (privileged , J6 E; r( }$ x2 r2 P$ u/ f0 ~ kernel modes) configuration. In addition, all traps into the7 \5 u+ J* k& _ x2 w
hypervisor must be disabled, and PL1 access must be granted for all ; {& x( P/ A4 L( e3 N6 p peripherals and CPU resources for which this is architecturally " o% ]" i$ O6 i/ G% G- Z possible. Except for entering in HYP mode, the system configuration 8 K5 Q/ h; y: L N) I should be such that a kernel which does not include support for the + ?8 P# @$ ?/ T2 V virtualization extensions can boot correctly without extra help.7 @* F3 v) ]" e8 W0 K8 |+ F3 T/ E
( a$ R; q: d# A M- The boot loader is expected to call the kernel image by jumping; r! s, M0 ?, x( O. ^. T
directly to the first instruction of the kernel image. 2 z: d* N! R9 e0 k F% `( X6 Y. @) g # j0 n+ `6 w& H& B, l; L On CPUs supporting the ARM instruction set, the entry must be 0 [; g! D5 R& f9 e made in ARM state, even for a Thumb-2 kernel. & T3 K6 K6 o# s+ h" J7 k- r& M3 g1 M. n
On CPUs supporting only the Thumb instruction set such as9 N q; j$ }4 j+ T% ~0 j8 [ Y5 k
Cortex-M class CPUs, the entry must be made in Thumb state. * V6 y3 X) l# q+ g# j; y8 Y% t; D6 S# S1 J5 C" Z4 P! S1 i H h3 Y
9 n0 ^7 O& c( s$ W! I# }9 I9 [
这里,省略了该文档中不感兴趣的部分。 & k6 V, z; e8 _$ l M2 N1 {0 P- ]8 V' ~; W5 t; G7 f# M
根据文档,5 C- t+ i+ R7 B( V. c
) ?) ^7 W$ ?) ^! g2 w
第一, 必须禁止所有使用DMA的设备。 感觉这个有点多余,Uboot使用的设备,包括网卡之类的,一般都不会使用DMA。3 {, |; W. V; M1 j+ t, h3 E