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