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