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
16 Note: clang 3.2 or later works for i386 and x86_64 targets but results in
18 Note: clang 3.4 or later works for powerpc
20 * GNU Bison 2.3 or later
21 * GNU gettext 0.17 or later
22 * GNU binutils 2.9.1.0.23 or later
23 * Flex 2.5.35 or later
24 * Other standard GNU/Unix tools
26 On GNU/Linux, you also need:
28 * libdevmapper 1.02.34 or later (recommended)
30 For optional grub-emu features, you need:
33 * libpciaccess (optional)
36 To build GRUB's graphical terminal (gfxterm), you need:
41 If you use a development snapshot or want to hack on GRUB you may
44 * Python 2.5.2 or later
45 * Autoconf 2.60 or later
46 * Automake 1.10.1 or later
47 * Autogen 5.10 or later
49 Prerequisites for make-check:
51 * qemu, specifically the binary 'qemu-system-i386'
52 * xorriso 1.2.9 or later, for grub-mkrescue and grub-shell
57 The `configure' shell script attempts to guess correct values for
58 various system-dependent variables used during compilation. It uses
59 those values to create a `Makefile' in each directory of the package.
60 It may also create one or more `.h' files containing system-dependent
61 definitions. Finally, it creates a shell script `config.status' that
62 you can run in the future to recreate the current configuration, a
63 file `config.cache' that saves the results of its tests to speed up
64 reconfiguring, and a file `config.log' containing compiler output
65 (useful mainly for debugging `configure').
67 If you need to do unusual things to compile the package, please try to
68 figure out how `configure' could check whether to do them, and mail
69 diffs or instructions to the address given in the `README' so they can
70 be considered for the next release. If at some point `config.cache'
71 contains results you don't want to keep, you may remove or edit it.
73 The file `configure.ac' is used to create `configure' by a program
74 called `autoconf'. You only need `configure.in' if you want to change
75 it or regenerate `configure' using a newer version of `autoconf'.
81 The simplest way to compile this package is:
83 1. `cd' to the directory containing the package's source code.
85 2. Skip this and following step if you use release tarball and proceed to
86 step 4. If you want translations type `./linguas.sh'.
88 3. Type `./autogen.sh'.
90 4. Type `./configure' to configure the package for your system.
91 If you're using `csh' on an old version of System V, you might
92 need to type `sh ./configure' instead to prevent `csh' from trying
93 to execute `configure' itself.
95 Running `configure' takes awhile. While running, it prints some
96 messages telling which features it is checking for.
98 6. Type `make' to compile the package.
100 7. Optionally, type `make check' to run any self-tests that come with
103 8. Type `make install' to install the programs and any data files and
106 9. You can remove the program binaries and object files from the
107 source code directory by typing `make clean'. To also remove the
108 files that `configure' created (so you can compile the package for
109 a different kind of computer), type `make distclean'. There is
110 also a `make maintainer-clean' target, but that is intended mainly
111 for the package's developers. If you use it, you may have to get
112 all sorts of other programs in order to regenerate files that came
113 with the distribution.
115 Cross-compiling the GRUB
116 ========================
118 GRUB defines 3 platforms:
120 - "Build" is the one which build systems runs on.
121 - "Host" is where you execute GRUB utils.
122 - "Target" is where GRUB itself runs.
124 For grub-emu host and target must be the same but may differ from build.
126 If build and host are different make check isn't available.
128 If build and host are different man pages are not generated.
130 As an example imagine you have a build system running on FreeBSD on sparc
131 which prepares packages for developpers running amd64 GNU/Linux laptop and
132 they need to make images for ARM board running U-boot. In this case:
134 build=sparc64-freebsd
138 For this example the configure line might look like (more details below)
139 (some options are optional and included here for completeness but some rarely
140 used options are omited):
142 ./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
143 CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
144 --target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
145 TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
146 TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
147 TARGET_NM=arm-elf-nm TARGET_RANLIB=arm-elf-ranlib LEX=gflex
149 You need to use following options to specify tools and platforms. For minimum
150 version look at prerequisites. All tools not mentioned in this section under
151 corresponding platform are not needed for the platform in question.
154 1. BUILD_CC= to gcc able to compile for build. This is used, for
155 example, to compile build-gentrigtables which is then run to
156 generate sin and cos tables.
157 2. BUILD_CFLAGS= for C options for build.
158 3. BUILD_CPPFLAGS= for C preprocessor options for build.
159 4. BUILD_FREETYPE= for freetype-config for build (optional).
162 1. --host= to autoconf name of host.
163 2. CC= for gcc able to compile for host
164 3. CFLAGS= for C options for host.
165 4. CPPFLAGS= for C preprocessor options for host.
166 5. LDFLAGS= for linker options for host.
167 6. FREETYPE= for freetype-config for host (optional).
168 7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
169 8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
170 9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
171 10. Liblzma if any must be in standard linker folders (-llzma) (optional).
174 1. --target= to autoconf cpu name of target.
175 2. --with-platform to choose firmware.
176 3. TARGET_CC= for gcc able to compile for target
177 4. TARGET_CFLAGS= for C options for target.
178 5. TARGET_CPPFLAGS= for C preprocessor options for target.
179 6. TARGET_CCASFLAGS= for assembler options for target.
180 7. TARGET_LDFLAGS= for linker options for target.
181 8. TARGET_OBJCOPY= for objcopy for target.
182 9. TARGET_STRIP= for strip for target.
183 10. TARGET_NM= for nm for target.
184 11. TARGET_RANLIB= for ranlib for target.
186 - Additionally for emu, for host and target.
187 1. SDL is looked for in stadard linker directories (-lSDL) (optional)
188 2. libpciaccess is looked for in stadard linker directories (-lpciaccess) (optional)
189 3. libusb is looked for in stadard linker directories (-lusb) (optional)
191 - Platform-agnostic tools and data.
192 1. make is the tool you execute after ./configure.
193 2. Bison is specified in YACC= variable
194 3. Flex is specified in LEX= variable
195 4. GNU unifont and Djvu sans are looked for in standard directories.
197 Compiling For Multiple Architectures
198 ====================================
200 You can compile the package for more than one kind of computer at the
201 same time, by placing the object files for each architecture in their
202 own directory. `cd' to the directory where you want the object files
203 and executables to go and run the `configure' script. `configure'
204 automatically checks for the source code in the directory that
205 `configure' is in and in `..'.
211 By default, `make install' will install the package's files in
212 `/usr/local/bin', `/usr/local/man', etc. You can specify an
213 installation prefix by giving `configure' the option `--prefix=PATH'.
215 You can specify separate installation prefixes for
216 architecture-specific files and architecture-independent files. If
217 you give `configure' the option `--exec-prefix=PATH', the package will
218 use PATH as the prefix for installing programs and libraries.
219 Documentation and other data files will still use the regular prefix.
221 In addition, if you use an unusual directory layout you can give
222 options like `--bindir=PATH' to specify different values for
223 particular kinds of files. Run `configure --help' for a list of the
224 directories you can set and what kinds of files go in them.
226 If the package supports it, you can cause programs to be installed
227 with an extra prefix or suffix on their names by giving `configure'
228 the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
230 Please note, however, that the GRUB knows where it is located in the
231 filesystem. If you have installed it in an unusual location, the
232 system might not work properly, or at all. The chief utility of these
233 options for the GRUB is to allow you to "install" in some alternate
234 location, and then copy these to the actual root filesystem later.
240 If you want to set default values for `configure' scripts to share,
241 you can create a site shell script called `config.site' that gives
242 default values for variables like `CC', `cache_file', and `prefix'.
243 `configure' looks for `PREFIX/share/config.site' if it exists, then
244 `PREFIX/etc/config.site' if it exists. Or, you can set the
245 `CONFIG_SITE' environment variable to the location of the site script.
246 A warning: not all `configure' scripts look for a site script.
252 `configure' recognizes the following options to control how it
256 Use and save the results of the tests in FILE instead of
257 `./config.cache'. Set FILE to `/dev/null' to disable caching, for
258 debugging `configure'.
261 Print a summary of the options to `configure', and exit.
266 Do not print messages saying which checks are being made.
269 Look for the package's source code in directory DIR. Usually
270 `configure' can determine that directory automatically.
273 Print the version of Autoconf used to generate the `configure'