gpu-viv-bin-mx6q: make fb/x11 choice explicit
[buildroot-gz.git] / boot / grub2 / grub2.mk
blob697f0adc143cbcde655de14426f6c14cfd43f176
1 ################################################################################
3 # grub2
5 ################################################################################
7 GRUB2_VERSION = 2.00
8 GRUB2_SITE = $(BR2_GNU_MIRROR)/grub
9 GRUB2_SOURCE = grub-$(GRUB2_VERSION).tar.xz
10 GRUB2_LICENSE = GPLv3+
11 GRUB2_LICENSE_FILES = COPYING
12 GRUB2_DEPENDENCIES = host-bison host-flex
14 GRUB2_BUILTIN_MODULES = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES))
15 GRUB2_BUILTIN_CONFIG = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_CONFIG))
16 GRUB2_BOOT_PARTITION = $(call qstrip,$(BR2_TARGET_GRUB2_BOOT_PARTITION))
18 ifeq ($(BR2_TARGET_GRUB2_I386_PC),y)
19 GRUB2_IMAGE = $(BINARIES_DIR)/grub.img
20 GRUB2_CFG = $(TARGET_DIR)/boot/grub/grub.cfg
21 GRUB2_PREFIX = ($(GRUB2_BOOT_PARTITION))/boot/grub
22 GRUB2_TUPLE = i386-pc
23 GRUB2_TARGET = i386
24 GRUB2_PLATFORM = pc
25 else ifeq ($(BR2_TARGET_GRUB2_I386_EFI),y)
26 GRUB2_IMAGE = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootia32.efi
27 GRUB2_CFG = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
28 GRUB2_PREFIX = /EFI/BOOT
29 GRUB2_TUPLE = i386-efi
30 GRUB2_TARGET = i386
31 GRUB2_PLATFORM = efi
32 else ifeq ($(BR2_TARGET_GRUB2_X86_64_EFI),y)
33 GRUB2_IMAGE = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootx64.efi
34 GRUB2_CFG = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
35 GRUB2_PREFIX = /EFI/BOOT
36 GRUB2_TUPLE = x86_64-efi
37 GRUB2_TARGET = x86_64
38 GRUB2_PLATFORM = efi
39 endif
41 # Grub2 is kind of special: it considers CC, LD and so on to be the
42 # tools to build the native tools (i.e to be executed on the build
43 # machine), and uses TARGET_CC, TARGET_CFLAGS, TARGET_CPPFLAGS to
44 # build the bootloader itself.
46 GRUB2_CONF_ENV = \
47 $(HOST_CONFIGURE_OPTS) \
48 CPP="$(HOSTCC) -E" \
49 TARGET_CC="$(TARGET_CC)" \
50 TARGET_CFLAGS="$(TARGET_CFLAGS)" \
51 TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)"
53 GRUB2_CONF_OPTS = \
54 --target=$(GRUB2_TARGET) \
55 --with-platform=$(GRUB2_PLATFORM) \
56 --disable-grub-mkfont \
57 --enable-efiemu=no \
58 --enable-liblzma=no \
59 --enable-device-mapper=no \
60 --enable-libzfs=no \
61 --disable-werror
63 # We don't want all the native tools and Grub2 modules to be installed
64 # in the target. So we in fact install everything into the host
65 # directory, and the image generation process (below) will use the
66 # grub-mkimage tool and Grub2 modules from the host directory.
68 GRUB2_INSTALL_TARGET_OPTS = DESTDIR=$(HOST_DIR) install
70 define GRUB2_IMAGE_INSTALLATION
71 mkdir -p $(dir $(GRUB2_IMAGE))
72 $(HOST_DIR)/usr/bin/grub-mkimage \
73 -d $(HOST_DIR)/usr/lib/grub/$(GRUB2_TUPLE) \
74 -O $(GRUB2_TUPLE) \
75 -o $(GRUB2_IMAGE) \
76 -p "$(GRUB2_PREFIX)" \
77 $(if $(GRUB2_BUILTIN_CONFIG),-c $(GRUB2_BUILTIN_CONFIG)) \
78 $(GRUB2_BUILTIN_MODULES)
79 mkdir -p $(dir $(GRUB2_CFG))
80 $(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG)
81 endef
82 GRUB2_POST_INSTALL_TARGET_HOOKS += GRUB2_IMAGE_INSTALLATION
84 ifeq ($(GRUB2_PLATFORM),efi)
85 define GRUB2_EFI_STARTUP_NSH
86 echo $(notdir $(GRUB2_IMAGE)) > \
87 $(BINARIES_DIR)/efi-part/startup.nsh
88 endef
89 GRUB2_POST_INSTALL_TARGET_HOOKS += GRUB2_EFI_STARTUP_NSH
90 endif
92 $(eval $(autotools-package))