Debian Codegraph @

INSTALL

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