]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/grub
grub: Build new version in EFI mode
[ipfire-2.x.git] / lfs / grub
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2018 IPFire Team <info@ipfire.org> #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER = 2.02
28
29 THISAPP = grub-$(VER)
30 DL_FILE = $(THISAPP).tar.xz
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33 TARGET = $(DIR_INFO)/$(THISAPP)
34 SUP_ARCH = x86_64 i586
35
36 # Build for which platforms?
37 BUILD_PC = 1
38 BUILD_EFI = $(EFI)
39
40 DIR_APP_PC = $(DIR_APP)-pc
41 DIR_APP_EFI = $(DIR_APP)-efi
42
43 # Don't use our CFLAGS for boot code
44 export HOST_CFLAGS = $(CFLAGS)
45 export HOST_LDFLAGS = $(LDFLAGS)
46
47 CONFIGURE_ARGS = \
48 --prefix=/usr \
49 --sysconfdir=/etc \
50 --disable-werror
51
52 ###############################################################################
53 # Top-level Rules
54 ###############################################################################
55
56 objects = $(DL_FILE) \
57 unifont-7.0.03.pcf.gz
58
59 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
60 unifont-7.0.03.pcf.gz = $(DL_FROM)/unifont-7.0.03.pcf.gz
61
62 $(DL_FILE)_MD5 = 8a4a2a95aac551fb0fba860ceabfa1d3
63 unifont-7.0.03.pcf.gz_MD5 = f6903ac8c1caeeb30c1e9a2975028401
64
65 install : $(TARGET)
66
67 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
68
69 download :$(patsubst %,$(DIR_DL)/%,$(objects))
70
71 md5 : $(subst %,%_MD5,$(objects))
72
73 ###############################################################################
74 # Downloading, checking, md5sum
75 ###############################################################################
76
77 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
78 @$(CHECK)
79
80 $(patsubst %,$(DIR_DL)/%,$(objects)) :
81 @$(LOAD)
82
83 $(subst %,%_MD5,$(objects)) :
84 @$(MD5)
85
86 ###############################################################################
87 # Installation Details
88 ###############################################################################
89
90 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
91 @$(PREBUILD)
92 @rm -rf $(DIR_APP) $(DIR_APP_EFI) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
93
94 # Install unifont
95 cp -v $(DIR_DL)/unifont-7.0.03.pcf.gz $(DIR_APP)/unifont.pcf.gz
96
97 ifeq "$(BUILD_EFI)" "1"
98 cp -r $(DIR_APP) $(DIR_APP_EFI)
99 cd $(DIR_APP_EFI) && ./configure $(CONFIGURE_ARGS) \
100 --with-platform=efi CFLAGS= LDFLAGS=
101 cd $(DIR_APP_EFI) && make $(MAKETUNING)
102 cd $(DIR_APP_EFI) && make install
103
104 # Install empty configuration file
105 -mkdir -pv /boot/efi/EFI/ipfire/grub-efi
106 touch /boot/efi/EFI/ipfire/grub-efi/grub.cfg
107 endif
108
109 ifeq "$(BUILD_PC)" "1"
110 cp -r $(DIR_APP) $(DIR_APP_PC)
111 cd $(DIR_APP_PC) && ./configure $(CONFIGURE_ARGS) \
112 --with-platform=pc CFLAGS= LDFLAGS=
113 cd $(DIR_APP_PC) && make $(MAKETUNING)
114 cd $(DIR_APP_PC) && make install
115
116 # Install empty configuration file
117 -mkdir -pv /boot/grub
118 touch /boot/grub/grub.cfg
119 endif
120
121 # Install background image
122 install -m 644 $(DIR_SRC)/config/grub2/splash.png /boot/grub/splash.png
123
124 # Install default configuration
125 -mkdir -pv /etc/default
126 install -m 644 $(DIR_SRC)/config/grub2/default /etc/default/grub
127
128 # Disable hardening.
129 paxctl -Cmpes /usr/sbin/grub-bios-setup /usr/sbin/grub-probe
130 paxctl -Cmpexs /usr/bin/grub-script-check
131
132 @rm -rf $(DIR_APP) $(DIR_APP_PC) $(DIR_APP_EFI)
133 @$(POSTBUILD)