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