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