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