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