* INSTALL: Document why older clang versions aren't appropriate.
[grub.git] / INSTALL
1 -*- Text -*-
2
3 This is the GRUB.  Welcome.
4
5 This file contains instructions for compiling and installing the GRUB.
6
7 The Requirements
8 ================
9
10 GRUB depends on some software packages installed into your system. If
11 you don't have any of them, please obtain and install them before
12 configuring the GRUB.
13
14 * GCC 4.1.3 or later
15   Note: older versions may work but support is limited
16   Note: clang 3.2 or later works for i386 and x86_64 targets but results in
17         much bigger binaries.
18         earlier versions not tested
19   Note: clang 3.2 or later works for arm
20         earlier versions not tested
21   Note: clang 3.3 or later works for mips(el)
22         earlier versions fail to generate .reginfo and hence gprel relocations
23         fail.
24   Note: clang 3.4 or later works for powerpc
25         earlier versions suffer from vacopy bug (#15286)
26 * GNU Make
27 * GNU Bison 2.3 or later
28 * GNU gettext 0.17 or later
29 * GNU binutils 2.9.1.0.23 or later
30 * Flex 2.5.35 or later
31 * Other standard GNU/Unix tools
32
33 On GNU/Linux, you also need:
34
35 * libdevmapper 1.02.34 or later (recommended)
36
37 For optional grub-emu features, you need:
38
39 * SDL (recommended)
40 * libpciaccess (optional)
41 * libusb (optional)
42
43 To build GRUB's graphical terminal (gfxterm), you need:
44
45 * FreeType 2 or later
46 * GNU Unifont
47
48 If you use a development snapshot or want to hack on GRUB you may
49 need the following.
50
51 * Python 2.5.2 or later
52 * Autoconf 2.60 or later
53 * Automake 1.10.1 or later
54 * Autogen 5.10 or later
55
56 Prerequisites for make-check:
57
58 * qemu, specifically the binary 'qemu-system-i386'
59 * xorriso 1.2.9 or later, for grub-mkrescue and grub-shell
60
61 Configuring the GRUB
62 ====================
63
64 The `configure' shell script attempts to guess correct values for
65 various system-dependent variables used during compilation.  It uses
66 those values to create a `Makefile' in each directory of the package.
67 It may also create one or more `.h' files containing system-dependent
68 definitions.  Finally, it creates a shell script `config.status' that
69 you can run in the future to recreate the current configuration, a
70 file `config.cache' that saves the results of its tests to speed up
71 reconfiguring, and a file `config.log' containing compiler output
72 (useful mainly for debugging `configure').
73
74 If you need to do unusual things to compile the package, please try to
75 figure out how `configure' could check whether to do them, and mail
76 diffs or instructions to the address given in the `README' so they can
77 be considered for the next release.  If at some point `config.cache'
78 contains results you don't want to keep, you may remove or edit it.
79
80 The file `configure.ac' is used to create `configure' by a program
81 called `autoconf'.  You only need `configure.in' if you want to change
82 it or regenerate `configure' using a newer version of `autoconf'.
83
84
85 Building the GRUB
86 =================
87
88 The simplest way to compile this package is:
89
90   1. `cd' to the directory containing the package's source code.
91
92   2. Skip this and following step if you use release tarball and proceed to
93      step 4. If you want translations type `./linguas.sh'.
94   
95   3. Type `./autogen.sh'.
96
97   4. Type `./configure' to configure the package for your system.
98      If you're using `csh' on an old version of System V, you might
99      need to type `sh ./configure' instead to prevent `csh' from trying
100      to execute `configure' itself.
101
102      Running `configure' takes awhile.  While running, it prints some
103      messages telling which features it is checking for.
104
105   6. Type `make' to compile the package.
106
107   7. Optionally, type `make check' to run any self-tests that come with
108      the package.
109
110   8. Type `make install' to install the programs and any data files and
111      documentation.
112
113   9. You can remove the program binaries and object files from the
114      source code directory by typing `make clean'.  To also remove the
115      files that `configure' created (so you can compile the package for
116      a different kind of computer), type `make distclean'.  There is
117      also a `make maintainer-clean' target, but that is intended mainly
118      for the package's developers.  If you use it, you may have to get
119      all sorts of other programs in order to regenerate files that came
120      with the distribution.
121
122 Cross-compiling the GRUB
123 ========================
124
125 GRUB defines 3 platforms:
126
127   - "Build" is the one which build systems runs on.
128   - "Host" is where you execute GRUB utils.
129   - "Target" is where GRUB itself runs.
130
131 For grub-emu host and target must be the same but may differ from build.
132
133 If build and host are different make check isn't available.
134
135 If build and host are different man pages are not generated.
136
137 As an example imagine you have a build system running on FreeBSD on sparc
138 which prepares packages for developpers running amd64 GNU/Linux laptop and
139 they need to make images for ARM board running U-boot. In this case:
140
141 build=sparc64-freebsd
142 host=amd64-linux-gnu
143 target=arm-uboot
144
145 For this example the configure line might look like (more details below)
146 (some options are optional and included here for completeness but some rarely
147 used options are omited):
148
149 ./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
150 CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
151 --target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
152 TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
153 TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
154 TARGET_NM=arm-elf-nm TARGET_RANLIB=arm-elf-ranlib LEX=gflex
155
156 You need to use following options to specify tools and platforms. For minimum
157 version look at prerequisites. All tools not mentioned in this section under
158 corresponding platform are not needed for the platform in question.
159
160   - For build
161     1. BUILD_CC= to gcc able to compile for build. This is used, for
162        example, to compile build-gentrigtables which is then run to
163        generate sin and cos tables.
164     2. BUILD_CFLAGS= for C options for build.
165     3. BUILD_CPPFLAGS= for C preprocessor options for build.
166     4. BUILD_FREETYPE= for freetype-config for build (optional).
167
168   - For host
169     1. --host= to autoconf name of host.
170     2. CC= for gcc able to compile for host
171     3. CFLAGS= for C options for host.
172     4. CPPFLAGS= for C preprocessor options for host.
173     5. LDFLAGS= for linker options for host.
174     6. FREETYPE= for freetype-config for host (optional).
175     7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
176     8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
177     9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
178     10. Liblzma if any must be in standard linker folders (-llzma) (optional).
179
180   - For target
181     1. --target= to autoconf cpu name of target.
182     2. --with-platform to choose firmware.
183     3. TARGET_CC= for gcc able to compile for target
184     4. TARGET_CFLAGS= for C options for target.
185     5. TARGET_CPPFLAGS= for C preprocessor options for target.
186     6. TARGET_CCASFLAGS= for assembler options for target.
187     7. TARGET_LDFLAGS= for linker options for target.
188     8. TARGET_OBJCOPY= for objcopy for target.
189     9. TARGET_STRIP= for strip for target.
190     10. TARGET_NM= for nm for target.
191     11. TARGET_RANLIB= for ranlib for target.
192
193   - Additionally for emu, for host and target.
194     1. SDL is looked for in stadard linker directories (-lSDL) (optional)
195     2. libpciaccess is looked for in stadard linker directories (-lpciaccess) (optional)
196     3. libusb is looked for in stadard linker directories (-lusb) (optional)
197
198   - Platform-agnostic tools and data.
199     1. make is the tool you execute after ./configure.
200     2. Bison is specified in YACC= variable
201     3. Flex is specified in LEX= variable
202     4. GNU unifont and Djvu sans are looked for in standard directories.
203
204 Compiling For Multiple Architectures
205 ====================================
206
207 You can compile the package for more than one kind of computer at the
208 same time, by placing the object files for each architecture in their
209 own directory.  `cd' to the directory where you want the object files
210 and executables to go and run the `configure' script.  `configure'
211 automatically checks for the source code in the directory that
212 `configure' is in and in `..'.
213
214
215 Installation Names
216 ==================
217
218 By default, `make install' will install the package's files in
219 `/usr/local/bin', `/usr/local/man', etc.  You can specify an
220 installation prefix by giving `configure' the option `--prefix=PATH'.
221
222 You can specify separate installation prefixes for
223 architecture-specific files and architecture-independent files.  If
224 you give `configure' the option `--exec-prefix=PATH', the package will
225 use PATH as the prefix for installing programs and libraries.
226 Documentation and other data files will still use the regular prefix.
227
228 In addition, if you use an unusual directory layout you can give
229 options like `--bindir=PATH' to specify different values for
230 particular kinds of files.  Run `configure --help' for a list of the
231 directories you can set and what kinds of files go in them.
232
233 If the package supports it, you can cause programs to be installed
234 with an extra prefix or suffix on their names by giving `configure'
235 the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
236
237 Please note, however, that the GRUB knows where it is located in the
238 filesystem.  If you have installed it in an unusual location, the
239 system might not work properly, or at all.  The chief utility of these
240 options for the GRUB is to allow you to "install" in some alternate
241 location, and then copy these to the actual root filesystem later.
242
243
244 Sharing Defaults
245 ================
246
247 If you want to set default values for `configure' scripts to share,
248 you can create a site shell script called `config.site' that gives
249 default values for variables like `CC', `cache_file', and `prefix'.
250 `configure' looks for `PREFIX/share/config.site' if it exists, then
251 `PREFIX/etc/config.site' if it exists.  Or, you can set the
252 `CONFIG_SITE' environment variable to the location of the site script.
253 A warning: not all `configure' scripts look for a site script.
254
255
256 Operation Controls
257 ==================
258
259    `configure' recognizes the following options to control how it
260 operates.
261
262 `--cache-file=FILE'
263      Use and save the results of the tests in FILE instead of
264      `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
265      debugging `configure'.
266
267 `--help'
268      Print a summary of the options to `configure', and exit.
269
270 `--quiet'
271 `--silent'
272 `-q'
273      Do not print messages saying which checks are being made.
274
275 `--srcdir=DIR'
276      Look for the package's source code in directory DIR.  Usually
277      `configure' can determine that directory automatically.
278
279 `--version'
280      Print the version of Autoconf used to generate the `configure'
281      script, and exit.