fs/erofs: Add tests for EROFS in grub-fs-tester
[grub.git] / INSTALL
blob84030c9f40abaa7f51b7ac439794625f5704a5eb
1 -*- Text -*-
3 This is the GRUB.  Welcome.
5 This file contains instructions for compiling and installing the GRUB.
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/.
11 The Requirements
12 ================
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.
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 * Other standard GNU/Unix tools
29 * a libc with large file support (e.g. glibc 2.1 or later)
31 On GNU/Linux, you also need:
33 * libdevmapper 1.02.34 or later (recommended)
35 For optional grub-emu features, you need:
37 * SDL (recommended)
38 * libpciaccess (optional)
40 To build GRUB's graphical terminal (gfxterm), you need:
42 * FreeType 2.1.5 or later
43 * GNU Unifont
45 To build grub-mkfont the unicode fonts are required (xfonts-unifont package
46 on Debian).
48 If you use a development snapshot or want to hack on GRUB you may
49 need the following.
51 * Python 3 (NOTE: python 2.6 should still work, but it's not tested)
52 * Autoconf 2.64 or later
53 * Automake 1.14 or later
55 Your distro may package cross-compiling toolchains such as the following
56 incomplete list on Debian: gcc-aarch64-linux-gnu, gcc-arm-linux-gnueabihf,
57 gcc-mips-linux-gnu, gcc-mipsel-linux-gnu, gcc-powerpc64-linux-gnu,
58 gcc-riscv64-linux-gnu, gcc-sparc64-linux-gnu, mingw-w64 and mingw-w64-tools.
60 More cross compiling toolchains can be found at the following trusted sites:
62 * https://mirrors.kernel.org/pub/tools/crosstool/
63 * https://toolchains.bootlin.com/
65 Prerequisites for make-check:
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)
73 * xorriso 1.2.9 or later, for grub-mkrescue and grub-shell
74 * wamerican, for grub-fs-tester
75 * mtools, FAT tools for EFI platforms
76 * xfonts-unifont, for the functional tests
78 * If running a Linux kernel the following modules must be loaded:
79   - fuse, loop
80   - btrfs, erofs, 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):
86   - btrfs-progs, dosfstools, e2fsprogs, erofs-utils, exfat-utils, f2fs-tools,
87     genromfs, hfsprogs, jfsutils, nilfs-tools, ntfs-3g, reiserfsprogs,
88     squashfs-tools, 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
93 Note that `make check' will run and many tests may complete successfully
94 with only a subset of these prerequisites. However, some tests may be
95 skipped or fail due to missing prerequisites.
97 To build the documentation you'll need:
98 * texinfo, for the info and html documentation
99 * texlive, for building the dvi and pdf documentation (optional)
101 To 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)
107 Configuring the GRUB
108 ====================
110 The `configure' shell script attempts to guess correct values for
111 various system-dependent variables used during compilation.  It uses
112 those values to create a `Makefile' in each directory of the package.
113 It may also create one or more `.h' files containing system-dependent
114 definitions.  Finally, it creates a shell script `config.status' that
115 you can run in the future to recreate the current configuration, a
116 file `config.cache' that saves the results of its tests to speed up
117 reconfiguring, and a file `config.log' containing compiler output
118 (useful mainly for debugging `configure').
120 If you need to do unusual things to compile the package, please try to
121 figure out how `configure' could check whether to do them, and mail
122 diffs or instructions to the address given in the `README' so they can
123 be considered for the next release.  If at some point `config.cache'
124 contains results you don't want to keep, you may remove or edit it.
126 The file `configure.ac' is used to create `configure' by a program
127 called `autoconf'.  You only need `configure.in' if you want to change
128 it or regenerate `configure' using a newer version of `autoconf'.
131 Building the GRUB
132 =================
134 The simplest way to compile this package is:
136   1. `cd' to the directory containing the package's source code.
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   
141   3. Type `./bootstrap'.
143      The autogen.sh (called by bootstrap) uses python. By default autodetect
144      it, but it can be overridden by setting the PYTHON variable.
146   4. Type `./configure' to configure the package for your system.
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.
151      Running `configure' takes awhile.  While running, it prints some
152      messages telling which features it is checking for.
154   6. Type `make' to compile the package.
156   7. Optionally, type `make check' to run any self-tests that come with
157      the package. Note that many of the tests require root privileges in
158      order to run.
160   8. Type `make install' to install the programs and any data files and
161      documentation.
163   9. Type `make html' or `make pdf' to generate the html or pdf
164      documentation.  Note, these are not built by default.
166  10. You can remove the program binaries and object files from the
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.
175 Cross-compiling the GRUB
176 ========================
178 GRUB defines 3 platforms:
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.
184 For grub-emu host and target must be the same but may differ from build.
186 If build and host are different make check isn't available.
188 If build and host are different man pages are not generated.
190 As an example imagine you have a build system running on FreeBSD on sparc
191 which prepares packages for developers running amd64 GNU/Linux laptop and
192 they need to make images for ARM board running U-boot. In this case:
194 build=sparc64-freebsd
195 host=amd64-linux-gnu
196 target=arm-uboot
198 For this example the configure line might look like (more details below)
199 (some options are optional and included here for completeness but some rarely
200 used options are omitted):
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 \
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
212 Note, that the autoconf 2.65 manual states that when using the --host argument
213 to configure, the --build argument should be specified as well. Not sending
214 --build, enters a compatibility mode that will be removed in the future.
216 Normally, for building a GRUB on amd64 with tools to run on amd64 to
217 generate images to run on ARM, using your Linux distribution's
218 packaged cross compiler, the following would suffice:
220   ./configure --target=arm-linux-gnueabihf --with-platform=efi
222 You need to use following options to specify tools and platforms. For minimum
223 version look at prerequisites. All tools not mentioned in this section under
224 corresponding platform are not needed for the platform in question.
226   - For build
227     1. --build= to autoconf name of build.
228     2. BUILD_CC= to gcc able to compile for build. This is used, for
229        example, to compile build-gentrigtables which is then run to
230        generate sin and cos tables.
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).
236   - For host
237     1. --host= to autoconf name of host.
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.
251   - For target
252     1. --target= to autoconf cpu name of target.
253     2. --with-platform to choose firmware.
254     3. TARGET_CC= for gcc able to compile for target.
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.
262     11. TARGET_RANLIB= for ranlib for target.
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.
268   - Additionally for emu, for host and target.
269     1. SDL is looked for in standard linker directories (-lSDL) (optional)
270     2. libpciaccess is looked for in standard linker directories (-lpciaccess) (optional)
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.
278 Compiling For Multiple Architectures
279 ====================================
281 You can compile the package for more than one kind of computer at the
282 same time, by placing the object files for each architecture in their
283 own directory.  `cd' to the directory where you want the object files
284 and executables to go and run the `configure' script.  `configure'
285 automatically checks for the source code in the directory that
286 `configure' is in and in `..'.
289 Installation Names
290 ==================
292 By default, `make install' will install the package's files in
293 `/usr/local/bin', `/usr/local/man', etc.  You can specify an
294 installation prefix by giving `configure' the option `--prefix=PATH'.
296 You can specify separate installation prefixes for
297 architecture-specific files and architecture-independent files.  If
298 you give `configure' the option `--exec-prefix=PATH', the package will
299 use PATH as the prefix for installing programs and libraries.
300 Documentation and other data files will still use the regular prefix.
302 In addition, if you use an unusual directory layout you can give
303 options like `--bindir=PATH' to specify different values for
304 particular kinds of files.  Run `configure --help' for a list of the
305 directories you can set and what kinds of files go in them.
307 If the package supports it, you can cause programs to be installed
308 with an extra prefix or suffix on their names by giving `configure'
309 the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
311 Please note, however, that the GRUB knows where it is located in the
312 filesystem.  If you have installed it in an unusual location, the
313 system might not work properly, or at all.  The chief utility of these
314 options for the GRUB is to allow you to "install" in some alternate
315 location, and then copy these to the actual root filesystem later.
318 Sharing Defaults
319 ================
321 If you want to set default values for `configure' scripts to share,
322 you can create a site shell script called `config.site' that gives
323 default 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.
327 A warning: not all `configure' scripts look for a site script.
330 Operation Controls
331 ==================
333    `configure' recognizes the following options to control how it
334 operates.
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'.
341 `--help'
342      Print a summary of the options to `configure', and exit.
344 `--quiet'
345 `--silent'
346 `-q'
347      Do not print messages saying which checks are being made.
349 `--srcdir=DIR'
350      Look for the package's source code in directory DIR.  Usually
351      `configure' can determine that directory automatically.
353 `--version'
354      Print the version of Autoconf used to generate the `configure'
355      script, and exit.