* INSTALL: Document cross-compilation.

* acinclude.m4: Determine whether nm support -P and --defined-only.
	* configure.ac: Add TARGET_ to all variables pertaining to target
	that don't have it yet.
	* gentpl.py: Likewise.
	* grub-core/Makefile.am: Likewise.
	* grub-core/genmod.sh.in: Likewise.
	* grub-core/gensyminfo.sh.in: Handle OpenBSD and other non-GNU nm
	as well.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-08-22 01:56:28 +02:00
parent ca1fb56345
commit fc97214f7e
8 changed files with 187 additions and 37 deletions

78
INSTALL
View file

@ -108,6 +108,84 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
Cross-compiling the GRUB
========================
GRUB defines 3 platforms:
- "Build" is the one which build systems runs on.
- "Host" is where you execute GRUB utils.
- "Target" is where GRUB itself runs.
For grub-emu host and target must be the same but may differ from build.
If build and host are different make check isn't available.
As an example imagine you have a build system running on FreeBSD on sparc
which prepares packages for developpers running amd64 GNU/Linux laptop and
they need to make images for ARM board running U-boot. In this case:
build=sparc64-freebsd
host=amd64-linux-gnu
target=arm-uboot
For this example the configure line might look like (more details below)
(some options are optional and included here for completeness but some rarely
used options are omited):
./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
--target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc
TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6"
TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip"
TARGET_NM=arm-elf-nm LEX=gflex
You need to use following options to specify tools and platforms. For minimum
version look at prerequisites. All tools not mentioned in this section under
corresponding platform are not needed for the platform in question.
- For build
1. BUILD_CC= to gcc able to compile for build. This is used, for
example, to compile build-gentrigtables which is then run to
generate sin and cos tables.
2. BUILD_CFLAGS= for C options for build.
3. BUILD_CPPFLAGS= for C preprocessor options for build.
4. BUILD_FREETYPE= for freetype-config for build (optional).
- For host
1. --host= to autoconf name of host.
2. CC= for gcc able to compile for host
3. CFLAGS= for C options for host.
4. CPPFLAGS= for C preprocessor options for host.
5. LDFLAGS= for linker options for host.
6. FREETYPE= for freetype-config for host (optional).
7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
9. Libzfs if any must be in standard linker folders (-lzfs) (optional).
10. Liblzma if any must be in standard linker folders (-llzma) (optional).
- For target
1. --target= to autoconf cpu name of target.
2. --with-platform to choose firmware.
3. TARGET_CC= for gcc able to compile for target
4. TARGET_CFLAGS= for C options for target.
5. TARGET_CPPFLAGS= for C preprocessor options for target.
6. TARGET_CCASFLAGS= for assembler options for target.
7. TARGET_LDFLAGS= for linker options for target.
8. TARGET_OBJCOPY= for objcopy for target.
9. TARGET_STRIP= for strip for target.
10. TARGET_NM= for nm for target.
- Additionally for emu, for host and target.
1. SDL is looked for in stadard linker directories (-lSDL) (optional)
2. libpciaccess is looked for in stadard linker directories (-lpciaccess) (optional)
3. libusb is looked for in stadard linker directories (-lusb) (optional)
- Platform-agnostic tools and data.
1. make is the tool you execute after ./configure.
2. Bison is specified in YACC= variable
3. Flex is specified in LEX= variable
4. GNU unifont and Djvu sans are looked for in standard directories.
Compiling For Multiple Architectures
====================================