Debian Codegraph @

INSTALL

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 -*- Text -*-
2
3 This is the GRUB. Welcome.
4
5 This file contains instructions for compiling and installing the GRUB.
6
7 Where this document refers to packages names, they are named according to the
8 Debian 11 package repositories. These packages can be found by searching
9 https://packages.debian.org/.
10
11 The Requirements
12 ================
13
14 GRUB depends on some software packages installed into your system. If
15 you don't have any of them, please obtain and install them before
16 configuring the GRUB.
17
18 * GCC 5.1.0 or later
19 Experimental support for clang 8.0.0 or later (results in much bigger binaries)
20 for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64
21 * GNU Make
22 * GNU Bison 2.3 or later
23 * GNU gettext
24 * GNU binutils 2.9.1.0.23 or later
25 * Flex 2.5.35 or later
26 * pkg-config
27 * GNU patch
28 * wget (for downloading updated translations)
29 * Other standard GNU/Unix tools
30 * a libc with large file support (e.g. glibc 2.1 or later)
31
32 On GNU/Linux, you also need:
33
34 * libdevmapper 1.02.34 or later (recommended)
35
36 For optional grub-emu features, you need:
37
38 * SDL (recommended)
39 * libpciaccess (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 To build grub-mkfont the unicode fonts are required (xfonts-unifont package
47 on Debian).
48
49 To build the optional grub-protect utility the following is needed:
50
51 * libtasn1 (libtasn1-6-dev on Debian)
52
53 If you use a development snapshot or want to hack on GRUB you may
54 need the following.
55
56 * Python 3 (NOTE: python 2.6 should still work, but it's not tested)
57 * Autoconf 2.64 or later
58 * Automake 1.14 or later
59 * GNU Autoconf Archive (autoconf-archive on Debian)
60
61 Your distro may package cross-compiling toolchains such as the following
62 incomplete list on Debian: gcc-aarch64-linux-gnu, gcc-arm-linux-gnueabihf,
63 gcc-mips-linux-gnu, gcc-mipsel-linux-gnu, gcc-powerpc64-linux-gnu,
64 gcc-riscv64-linux-gnu, gcc-sparc64-linux-gnu, mingw-w64 and mingw-w64-tools.
65
66 More cross compiling toolchains can be found at the following trusted sites:
67
68 * https://mirrors.kernel.org/pub/tools/crosstool/
69 * https://toolchains.bootlin.com/
70
71 Prerequisites for running make-check successfully:
72
73 * qemu, specifically the binary "qemu-system-ARCH" where ARCH is the
74 architecture GRUB has been built for; the "qemu-system" package on Debian
75 will install all needed qemu architectures
76 * OVMF, for EFI platforms (packages ovmf, ovmf-ia32, qemu-efi-arm, and
77 qemu-efi-aarch64)
78 * OpenBIOS, for ieee1275 platforms (packages openbios-ppc and openbios-sparc)
79 * xorriso 1.2.9 or later, for grub-mkrescue and grub-shell
80 * wamerican, for grub-fs-tester
81 * mtools, FAT tools for EFI platforms
82 * xfonts-unifont, for the functional tests
83 * swtpm-tools and tpm2-tools, for TPM2 key protector tests
84
85 * If running a Linux kernel the following modules must be loaded:
86 - fuse, loop
87 - btrfs, erofs, ext4, f2fs, fat, hfs, hfsplus, jfs, mac-roman, minix, nilfs2,
88 reiserfs, udf, xfs
89 - On newer kernels, the exfat kernel modules may be used instead of the
90 exfat FUSE filesystem
91 - Kernel version 6.12.x was the last series to include reiserfs support,
92 so later kernels will fail the reiser filesystem test.
93 * The following are Debian named packages required mostly for the full
94 suite of filesystem testing (but some are needed by other tests as well):
95 - btrfs-progs, dosfstools, e2fsprogs, erofs-utils, exfatprogs, exfat-fuse,
96 f2fs-tools, genromfs, hfsprogs, jfsutils, nilfs-tools, ntfs-3g,
97 reiserfsprogs, squashfs-tools, reiserfsprogs, udftools, xfsprogs, zfs-fuse
98 - exfat-fuse, if not using the exfat kernel module
99 - gzip, lzop, xz-utils
100 - attr, cpio, g++, gawk, parted, recode, tar, util-linux
101
102 Note that `make check' will run and many tests may complete successfully
103 with only a subset of these prerequisites. However, some tests may fail
104 due to missing prerequisites.
105
106 To build the documentation you'll need:
107 * texinfo, for the info and html documentation
108 * texlive, for building the dvi and pdf documentation (optional)
109
110 To use the gdb_grub GDB script you'll need:
111 * readelf (binutils package)
112 * objdump (binutils package)
113 * GNU Debugger > 7, built with python support (gdb package)
114 * Python >= 3.5 (python3 package)
115
116 Configuring the GRUB
117 ====================
118
119 The `configure' shell script attempts to guess correct values for
120 various system-dependent variables used during compilation. It uses
121 those values to create a `Makefile' in each directory of the package.
122 It may also create one or more `.h' files containing system-dependent
123 definitions. Finally, it creates a shell script `config.status' that
124 you can run in the future to recreate the current configuration, a
125 file `config.cache' that saves the results of its tests to speed up
126 reconfiguring, and a file `config.log' containing compiler output
127 (useful mainly for debugging `configure').
128
129 If you need to do unusual things to compile the package, please try to
130 figure out how `configure' could check whether to do them, and mail
131 diffs or instructions to the address given in the `README' so they can
132 be considered for the next release. If at some point `config.cache'
133 contains results you don't want to keep, you may remove or edit it.
134
135 The file `configure.ac' is used to create `configure' by a program
136 called `autoconf'. You only need `configure.in' if you want to change
137 it or regenerate `configure' using a newer version of `autoconf'.
138
139
140 Building the GRUB
141 =================
142
143 The simplest way to compile this package is:
144
145 1. `cd' to the directory containing the package's source code.
146
147 2. Type `./bootstrap'.
148
149 The autogen.sh (called by bootstrap) uses python. By default it is
150 autodetected, but it can be overridden by setting the PYTHON variable.
151
152 3. Type `./configure' to configure the package for your system.
153 If you're using `csh' on an old version of System V, you might
154 need to type `sh ./configure' instead to prevent `csh' from trying
155 to execute `configure' itself.
156
157 Running `configure' takes awhile. While running, it prints some
158 messages telling which features it is checking for.
159
160 4. Type `make' to compile the package.
161
162 5. Optionally, type `make check' to run any self-tests that come with
163 the package. Note that many of the tests require root privileges and
164 a specially crafted environment in order to run.
165
166 6. Type `make install' to install the programs and any data files and
167 documentation.
168
169 7. Type `make html' or `make pdf' to generate the html or pdf
170 documentation. Note, these are not built by default.
171
172 8. You can remove the program binaries and object files from the
173 source code directory by typing `make clean'. To also remove the
174 files that `configure' created (so you can compile the package for
175 a different kind of computer), type `make distclean'. There is
176 also a `make maintainer-clean' target, but that is intended mainly
177 for the package's developers. If you use it, you may have to get
178 all sorts of other programs in order to regenerate files that came
179 with the distribution.
180
181 Cross-compiling the GRUB
182 ========================
183
184 GRUB defines 3 platforms:
185
186 - "Build" is the one which build systems runs on.
187 - "Host" is where you execute GRUB utils.
188 - "Target" is where GRUB itself runs.
189
190 For grub-emu host and target must be the same but may differ from build.
191
192 If build and host are different make check isn't available.
193
194 If build and host are different man pages are not generated.
195
196 As an example imagine you have a build system running on FreeBSD on sparc
197 which prepares packages for developers running amd64 GNU/Linux laptop and
198 they need to make images for ARM board running U-boot. In this case:
199
200 build=sparc64-freebsd
201 host=amd64-linux-gnu
202 target=arm-uboot
203
204 For this example the configure line might look like (more details below)
205 (some options are optional and included here for completeness but some rarely
206 used options are omitted):
207
208 ./configure --build=sparc64-freebsd --host=x86_64-linux-gnu \
209 --target=arm-linux-gnueabihf --with-platform=efi \
210 BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config \
211 HOST_CC=x86_64-linux-gnu-gcc HOST_CFLAGS='-g -O2' \
212 PKG_CONFIG=x86_64-linux-gnu-pkg-config TARGET_CC=arm-linux-gnueabihf-gcc \
213 TARGET_CFLAGS='-Os -march=armv8.3-a' TARGET_CCASFLAGS='-march=armv8.3-a' \
214 TARGET_OBJCOPY=arm-linux-gnueabihf-objcopy \
215 TARGET_STRIP=arm-linux-gnueabihf-strip TARGET_NM=arm-linux-gnueabihf-nm \
216 TARGET_RANLIB=arm-linux-gnueabihf-ranlib LEX=flex
217
218 Note, that the autoconf 2.65 manual states that when using the --host argument
219 to configure, the --build argument should be specified as well. Not sending
220 --build, enters a compatibility mode that will be removed in the future.
221
222 Normally, for building a GRUB on amd64 with tools to run on amd64 to
223 generate images to run on ARM, using your Linux distribution's
224 packaged cross compiler, the following would suffice:
225
226 ./configure --target=arm-linux-gnueabihf --with-platform=efi
227
228 You need to use following options to specify tools and platforms. For minimum
229 version look at prerequisites. All tools not mentioned in this section under
230 corresponding platform are not needed for the platform in question.
231
232 - For build
233 1. --build= to autoconf name of build.
234 2. BUILD_CC= to gcc able to compile for build. This is used, for
235 example, to compile build-gentrigtables which is then run to
236 generate sin and cos tables.
237 3. BUILD_CFLAGS= for C options for build.
238 4. BUILD_CPPFLAGS= for C preprocessor options for build.
239 5. BUILD_LDFLAGS= for linker options for build.
240 6. BUILD_PKG_CONFIG= for pkg-config for build (optional).
241
242 - For host
243 1. --host= to autoconf name of host.
244 2. CC= for gcc able to compile for host.
245 3. CFLAGS= for C options for host.
246 4. HOST_CC= for gcc able to compile for host.
247 5. HOST_CFLAGS= for C options for host.
248 6. HOST_CPPFLAGS= for C preprocessor options for host.
249 7. HOST_LDFLAGS= for linker options for host.
250 8. PKG_CONFIG= for pkg-config for host (optional).
251 9. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
252 10. Libfuse if any must be in standard linker folders (-lfuse) (optional).
253 11. Libzfs if any must be in standard linker folders (-lzfs) (optional).
254 12. Liblzma if any must be in standard linker folders (-llzma) (optional).
255 Note: The HOST_* variables override not prefixed variables.
256
257 - For target
258 1. --target= to autoconf cpu name of target.
259 2. --with-platform to choose firmware.
260 3. TARGET_CC= for gcc able to compile for target.
261 4. TARGET_CFLAGS= for C options for target.
262 5. TARGET_CPPFLAGS= for C preprocessor options for target.
263 6. TARGET_CCASFLAGS= for assembler options for target.
264 7. TARGET_LDFLAGS= for linker options for target.
265 8. TARGET_OBJCOPY= for objcopy for target.
266 9. TARGET_STRIP= for strip for target.
267 10. TARGET_NM= for nm for target.
268 11. TARGET_RANLIB= for ranlib for target.
269 Note: If the TARGET_* variables are not specified then they will default
270 to be the same as the host variables. If host variables are not
271 specified then the TARGET_* variables will default to be the same
272 as not prefixed variables.
273
274 - Additionally for emu, for host and target.
275 1. SDL is looked for in standard linker directories (-lSDL) (optional)
276 2. libpciaccess is looked for in standard linker directories (-lpciaccess) (optional)
277
278 - Platform-agnostic tools and data.
279 1. make is the tool you execute after ./configure.
280 2. Bison is specified in YACC= variable
281 3. Flex is specified in LEX= variable
282 4. GNU unifont and Djvu sans are looked for in standard directories.
283
284 Compiling For Multiple Architectures
285 ====================================
286
287 You can compile the package for more than one kind of computer at the
288 same time, by placing the object files for each architecture in their
289 own directory. `cd' to the directory where you want the object files
290 and executables to go and run the `configure' script. `configure'
291 automatically checks for the source code in the directory that
292 `configure' is in and in `..'.
293
294
295 Installation Names
296 ==================
297
298 By default, `make install' will install the package's files in
299 `/usr/local/bin', `/usr/local/man', etc. You can specify an
300 installation prefix by giving `configure' the option `--prefix=PATH'.
301
302 You can specify separate installation prefixes for
303 architecture-specific files and architecture-independent files. If
304 you give `configure' the option `--exec-prefix=PATH', the package will
305 use PATH as the prefix for installing programs and libraries.
306 Documentation and other data files will still use the regular prefix.
307
308 In addition, if you use an unusual directory layout you can give
309 options like `--bindir=PATH' to specify different values for
310 particular kinds of files. Run `configure --help' for a list of the
311 directories you can set and what kinds of files go in them.
312
313 If the package supports it, you can cause programs to be installed
314 with an extra prefix or suffix on their names by giving `configure'
315 the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
316
317 Please note, however, that the GRUB knows where it is located in the
318 filesystem. If you have installed it in an unusual location, the
319 system might not work properly, or at all. The chief utility of these
320 options for the GRUB is to allow you to "install" in some alternate
321 location, and then copy these to the actual root filesystem later.
322
323
324 Sharing Defaults
325 ================
326
327 If you want to set default values for `configure' scripts to share,
328 you can create a site shell script called `config.site' that gives
329 default values for variables like `CC', `cache_file', and `prefix'.
330 `configure' looks for `PREFIX/share/config.site' if it exists, then
331 `PREFIX/etc/config.site' if it exists. Or, you can set the
332 `CONFIG_SITE' environment variable to the location of the site script.
333 A warning: not all `configure' scripts look for a site script.
334
335
336 Operation Controls
337 ==================
338
339 `configure' recognizes the following options to control how it
340 operates.
341
342 `--cache-file=FILE'
343 Use and save the results of the tests in FILE instead of
344 `./config.cache'. Set FILE to `/dev/null' to disable caching, for
345 debugging `configure'.
346
347 `--help'
348 Print a summary of the options to `configure', and exit.
349
350 `--quiet'
351 `--silent'
352 `-q'
353 Do not print messages saying which checks are being made.
354
355 `--srcdir=DIR'
356 Look for the package's source code in directory DIR. Usually
357 `configure' can determine that directory automatically.
358
359 `--version'
360 Print the version of Autoconf used to generate the `configure'
361 script, and exit.