]> git.ipfire.org Git - ipfire-2.x.git/blame - lfs/grub
Merge branch 'next'
[ipfire-2.x.git] / lfs / grub
CommitLineData
cd1a2927 1###############################################################################
cd1a2927 2# #
70df8302 3# IPFire.org - A linux based firewall #
f8561a5c 4# Copyright (C) 2007-2020 IPFire Team <info@ipfire.org> #
70df8302
MT
5# #
6# This program is free software: you can redistribute it and/or modify #
cd1a2927 7# it under the terms of the GNU General Public License as published by #
70df8302 8# the Free Software Foundation, either version 3 of the License, or #
cd1a2927
MT
9# (at your option) any later version. #
10# #
70df8302 11# This program is distributed in the hope that it will be useful, #
cd1a2927
MT
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 #
70df8302 17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
cd1a2927 18# #
cd1a2927
MT
19###############################################################################
20
21###############################################################################
22# Definitions
23###############################################################################
24
25include Config
26
f8561a5c 27VER = 2.04
cd1a2927
MT
28
29THISAPP = grub-$(VER)
f5bfed65 30DL_FILE = $(THISAPP).tar.xz
c7845ac1 31DL_FROM = $(URL_IPFIRE)
cd1a2927
MT
32DIR_APP = $(DIR_SRC)/$(THISAPP)
33TARGET = $(DIR_INFO)/$(THISAPP)
b62f71f7 34SUP_ARCH = aarch64 x86_64 i586
f5bfed65 35
308af080 36# Build for which platforms?
b62f71f7
MT
37ifeq "$(BUILD_ARCH)" "i586"
38 BUILD_PC = 1
39endif
40
41ifeq "$(BUILD_ARCH)" "x86_64"
42 BUILD_PC = 1
43endif
44
45BUILD_EFI = $(EFI)
784cd5cb 46
308af080
MT
47DIR_APP_PC = $(DIR_APP)-pc
48DIR_APP_EFI = $(DIR_APP)-efi
7fbbd2ae 49
308af080
MT
50# Don't use our CFLAGS for boot code
51export HOST_CFLAGS = $(CFLAGS)
52export HOST_LDFLAGS = $(LDFLAGS)
cd1a2927 53
784cd5cb
MT
54CONFIGURE_ARGS = \
55 --prefix=/usr \
56 --sysconfdir=/etc \
308af080 57 --disable-werror
784cd5cb 58
cd1a2927
MT
59###############################################################################
60# Top-level Rules
61###############################################################################
62
ed8977a1
SS
63objects = $(DL_FILE) \
64 unifont-7.0.03.pcf.gz
cd1a2927
MT
65
66$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
ed8977a1 67unifont-7.0.03.pcf.gz = $(DL_FROM)/unifont-7.0.03.pcf.gz
cd1a2927 68
f8561a5c 69$(DL_FILE)_MD5 = 5aaca6713b47ca2456d8324a58755ac7
ed8977a1 70unifont-7.0.03.pcf.gz_MD5 = f6903ac8c1caeeb30c1e9a2975028401
cd1a2927
MT
71
72install : $(TARGET)
73
74check : $(patsubst %,$(DIR_CHK)/%,$(objects))
75
76download :$(patsubst %,$(DIR_DL)/%,$(objects))
77
78md5 : $(subst %,%_MD5,$(objects))
79
80###############################################################################
81# Downloading, checking, md5sum
82###############################################################################
83
84$(patsubst %,$(DIR_CHK)/%,$(objects)) :
85 @$(CHECK)
86
87$(patsubst %,$(DIR_DL)/%,$(objects)) :
88 @$(LOAD)
89
90$(subst %,%_MD5,$(objects)) :
91 @$(MD5)
92
93###############################################################################
94# Installation Details
95###############################################################################
96
97$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
98 @$(PREBUILD)
784cd5cb 99 @rm -rf $(DIR_APP) $(DIR_APP_EFI) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
784cd5cb 100
f8561a5c 101 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub/grub-2.04-BootHole.patch
5dd9140a 102 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-2.02_disable_vga_fallback.patch
9b346558 103 cd $(DIR_APP) && autoreconf -vfi
5dd9140a 104
308af080
MT
105 # Install unifont
106 cp -v $(DIR_DL)/unifont-7.0.03.pcf.gz $(DIR_APP)/unifont.pcf.gz
784cd5cb 107
308af080
MT
108ifeq "$(BUILD_EFI)" "1"
109 cp -r $(DIR_APP) $(DIR_APP_EFI)
110 cd $(DIR_APP_EFI) && ./configure $(CONFIGURE_ARGS) \
111 --with-platform=efi CFLAGS= LDFLAGS=
112 cd $(DIR_APP_EFI) && make $(MAKETUNING)
784cd5cb 113 cd $(DIR_APP_EFI) && make install
784cd5cb
MT
114endif
115
308af080
MT
116ifeq "$(BUILD_PC)" "1"
117 cp -r $(DIR_APP) $(DIR_APP_PC)
118 cd $(DIR_APP_PC) && ./configure $(CONFIGURE_ARGS) \
452d2b6e 119 --with-platform=pc --disable-efiemu CFLAGS= LDFLAGS=
308af080
MT
120 cd $(DIR_APP_PC) && make $(MAKETUNING)
121 cd $(DIR_APP_PC) && make install
cd1a2927 122
308af080 123 # Install empty configuration file
f5bfed65
MT
124 -mkdir -pv /boot/grub
125 touch /boot/grub/grub.cfg
308af080
MT
126endif
127
128 # Install background image
b62f71f7 129 -mkdir -pv /boot/grub
3ef5dd98 130 install -m 644 $(DIR_SRC)/config/grub2/splash.png /boot/grub/splash.png
cd1a2927 131
308af080 132 # Install default configuration
f5bfed65
MT
133 -mkdir -pv /etc/default
134 install -m 644 $(DIR_SRC)/config/grub2/default /etc/default/grub
10af520f 135
308af080 136 @rm -rf $(DIR_APP) $(DIR_APP_PC) $(DIR_APP_EFI)
cd1a2927 137 @$(POSTBUILD)