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