xref: /OK3568_Linux_fs/kernel/Documentation/arm/arm.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun=======================
2*4882a593SmuzhiyunARM Linux 2.6 and upper
3*4882a593Smuzhiyun=======================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun    Please check <ftp://ftp.arm.linux.org.uk/pub/armlinux> for
6*4882a593Smuzhiyun    updates.
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunCompilation of kernel
9*4882a593Smuzhiyun---------------------
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun  In order to compile ARM Linux, you will need a compiler capable of
12*4882a593Smuzhiyun  generating ARM ELF code with GNU extensions.  GCC 3.3 is known to be
13*4882a593Smuzhiyun  a good compiler.  Fortunately, you needn't guess.  The kernel will report
14*4882a593Smuzhiyun  an error if your compiler is a recognized offender.
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun  To build ARM Linux natively, you shouldn't have to alter the ARCH = line
17*4882a593Smuzhiyun  in the top level Makefile.  However, if you don't have the ARM Linux ELF
18*4882a593Smuzhiyun  tools installed as default, then you should change the CROSS_COMPILE
19*4882a593Smuzhiyun  line as detailed below.
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun  If you wish to cross-compile, then alter the following lines in the top
22*4882a593Smuzhiyun  level make file::
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun    ARCH = <whatever>
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun  with::
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun    ARCH = arm
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun  and::
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun    CROSS_COMPILE=
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun  to::
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun    CROSS_COMPILE=<your-path-to-your-compiler-without-gcc>
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun  eg.::
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun    CROSS_COMPILE=arm-linux-
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun  Do a 'make config', followed by 'make Image' to build the kernel
43*4882a593Smuzhiyun  (arch/arm/boot/Image).  A compressed image can be built by doing a
44*4882a593Smuzhiyun  'make zImage' instead of 'make Image'.
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunBug reports etc
48*4882a593Smuzhiyun---------------
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun  Please send patches to the patch system.  For more information, see
51*4882a593Smuzhiyun  http://www.arm.linux.org.uk/developer/patches/info.php Always include some
52*4882a593Smuzhiyun  explanation as to what the patch does and why it is needed.
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun  Bug reports should be sent to linux-arm-kernel@lists.arm.linux.org.uk,
55*4882a593Smuzhiyun  or submitted through the web form at
56*4882a593Smuzhiyun  http://www.arm.linux.org.uk/developer/
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun  When sending bug reports, please ensure that they contain all relevant
59*4882a593Smuzhiyun  information, eg. the kernel messages that were printed before/during
60*4882a593Smuzhiyun  the problem, what you were doing, etc.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunInclude files
64*4882a593Smuzhiyun-------------
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun  Several new include directories have been created under include/asm-arm,
67*4882a593Smuzhiyun  which are there to reduce the clutter in the top-level directory.  These
68*4882a593Smuzhiyun  directories, and their purpose is listed below:
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun  ============= ==========================================================
71*4882a593Smuzhiyun   `arch-*`	machine/platform specific header files
72*4882a593Smuzhiyun   `hardware`	driver-internal ARM specific data structures/definitions
73*4882a593Smuzhiyun   `mach`	descriptions of generic ARM to specific machine interfaces
74*4882a593Smuzhiyun   `proc-*`	processor dependent header files (currently only two
75*4882a593Smuzhiyun		categories)
76*4882a593Smuzhiyun  ============= ==========================================================
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun
79*4882a593SmuzhiyunMachine/Platform support
80*4882a593Smuzhiyun------------------------
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun  The ARM tree contains support for a lot of different machine types.  To
83*4882a593Smuzhiyun  continue supporting these differences, it has become necessary to split
84*4882a593Smuzhiyun  machine-specific parts by directory.  For this, the machine category is
85*4882a593Smuzhiyun  used to select which directories and files get included (we will use
86*4882a593Smuzhiyun  $(MACHINE) to refer to the category)
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun  To this end, we now have arch/arm/mach-$(MACHINE) directories which are
89*4882a593Smuzhiyun  designed to house the non-driver files for a particular machine (eg, PCI,
90*4882a593Smuzhiyun  memory management, architecture definitions etc).  For all future
91*4882a593Smuzhiyun  machines, there should be a corresponding arch/arm/mach-$(MACHINE)/include/mach
92*4882a593Smuzhiyun  directory.
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun
95*4882a593SmuzhiyunModules
96*4882a593Smuzhiyun-------
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun  Although modularisation is supported (and required for the FP emulator),
99*4882a593Smuzhiyun  each module on an ARM2/ARM250/ARM3 machine when is loaded will take
100*4882a593Smuzhiyun  memory up to the next 32k boundary due to the size of the pages.
101*4882a593Smuzhiyun  Therefore, is modularisation on these machines really worth it?
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun  However, ARM6 and up machines allow modules to take multiples of 4k, and
104*4882a593Smuzhiyun  as such Acorn RiscPCs and other architectures using these processors can
105*4882a593Smuzhiyun  make good use of modularisation.
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun
108*4882a593SmuzhiyunADFS Image files
109*4882a593Smuzhiyun----------------
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun  You can access image files on your ADFS partitions by mounting the ADFS
112*4882a593Smuzhiyun  partition, and then using the loopback device driver.  You must have
113*4882a593Smuzhiyun  losetup installed.
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun  Please note that the PCEmulator DOS partitions have a partition table at
116*4882a593Smuzhiyun  the start, and as such, you will have to give '-o offset' to losetup.
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun
119*4882a593SmuzhiyunRequest to developers
120*4882a593Smuzhiyun---------------------
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun  When writing device drivers which include a separate assembler file, please
123*4882a593Smuzhiyun  include it in with the C file, and not the arch/arm/lib directory.  This
124*4882a593Smuzhiyun  allows the driver to be compiled as a loadable module without requiring
125*4882a593Smuzhiyun  half the code to be compiled into the kernel image.
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun  In general, try to avoid using assembler unless it is really necessary.  It
128*4882a593Smuzhiyun  makes drivers far less easy to port to other hardware.
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun
131*4882a593SmuzhiyunST506 hard drives
132*4882a593Smuzhiyun-----------------
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun  The ST506 hard drive controllers seem to be working fine (if a little
135*4882a593Smuzhiyun  slowly).  At the moment they will only work off the controllers on an
136*4882a593Smuzhiyun  A4x0's motherboard, but for it to work off a Podule just requires
137*4882a593Smuzhiyun  someone with a podule to add the addresses for the IRQ mask and the
138*4882a593Smuzhiyun  HDC base to the source.
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun  As of 31/3/96 it works with two drives (you should get the ADFS
141*4882a593Smuzhiyun  `*configure` harddrive set to 2). I've got an internal 20MB and a great
142*4882a593Smuzhiyun  big external 5.25" FH 64MB drive (who could ever want more :-) ).
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun  I've just got 240K/s off it (a dd with bs=128k); thats about half of what
145*4882a593Smuzhiyun  RiscOS gets; but it's a heck of a lot better than the 50K/s I was getting
146*4882a593Smuzhiyun  last week :-)
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun  Known bug: Drive data errors can cause a hang; including cases where
149*4882a593Smuzhiyun  the controller has fixed the error using ECC. (Possibly ONLY
150*4882a593Smuzhiyun  in that case...hmm).
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun
153*4882a593Smuzhiyun1772 Floppy
154*4882a593Smuzhiyun-----------
155*4882a593Smuzhiyun  This also seems to work OK, but hasn't been stressed much lately.  It
156*4882a593Smuzhiyun  hasn't got any code for disc change detection in there at the moment which
157*4882a593Smuzhiyun  could be a bit of a problem!  Suggestions on the correct way to do this
158*4882a593Smuzhiyun  are welcome.
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun
161*4882a593Smuzhiyun`CONFIG_MACH_` and `CONFIG_ARCH_`
162*4882a593Smuzhiyun---------------------------------
163*4882a593Smuzhiyun  A change was made in 2003 to the macro names for new machines.
164*4882a593Smuzhiyun  Historically, `CONFIG_ARCH_` was used for the bonafide architecture,
165*4882a593Smuzhiyun  e.g. SA1100, as well as implementations of the architecture,
166*4882a593Smuzhiyun  e.g. Assabet.  It was decided to change the implementation macros
167*4882a593Smuzhiyun  to read `CONFIG_MACH_` for clarity.  Moreover, a retroactive fixup has
168*4882a593Smuzhiyun  not been made because it would complicate patching.
169*4882a593Smuzhiyun
170*4882a593Smuzhiyun  Previous registrations may be found online.
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun    <http://www.arm.linux.org.uk/developer/machines/>
173*4882a593Smuzhiyun
174*4882a593SmuzhiyunKernel entry (head.S)
175*4882a593Smuzhiyun---------------------
176*4882a593Smuzhiyun  The initial entry into the kernel is via head.S, which uses machine
177*4882a593Smuzhiyun  independent code.  The machine is selected by the value of 'r1' on
178*4882a593Smuzhiyun  entry, which must be kept unique.
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun  Due to the large number of machines which the ARM port of Linux provides
181*4882a593Smuzhiyun  for, we have a method to manage this which ensures that we don't end up
182*4882a593Smuzhiyun  duplicating large amounts of code.
183*4882a593Smuzhiyun
184*4882a593Smuzhiyun  We group machine (or platform) support code into machine classes.  A
185*4882a593Smuzhiyun  class typically based around one or more system on a chip devices, and
186*4882a593Smuzhiyun  acts as a natural container around the actual implementations.  These
187*4882a593Smuzhiyun  classes are given directories - arch/arm/mach-<class> - which contain
188*4882a593Smuzhiyun  the source files and include/mach/ to support the machine class.
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun  For example, the SA1100 class is based upon the SA1100 and SA1110 SoC
191*4882a593Smuzhiyun  devices, and contains the code to support the way the on-board and off-
192*4882a593Smuzhiyun  board devices are used, or the device is setup, and provides that
193*4882a593Smuzhiyun  machine specific "personality."
194*4882a593Smuzhiyun
195*4882a593Smuzhiyun  For platforms that support device tree (DT), the machine selection is
196*4882a593Smuzhiyun  controlled at runtime by passing the device tree blob to the kernel.  At
197*4882a593Smuzhiyun  compile-time, support for the machine type must be selected.  This allows for
198*4882a593Smuzhiyun  a single multiplatform kernel build to be used for several machine types.
199*4882a593Smuzhiyun
200*4882a593Smuzhiyun  For platforms that do not use device tree, this machine selection is
201*4882a593Smuzhiyun  controlled by the machine type ID, which acts both as a run-time and a
202*4882a593Smuzhiyun  compile-time code selection method.  You can register a new machine via the
203*4882a593Smuzhiyun  web site at:
204*4882a593Smuzhiyun
205*4882a593Smuzhiyun    <http://www.arm.linux.org.uk/developer/machines/>
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun  Note: Please do not register a machine type for DT-only platforms.  If your
208*4882a593Smuzhiyun  platform is DT-only, you do not need a registered machine type.
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun---
211*4882a593Smuzhiyun
212*4882a593SmuzhiyunRussell King (15/03/2004)
213