skalibs: fix endianness detection on x86
[buildroot-gz.git] / boot / grub / grub.mk
blobae687d6b183860a52a8d6f1f16dfaab88849d50b
1 ################################################################################
3 # grub
5 ################################################################################
7 GRUB_VERSION = 0.97
8 GRUB_SOURCE = grub_$(GRUB_VERSION).orig.tar.gz
9 GRUB_PATCH = grub_$(GRUB_VERSION)-68.diff.gz
10 GRUB_SITE = http://snapshot.debian.org/archive/debian/20141023T043132Z/pool/main/g/grub
12 GRUB_LICENSE = GPLv2+
13 GRUB_LICENSE_FILES = COPYING
15 # Passing -O0 since the default -O2 passed by Buildroot generates
16 # non-working stage2. Passing --build-id=none to the linker, because
17 # the ".note.gnu.build-id" ELF sections generated by default confuse
18 # objcopy when generating raw binaries. Passing -fno-stack-protector
19 # to avoid undefined references to __stack_chk_fail.
20 GRUB_CFLAGS = \
21 -DSUPPORT_LOOPDEV \
22 -O0 -Wl,--build-id=none \
23 -fno-stack-protector
25 GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_SPLASH),--enable-graphics,--disable-graphics)
27 GRUB_CONFIG-$(BR2_TARGET_GRUB_DISKLESS) += --enable-diskless
28 GRUB_CONFIG-$(BR2_TARGET_GRUB_3c595) += --enable-3c595
29 GRUB_CONFIG-$(BR2_TARGET_GRUB_3c90x) += --enable-3c90x
30 GRUB_CONFIG-$(BR2_TARGET_GRUB_davicom) += --enable-davicom
31 GRUB_CONFIG-$(BR2_TARGET_GRUB_e1000) += --enable-e1000
32 GRUB_CONFIG-$(BR2_TARGET_GRUB_eepro100) += --enable-eepro100
33 GRUB_CONFIG-$(BR2_TARGET_GRUB_epic100) += --enable-epic100
34 GRUB_CONFIG-$(BR2_TARGET_GRUB_forcedeth) += --enable-forcedeth
35 GRUB_CONFIG-$(BR2_TARGET_GRUB_natsemi) += --enable-natsemi
36 GRUB_CONFIG-$(BR2_TARGET_GRUB_ns83820) += --enable-ns83820
37 GRUB_CONFIG-$(BR2_TARGET_GRUB_ns8390) += --enable-ns8390
38 GRUB_CONFIG-$(BR2_TARGET_GRUB_pcnet32) += --enable-pcnet32
39 GRUB_CONFIG-$(BR2_TARGET_GRUB_pnic) += --enable-pnic
40 GRUB_CONFIG-$(BR2_TARGET_GRUB_rtl8139) += --enable-rtl8139
41 GRUB_CONFIG-$(BR2_TARGET_GRUB_r8169) += --enable-r8169
42 GRUB_CONFIG-$(BR2_TARGET_GRUB_sis900) += --enable-sis900
43 GRUB_CONFIG-$(BR2_TARGET_GRUB_tg3) += --enable-tg3
44 GRUB_CONFIG-$(BR2_TARGET_GRUB_tulip) += --enable-tulip
45 GRUB_CONFIG-$(BR2_TARGET_GRUB_tlan) += --enable-tlan
46 GRUB_CONFIG-$(BR2_TARGET_GRUB_undi) += --enable-undi
47 GRUB_CONFIG-$(BR2_TARGET_GRUB_via_rhine) += --enable-via-rhine
48 GRUB_CONFIG-$(BR2_TARGET_GRUB_w89c840) += --enable-w89c840
50 GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_EXT2),--enable-ext2fs,--disable-ext2fs)
51 GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_FAT),--enable-fat,--disable-fat)
52 GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_ISO9660),--enable-iso9660,--disable-iso9660)
53 GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_JFS),--enable-jfs,--disable-jfs)
54 GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_REISERFS),--enable-reiserfs,--disable-reiserfs)
55 GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_XFS),--enable-xfs,--disable-xfs)
56 GRUB_CONFIG-y += --disable-ffs --disable-ufs2 --disable-minix --disable-vstafs
58 GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_EXT2),e2fs)
59 GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_FAT),fat)
60 GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_ISO9660),iso9660)
61 GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_JFS),jfs)
62 GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_REISERFS),reiserfs)
63 GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_XFS),xfs)
65 define GRUB_DEBIAN_PATCHES
66 # Apply the patches from the Debian patch
67 (cd $(@D) ; for f in `cat debian/patches/series | grep -v ^#` ; do \
68 cat debian/patches/$$f | patch -g0 -p1 ; \
69 done)
70 endef
72 GRUB_POST_PATCH_HOOKS += GRUB_DEBIAN_PATCHES
74 GRUB_CONF_ENV = \
75 $(HOST_CONFIGURE_OPTS) \
76 CFLAGS="$(HOST_CFLAGS) $(GRUB_CFLAGS) -m32"
78 GRUB_CONF_OPTS = \
79 --disable-auto-linux-mem-opt \
80 $(GRUB_CONFIG-y)
82 ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
83 define GRUB_INSTALL_SPLASH
84 $(INSTALL) -D -m 0644 boot/grub/splash.xpm.gz $(TARGET_DIR)/boot/grub/splash.xpm.gz
85 endef
86 else
87 define GRUB_INSTALL_SPLASH
88 $(SED) '/^splashimage/d' $(TARGET_DIR)/boot/grub/menu.lst
89 endef
90 endif
92 # We're cheating here as we're installing the grub binary not in the
93 # target directory (where it is useless), but in the host
94 # directory. This grub binary can be used to install grub into the MBR
95 # of a disk or disk image.
97 define GRUB_INSTALL_TARGET_CMDS
98 $(INSTALL) -D -m 0755 $(@D)/grub/grub $(HOST_DIR)/sbin/grub
99 $(INSTALL) -D -m 0755 $(@D)/stage1/stage1 $(TARGET_DIR)/boot/grub/stage1
100 for f in $(GRUB_STAGE_1_5_TO_INSTALL) ; do \
101 $(INSTALL) -D -m 0755 $(@D)/stage2/$${f}_stage1_5 \
102 $(TARGET_DIR)/boot/grub/$${f}_stage1_5 ; \
103 done
104 $(INSTALL) -D -m 0644 $(@D)/stage2/stage2 $(TARGET_DIR)/boot/grub/stage2
105 $(INSTALL) -D -m 0644 boot/grub/menu.lst $(TARGET_DIR)/boot/grub/menu.lst
106 $(GRUB_INSTALL_SPLASH)
107 endef
109 $(eval $(autotools-package))