3 This is the GRUB. Welcome.
5 This file contains instructions for compiling and installing the GRUB.
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
15 Note: older versions may work but support is limited
17 Experimental support for clang 3.3 or later (results in much bigger binaries)
18 for i386, x86_64, arm (except thumb), arm64, mips(el), powerpc, sparc64
19 Note: clang 3.2 or later works for i386 and x86_64 targets but results in
21 earlier versions not tested
22 Note: clang 3.2 or later works for arm
23 None of tested clang versions generated usable thumb code
24 earlier versions not tested
25 Note: clang 3.3 or later works for arm64
26 earlier versions have no arm64 support
27 Note: clang 3.3 or later works for mips(el)
28 earlier versions fail to generate .reginfo and hence gprel relocations
30 Note: clang 3.2 or later works for powerpc
31 earlier versions not tested
32 Note: clang 3.5 or later works for sparc64
33 earlier versions return "error: unable to interface with target machine"
34 Note: clang has no support for ia64 and hence you can't compile GRUB
37 * GNU Bison 2.3 or later
38 * GNU gettext 0.17 or later
39 * GNU binutils 2.9.1.0.23 or later
40 * Flex 2.5.35 or later
41 * Other standard GNU/Unix tools
42 * a libc with large file support (e.g. glibc 2.1 or later)
44 On GNU/Linux, you also need:
46 * libdevmapper 1.02.34 or later (recommended)
48 For optional grub-emu features, you need:
51 * libpciaccess (optional)
54 To build GRUB's graphical terminal (gfxterm), you need:
59 If you use a development snapshot or want to hack on GRUB you may
63 * Autoconf 2.60 or later
64 * Automake 1.10.1 or later
66 Prerequisites for make-check:
68 * qemu, specifically the binary 'qemu-system-i386'
69 * xorriso 1.2.9 or later, for grub-mkrescue and grub-shell
74 The `configure' shell script attempts to guess correct values for
75 various system-dependent variables used during compilation. It uses
76 those values to create a `Makefile' in each directory of the package.
77 It may also create one or more `.h' files containing system-dependent
78 definitions. Finally, it creates a shell script `config.status' that
79 you can run in the future to recreate the current configuration, a
80 file `config.cache' that saves the results of its tests to speed up
81 reconfiguring, and a file `config.log' containing compiler output
82 (useful mainly for debugging `configure').
84 If you need to do unusual things to compile the package, please try to
85 figure out how `configure' could check whether to do them, and mail
86 diffs or instructions to the address given in the `README' so they can
87 be considered for the next release. If at some point `config.cache'
88 contains results you don't want to keep, you may remove or edit it.
90 The file `configure.ac' is used to create `configure' by a program
91 called `autoconf'. You only need `configure.in' if you want to change
92 it or regenerate `configure' using a newer version of `autoconf'.
98 The simplest way to compile this package is:
100 1. `cd' to the directory containing the package's source code.
102 2. Skip this and following step if you use release tarball and proceed to
103 step 4. If you want translations type `./linguas.sh'.
105 3. Type `./autogen.sh'.
107 * autogen.sh uses python. By default invocation is "python" but can be
108 overriden by setting variable $PYTHON.
110 4. Type `./configure' to configure the package for your system.
111 If you're using `csh' on an old version of System V, you might
112 need to type `sh ./configure' instead to prevent `csh' from trying
113 to execute `configure' itself.
115 Running `configure' takes awhile. While running, it prints some
116 messages telling which features it is checking for.
118 6. Type `make' to compile the package.
120 7. Optionally, type `make check' to run any self-tests that come with
123 8. Type `make install' to install the programs and any data files and
126 9. You can remove the program binaries and object files from the
127 source code directory by typing `make clean'. To also remove the
128 files that `configure' created (so you can compile the package for
129 a different kind of computer), type `make distclean'. There is
130 also a `make maintainer-clean' target, but that is intended mainly
131 for the package's developers. If you use it, you may have to get
132 all sorts of other programs in order to regenerate files that came
133 with the distribution.
135 Cross-compiling the GRUB
136 ========================
138 GRUB defines 3 platforms:
140 - "Build" is the one which build systems runs on.
141 - "Host" is where you execute GRUB utils.
142 - "Target" is where GRUB itself runs.
144 For grub-emu host and target must be the same but may differ from build.
146 If build and host are different make check isn't available.
148 If build and host are different man pages are not generated.
150 As an example imagine you have a build system running on FreeBSD on sparc
151 which prepares packages for developers running amd64 GNU/Linux laptop and
152 they need to make images for ARM board running U-boot. In this case:
154 build=sparc64-freebsd
158 For this example the configure line might look like (more details below)
159 (some options are optional and included here for completeness but some rarely
160 used options are omitted):
162 ./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
163 CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
164 --target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
165 TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
166 TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
167 TARGET_NM=arm-elf-nm TARGET_RANLIB=arm-elf-ranlib LEX=gflex
169 You need to use following options to specify tools and platforms. For minimum
170 version look at prerequisites. All tools not mentioned in this section under
171 corresponding platform are not needed for the platform in question.
174 1. BUILD_CC= to gcc able to compile for build. This is used, for
175 example, to compile build-gentrigtables which is then run to
176 generate sin and cos tables.
177 2. BUILD_CFLAGS= for C options for build.
178 3. BUILD_CPPFLAGS= for C preprocessor options for build.
179 4. BUILD_LDFLAGS= for linker options for build.
180 5. BUILD_FREETYPE= for freetype-config for build (optional).
183 1. --host= to autoconf name of host.
184 2. CC= for gcc able to compile for host
185 3. HOST_CFLAGS= for C options for host.
186 4. HOST_CPPFLAGS= for C preprocessor options for host.
187 5. HOST_LDFLAGS= for linker options for host.
188 6. FREETYPE= for freetype-config for host (optional).
189 7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
190 8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
191 9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
192 10. Liblzma if any must be in standard linker folders (-llzma) (optional).
195 1. --target= to autoconf cpu name of target.
196 2. --with-platform to choose firmware.
197 3. TARGET_CC= for gcc able to compile for target
198 4. TARGET_CFLAGS= for C options for target.
199 5. TARGET_CPPFLAGS= for C preprocessor options for target.
200 6. TARGET_CCASFLAGS= for assembler options for target.
201 7. TARGET_LDFLAGS= for linker options for target.
202 8. TARGET_OBJCOPY= for objcopy for target.
203 9. TARGET_STRIP= for strip for target.
204 10. TARGET_NM= for nm for target.
205 11. TARGET_RANLIB= for ranlib for target.
207 - Additionally for emu, for host and target.
208 1. SDL is looked for in standard linker directories (-lSDL) (optional)
209 2. libpciaccess is looked for in standard linker directories (-lpciaccess) (optional)
210 3. libusb is looked for in standard linker directories (-lusb) (optional)
212 - Platform-agnostic tools and data.
213 1. make is the tool you execute after ./configure.
214 2. Bison is specified in YACC= variable
215 3. Flex is specified in LEX= variable
216 4. GNU unifont and Djvu sans are looked for in standard directories.
218 Compiling For Multiple Architectures
219 ====================================
221 You can compile the package for more than one kind of computer at the
222 same time, by placing the object files for each architecture in their
223 own directory. `cd' to the directory where you want the object files
224 and executables to go and run the `configure' script. `configure'
225 automatically checks for the source code in the directory that
226 `configure' is in and in `..'.
232 By default, `make install' will install the package's files in
233 `/usr/local/bin', `/usr/local/man', etc. You can specify an
234 installation prefix by giving `configure' the option `--prefix=PATH'.
236 You can specify separate installation prefixes for
237 architecture-specific files and architecture-independent files. If
238 you give `configure' the option `--exec-prefix=PATH', the package will
239 use PATH as the prefix for installing programs and libraries.
240 Documentation and other data files will still use the regular prefix.
242 In addition, if you use an unusual directory layout you can give
243 options like `--bindir=PATH' to specify different values for
244 particular kinds of files. Run `configure --help' for a list of the
245 directories you can set and what kinds of files go in them.
247 If the package supports it, you can cause programs to be installed
248 with an extra prefix or suffix on their names by giving `configure'
249 the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
251 Please note, however, that the GRUB knows where it is located in the
252 filesystem. If you have installed it in an unusual location, the
253 system might not work properly, or at all. The chief utility of these
254 options for the GRUB is to allow you to "install" in some alternate
255 location, and then copy these to the actual root filesystem later.
261 If you want to set default values for `configure' scripts to share,
262 you can create a site shell script called `config.site' that gives
263 default values for variables like `CC', `cache_file', and `prefix'.
264 `configure' looks for `PREFIX/share/config.site' if it exists, then
265 `PREFIX/etc/config.site' if it exists. Or, you can set the
266 `CONFIG_SITE' environment variable to the location of the site script.
267 A warning: not all `configure' scripts look for a site script.
273 `configure' recognizes the following options to control how it
277 Use and save the results of the tests in FILE instead of
278 `./config.cache'. Set FILE to `/dev/null' to disable caching, for
279 debugging `configure'.
282 Print a summary of the options to `configure', and exit.
287 Do not print messages saying which checks are being made.
290 Look for the package's source code in directory DIR. Usually
291 `configure' can determine that directory automatically.
294 Print the version of Autoconf used to generate the `configure'