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