]> git.proxmox.com Git - grub2.git/blob - INSTALL
proxmox-grub: depend on grub-common
[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 5.1.0 or later
15 Experimental support for clang 3.8.0 or later (results in much bigger binaries)
16 for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64
17 * GNU Make
18 * GNU Bison 2.3 or later
19 * GNU gettext 0.17 or later
20 * GNU binutils 2.9.1.0.23 or later
21 * Flex 2.5.35 or later
22 * pkg-config
23 * Other standard GNU/Unix tools
24 * a libc with large file support (e.g. glibc 2.1 or later)
25
26 On GNU/Linux, you also need:
27
28 * libdevmapper 1.02.34 or later (recommended)
29
30 For optional grub-emu features, you need:
31
32 * SDL (recommended)
33 * libpciaccess (optional)
34 * libusb (optional)
35
36 To build GRUB's graphical terminal (gfxterm), you need:
37
38 * FreeType 2.1.5 or later
39 * GNU Unifont
40
41 If you use a development snapshot or want to hack on GRUB you may
42 need the following.
43
44 * Python 2.6 or later
45 * Autoconf 2.63 or later
46 * Automake 1.11 or later
47
48 Prerequisites for make-check:
49
50 * qemu, specifically the binary 'qemu-system-i386'
51 * xorriso 1.2.9 or later, for grub-mkrescue and grub-shell
52
53 Configuring the GRUB
54 ====================
55
56 The `configure' shell script attempts to guess correct values for
57 various system-dependent variables used during compilation. It uses
58 those values to create a `Makefile' in each directory of the package.
59 It may also create one or more `.h' files containing system-dependent
60 definitions. Finally, it creates a shell script `config.status' that
61 you can run in the future to recreate the current configuration, a
62 file `config.cache' that saves the results of its tests to speed up
63 reconfiguring, and a file `config.log' containing compiler output
64 (useful mainly for debugging `configure').
65
66 If you need to do unusual things to compile the package, please try to
67 figure out how `configure' could check whether to do them, and mail
68 diffs or instructions to the address given in the `README' so they can
69 be considered for the next release. If at some point `config.cache'
70 contains results you don't want to keep, you may remove or edit it.
71
72 The file `configure.ac' is used to create `configure' by a program
73 called `autoconf'. You only need `configure.in' if you want to change
74 it or regenerate `configure' using a newer version of `autoconf'.
75
76
77 Building the GRUB
78 =================
79
80 The simplest way to compile this package is:
81
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
87 3. Type `./bootstrap'.
88
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.
92
93 4. Type `./configure' to configure the package for your system.
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.
97
98 Running `configure' takes awhile. While running, it prints some
99 messages telling which features it is checking for.
100
101 6. Type `make' to compile the package.
102
103 7. Optionally, type `make check' to run any self-tests that come with
104 the package.
105
106 8. Type `make install' to install the programs and any data files and
107 documentation.
108
109 9. You can remove the program binaries and object files from the
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
118 Cross-compiling the GRUB
119 ========================
120
121 GRUB 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
127 For grub-emu host and target must be the same but may differ from build.
128
129 If build and host are different make check isn't available.
130
131 If build and host are different man pages are not generated.
132
133 As an example imagine you have a build system running on FreeBSD on sparc
134 which prepares packages for developers running amd64 GNU/Linux laptop and
135 they need to make images for ARM board running U-boot. In this case:
136
137 build=sparc64-freebsd
138 host=amd64-linux-gnu
139 target=arm-uboot
140
141 For this example the configure line might look like (more details below)
142 (some options are optional and included here for completeness but some rarely
143 used options are omitted):
144
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
154 Normally, for building a GRUB on amd64 with tools to run on amd64 to
155 generate images to run on ARM, using your Linux distribution's
156 packaged cross compiler, the following would suffice:
157
158 ./configure --target=arm-linux-gnueabihf --with-platform=efi
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_LDFLAGS= for linker options for build.
171 5. BUILD_PKG_CONFIG= for pkg-config for build (optional).
172
173 - For host
174 1. --host= to autoconf name of host.
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.
187
188 - For target
189 1. --target= to autoconf cpu name of target.
190 2. --with-platform to choose firmware.
191 3. TARGET_CC= for gcc able to compile for target.
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.
199 11. TARGET_RANLIB= for ranlib for target.
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.
204
205 - Additionally for emu, for host and target.
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)
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.
215
216 Compiling For Multiple Architectures
217 ====================================
218
219 You can compile the package for more than one kind of computer at the
220 same time, by placing the object files for each architecture in their
221 own directory. `cd' to the directory where you want the object files
222 and executables to go and run the `configure' script. `configure'
223 automatically checks for the source code in the directory that
224 `configure' is in and in `..'.
225
226
227 Installation Names
228 ==================
229
230 By default, `make install' will install the package's files in
231 `/usr/local/bin', `/usr/local/man', etc. You can specify an
232 installation prefix by giving `configure' the option `--prefix=PATH'.
233
234 You can specify separate installation prefixes for
235 architecture-specific files and architecture-independent files. If
236 you give `configure' the option `--exec-prefix=PATH', the package will
237 use PATH as the prefix for installing programs and libraries.
238 Documentation and other data files will still use the regular prefix.
239
240 In addition, if you use an unusual directory layout you can give
241 options like `--bindir=PATH' to specify different values for
242 particular kinds of files. Run `configure --help' for a list of the
243 directories you can set and what kinds of files go in them.
244
245 If the package supports it, you can cause programs to be installed
246 with an extra prefix or suffix on their names by giving `configure'
247 the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
248
249 Please note, however, that the GRUB knows where it is located in the
250 filesystem. If you have installed it in an unusual location, the
251 system might not work properly, or at all. The chief utility of these
252 options for the GRUB is to allow you to "install" in some alternate
253 location, and then copy these to the actual root filesystem later.
254
255
256 Sharing Defaults
257 ================
258
259 If you want to set default values for `configure' scripts to share,
260 you can create a site shell script called `config.site' that gives
261 default 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.
265 A warning: not all `configure' scripts look for a site script.
266
267
268 Operation Controls
269 ==================
270
271 `configure' recognizes the following options to control how it
272 operates.
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.