]>
Commit | Line | Data |
---|---|---|
6a161fa9 | 1 | -*- Text -*- |
2 | ||
4b13b216 | 3 | This is the GRUB. Welcome. |
6a161fa9 | 4 | |
4b13b216 | 5 | This file contains instructions for compiling and installing the GRUB. |
6a161fa9 | 6 | |
7 | The Requirements | |
8 | ================ | |
9 | ||
4b13b216 | 10 | GRUB depends on some software packages installed into your system. If |
6a161fa9 | 11 | you don't have any of them, please obtain and install them before |
4b13b216 | 12 | configuring the GRUB. |
6a161fa9 | 13 | |
e30d87ad | 14 | * GCC 4.1.3 or later |
9fdc64a9 | 15 | Note: older versions may work but support is limited |
0b02bfa0 VS |
16 | |
17 | Experimental support for clang 3.3 or later (results in much bigger binaries) | |
dac87d60 | 18 | for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64 |
9fdc64a9 VS |
19 | Note: clang 3.2 or later works for i386 and x86_64 targets but results in |
20 | much bigger binaries. | |
14a94bba | 21 | earlier versions not tested |
2312f06c | 22 | Note: clang 3.2 or later works for arm |
14a94bba | 23 | earlier versions not tested |
dac87d60 VS |
24 | Note: clang on arm64 is not supported due to |
25 | https://llvm.org/bugs/show_bug.cgi?id=26030 | |
8109c5d4 | 26 | Note: clang 3.3 or later works for mips(el) |
14a94bba VS |
27 | earlier versions fail to generate .reginfo and hence gprel relocations |
28 | fail. | |
b73b70eb VS |
29 | Note: clang 3.2 or later works for powerpc |
30 | earlier versions not tested | |
155f334f VS |
31 | Note: clang 3.5 or later works for sparc64 |
32 | earlier versions return "error: unable to interface with target machine" | |
7b04fe6c VS |
33 | Note: clang has no support for ia64 and hence you can't compile GRUB |
34 | for ia64 with clang | |
6a161fa9 | 35 | * GNU Make |
160034b2 | 36 | * GNU Bison 2.3 or later |
fc8345da | 37 | * GNU gettext 0.17 or later |
6a161fa9 | 38 | * GNU binutils 2.9.1.0.23 or later |
7d8c0213 | 39 | * Flex 2.5.35 or later |
7e23437d | 40 | * pkg-config |
6a161fa9 | 41 | * Other standard GNU/Unix tools |
3bac4caa | 42 | * a libc with large file support (e.g. glibc 2.1 or later) |
86e5b1db | 43 | |
795b593a CW |
44 | On GNU/Linux, you also need: |
45 | ||
efa1bee7 | 46 | * libdevmapper 1.02.34 or later (recommended) |
795b593a | 47 | |
db99fbe8 | 48 | For optional grub-emu features, you need: |
795b593a | 49 | |
795b593a | 50 | * SDL (recommended) |
db99fbe8 VS |
51 | * libpciaccess (optional) |
52 | * libusb (optional) | |
795b593a CW |
53 | |
54 | To build GRUB's graphical terminal (gfxterm), you need: | |
55 | ||
7e23437d | 56 | * FreeType 2.1.5 or later |
795b593a CW |
57 | * GNU Unifont |
58 | ||
86e5b1db | 59 | If you use a development snapshot or want to hack on GRUB you may |
60 | need the following. | |
61 | ||
aa437b58 | 62 | * Python 2.6 or later |
35b90906 CW |
63 | * Autoconf 2.63 or later |
64 | * Automake 1.11 or later | |
6a161fa9 | 65 | |
fc8345da JU |
66 | Prerequisites for make-check: |
67 | ||
68 | * qemu, specifically the binary 'qemu-system-i386' | |
8ca86b3a | 69 | * xorriso 1.2.9 or later, for grub-mkrescue and grub-shell |
fc8345da | 70 | |
4b13b216 | 71 | Configuring the GRUB |
6a161fa9 | 72 | ==================== |
73 | ||
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'). | |
83 | ||
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. | |
89 | ||
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'. | |
93 | ||
94 | ||
4b13b216 | 95 | Building the GRUB |
6a161fa9 | 96 | ================= |
97 | ||
98 | The simplest way to compile this package is: | |
99 | ||
9f73ebd4 VS |
100 | 1. `cd' to the directory containing the package's source code. |
101 | ||
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'. | |
104 | ||
35b90906 | 105 | 3. Type `./bootstrap'. |
9f73ebd4 | 106 | |
35b90906 CW |
107 | * autogen.sh (called by bootstrap) uses python. By default the |
108 | invocation is "python", but it can be overridden by setting the | |
109 | variable $PYTHON. | |
be41c1cf | 110 | |
9f73ebd4 | 111 | 4. Type `./configure' to configure the package for your system. |
86e5b1db | 112 | If you're using `csh' on an old version of System V, you might |
113 | need to type `sh ./configure' instead to prevent `csh' from trying | |
114 | to execute `configure' itself. | |
6a161fa9 | 115 | |
116 | Running `configure' takes awhile. While running, it prints some | |
117 | messages telling which features it is checking for. | |
118 | ||
9f73ebd4 | 119 | 6. Type `make' to compile the package. |
6a161fa9 | 120 | |
9f73ebd4 | 121 | 7. Optionally, type `make check' to run any self-tests that come with |
6a161fa9 | 122 | the package. |
123 | ||
9f73ebd4 | 124 | 8. Type `make install' to install the programs and any data files and |
6a161fa9 | 125 | documentation. |
126 | ||
9f73ebd4 | 127 | 9. You can remove the program binaries and object files from the |
6a161fa9 | 128 | source code directory by typing `make clean'. To also remove the |
129 | files that `configure' created (so you can compile the package for | |
130 | a different kind of computer), type `make distclean'. There is | |
131 | also a `make maintainer-clean' target, but that is intended mainly | |
132 | for the package's developers. If you use it, you may have to get | |
133 | all sorts of other programs in order to regenerate files that came | |
134 | with the distribution. | |
135 | ||
fc97214f VS |
136 | Cross-compiling the GRUB |
137 | ======================== | |
138 | ||
139 | GRUB defines 3 platforms: | |
140 | ||
141 | - "Build" is the one which build systems runs on. | |
142 | - "Host" is where you execute GRUB utils. | |
143 | - "Target" is where GRUB itself runs. | |
144 | ||
145 | For grub-emu host and target must be the same but may differ from build. | |
146 | ||
147 | If build and host are different make check isn't available. | |
148 | ||
7f68269a VS |
149 | If build and host are different man pages are not generated. |
150 | ||
fc97214f | 151 | As an example imagine you have a build system running on FreeBSD on sparc |
51f941a0 | 152 | which prepares packages for developers running amd64 GNU/Linux laptop and |
fc97214f VS |
153 | they need to make images for ARM board running U-boot. In this case: |
154 | ||
155 | build=sparc64-freebsd | |
156 | host=amd64-linux-gnu | |
157 | target=arm-uboot | |
158 | ||
159 | For this example the configure line might look like (more details below) | |
160 | (some options are optional and included here for completeness but some rarely | |
51f941a0 | 161 | used options are omitted): |
fc97214f | 162 | |
f2d56dea DK |
163 | ./configure --host=x86_64-linux-gnu --target=arm-linux-gnueabihf \ |
164 | --with-platform=efi BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config \ | |
165 | HOST_CC=x86_64-linux-gnu-gcc HOST_CFLAGS='-g -O2' \ | |
166 | PKG_CONFIG=x86_64-linux-gnu-pkg-config TARGET_CC=arm-linux-gnueabihf-gcc \ | |
167 | TARGET_CFLAGS='-Os -march=armv8.3-a' TARGET_CCASFLAGS='-march=armv8.3-a' \ | |
168 | TARGET_OBJCOPY=arm-linux-gnueabihf-objcopy \ | |
169 | TARGET_STRIP=arm-linux-gnueabihf-strip TARGET_NM=arm-linux-gnueabihf-nm \ | |
170 | TARGET_RANLIB=arm-linux-gnueabihf-ranlib LEX=flex | |
171 | ||
172 | Normally, for building a GRUB on amd64 with tools to run on amd64 to | |
173 | generate images to run on ARM, using your Linux distribution's | |
174 | packaged cross compiler, the following would suffice: | |
175 | ||
176 | ./configure --target=arm-linux-gnueabihf --with-platform=efi | |
fc97214f VS |
177 | |
178 | You need to use following options to specify tools and platforms. For minimum | |
179 | version look at prerequisites. All tools not mentioned in this section under | |
180 | corresponding platform are not needed for the platform in question. | |
181 | ||
182 | - For build | |
183 | 1. BUILD_CC= to gcc able to compile for build. This is used, for | |
184 | example, to compile build-gentrigtables which is then run to | |
185 | generate sin and cos tables. | |
186 | 2. BUILD_CFLAGS= for C options for build. | |
187 | 3. BUILD_CPPFLAGS= for C preprocessor options for build. | |
dcecae1a | 188 | 4. BUILD_LDFLAGS= for linker options for build. |
7e23437d | 189 | 5. BUILD_PKG_CONFIG= for pkg-config for build (optional). |
fc97214f VS |
190 | |
191 | - For host | |
192 | 1. --host= to autoconf name of host. | |
15d76540 DK |
193 | 2. CC= for gcc able to compile for host. |
194 | 3. CFLAGS= for C options for host. | |
195 | 4. HOST_CC= for gcc able to compile for host. | |
196 | 5. HOST_CFLAGS= for C options for host. | |
197 | 6. HOST_CPPFLAGS= for C preprocessor options for host. | |
198 | 7. HOST_LDFLAGS= for linker options for host. | |
199 | 8. PKG_CONFIG= for pkg-config for host (optional). | |
200 | 9. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional). | |
201 | 10. Libfuse if any must be in standard linker folders (-lfuse) (optional). | |
202 | 11. Libzfs if any must be in standard linker folders (-lzfs) (optional). | |
203 | 12. Liblzma if any must be in standard linker folders (-llzma) (optional). | |
204 | Note: The HOST_* variables override not prefixed variables. | |
fc97214f VS |
205 | |
206 | - For target | |
207 | 1. --target= to autoconf cpu name of target. | |
208 | 2. --with-platform to choose firmware. | |
15d76540 | 209 | 3. TARGET_CC= for gcc able to compile for target. |
fc97214f VS |
210 | 4. TARGET_CFLAGS= for C options for target. |
211 | 5. TARGET_CPPFLAGS= for C preprocessor options for target. | |
212 | 6. TARGET_CCASFLAGS= for assembler options for target. | |
213 | 7. TARGET_LDFLAGS= for linker options for target. | |
214 | 8. TARGET_OBJCOPY= for objcopy for target. | |
215 | 9. TARGET_STRIP= for strip for target. | |
216 | 10. TARGET_NM= for nm for target. | |
0e8daad0 | 217 | 11. TARGET_RANLIB= for ranlib for target. |
15d76540 DK |
218 | Note: If the TARGET_* variables are not specified then they will default |
219 | to be the same as the host variables. If host variables are not | |
220 | specified then the TARGET_* variables will default to be the same | |
221 | as not prefixed variables. | |
fc97214f VS |
222 | |
223 | - Additionally for emu, for host and target. | |
51f941a0 CW |
224 | 1. SDL is looked for in standard linker directories (-lSDL) (optional) |
225 | 2. libpciaccess is looked for in standard linker directories (-lpciaccess) (optional) | |
226 | 3. libusb is looked for in standard linker directories (-lusb) (optional) | |
fc97214f VS |
227 | |
228 | - Platform-agnostic tools and data. | |
229 | 1. make is the tool you execute after ./configure. | |
230 | 2. Bison is specified in YACC= variable | |
231 | 3. Flex is specified in LEX= variable | |
232 | 4. GNU unifont and Djvu sans are looked for in standard directories. | |
6a161fa9 | 233 | |
234 | Compiling For Multiple Architectures | |
235 | ==================================== | |
236 | ||
237 | You can compile the package for more than one kind of computer at the | |
238 | same time, by placing the object files for each architecture in their | |
239 | own directory. `cd' to the directory where you want the object files | |
240 | and executables to go and run the `configure' script. `configure' | |
241 | automatically checks for the source code in the directory that | |
242 | `configure' is in and in `..'. | |
243 | ||
244 | ||
245 | Installation Names | |
246 | ================== | |
247 | ||
248 | By default, `make install' will install the package's files in | |
249 | `/usr/local/bin', `/usr/local/man', etc. You can specify an | |
250 | installation prefix by giving `configure' the option `--prefix=PATH'. | |
251 | ||
252 | You can specify separate installation prefixes for | |
253 | architecture-specific files and architecture-independent files. If | |
254 | you give `configure' the option `--exec-prefix=PATH', the package will | |
255 | use PATH as the prefix for installing programs and libraries. | |
256 | Documentation and other data files will still use the regular prefix. | |
257 | ||
258 | In addition, if you use an unusual directory layout you can give | |
259 | options like `--bindir=PATH' to specify different values for | |
260 | particular kinds of files. Run `configure --help' for a list of the | |
261 | directories you can set and what kinds of files go in them. | |
262 | ||
263 | If the package supports it, you can cause programs to be installed | |
264 | with an extra prefix or suffix on their names by giving `configure' | |
265 | the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. | |
266 | ||
4b13b216 | 267 | Please note, however, that the GRUB knows where it is located in the |
6a161fa9 | 268 | filesystem. If you have installed it in an unusual location, the |
269 | system might not work properly, or at all. The chief utility of these | |
4b13b216 | 270 | options for the GRUB is to allow you to "install" in some alternate |
6a161fa9 | 271 | location, and then copy these to the actual root filesystem later. |
272 | ||
273 | ||
274 | Sharing Defaults | |
275 | ================ | |
276 | ||
277 | If you want to set default values for `configure' scripts to share, | |
278 | you can create a site shell script called `config.site' that gives | |
279 | default values for variables like `CC', `cache_file', and `prefix'. | |
280 | `configure' looks for `PREFIX/share/config.site' if it exists, then | |
281 | `PREFIX/etc/config.site' if it exists. Or, you can set the | |
282 | `CONFIG_SITE' environment variable to the location of the site script. | |
283 | A warning: not all `configure' scripts look for a site script. | |
284 | ||
285 | ||
286 | Operation Controls | |
287 | ================== | |
288 | ||
289 | `configure' recognizes the following options to control how it | |
290 | operates. | |
291 | ||
292 | `--cache-file=FILE' | |
293 | Use and save the results of the tests in FILE instead of | |
294 | `./config.cache'. Set FILE to `/dev/null' to disable caching, for | |
295 | debugging `configure'. | |
296 | ||
297 | `--help' | |
298 | Print a summary of the options to `configure', and exit. | |
299 | ||
300 | `--quiet' | |
301 | `--silent' | |
302 | `-q' | |
303 | Do not print messages saying which checks are being made. | |
304 | ||
305 | `--srcdir=DIR' | |
306 | Look for the package's source code in directory DIR. Usually | |
307 | `configure' can determine that directory automatically. | |
308 | ||
309 | `--version' | |
310 | Print the version of Autoconf used to generate the `configure' | |
311 | script, and exit. |