INSTALL 11 KB

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