]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - lfs/cdrom
OpenVPN: Update to version 2.5.0
[people/pmueller/ipfire-2.x.git] / lfs / cdrom
CommitLineData
cd1a2927 1###############################################################################
cd1a2927 2# #
70df8302 3# IPFire.org - A linux based firewall #
eee037b8 4# Copyright (C) 2007-2018 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
0fbb45e9
MT
27VER = ipfire
28
cd1a2927 29THISAPP = cdrom
cd1a2927
MT
30TARGET = $(DIR_INFO)/$(THISAPP)
31
cd8ee302
MT
32# Fail when there is an error in the tar pipe
33SHELL=/bin/bash -o pipefail
34
ba3cbb0c 35ifeq "$(BUILD_PLATFORM)" "arm"
5f52a956
MT
36 TAR_OPTIONS =
37else
38 TAR_OPTIONS = --lzma
39endif
40
4790db5f
MT
41HAS_MEMTEST = 0
42HAS_IPXE = 0
43HAS_ISOLINUX = 0
44HAS_KERNEL = 1
45
46ifeq "$(BUILD_PLATFORM)" "x86"
47 HAS_MEMTEST = 1
48 HAS_IPXE = 1
49 HAS_ISOLINUX = 1
50endif
51
f096a2ea 52ifeq "$(BUILD_ARCH)" "armv5tel"
4790db5f 53 HAS_KERNEL = 0
f4330e19 54endif
7b4323c6 55
4790db5f
MT
56ISO_ARGS = -J -r -v \
57 -A "$(NAME) $(VERSION) $(BUILD_ARCH)" \
58 -V "$(NAME) $(VERSION) $(BUILD_ARCH)"
59
7b4323c6
MT
60ISOHYBRID_ARGS =
61
4790db5f
MT
62ifeq "$(HAS_ISOLINUX)" "1"
63 ISO_ARGS += \
64 -no-emul-boot \
65 -boot-load-size 4 \
66 -boot-info-table \
67 -b boot/isolinux/isolinux.bin \
68 -c boot/isolinux/boot.catalog
b7407cca
MT
69endif
70
3deac294
MT
71ifeq "$(EFI)" "1"
72 ISO_ARGS += \
0efda7ac 73 -eltorito-alt-boot \
5d657243 74 -e boot/isolinux/efiboot.img \
0efda7ac 75 -no-emul-boot
3deac294
MT
76
77 ISOHYBRID_ARGS += --uefi
78endif
79
de7c8df8
MT
80GRUB_EFI_MODULES = \
81 all_video \
82 at_keyboard \
83 boot \
84 bitmap_scale \
85 cat \
86 chain \
87 configfile \
88 disk \
89 echo \
90 efi_gop \
91 efi_uga \
92 ext2 \
93 extcmd \
94 fat \
95 file \
96 font \
97 fxterm_menu \
98 gfxterm \
99 gfxmenu \
100 gfxterm_background \
101 gzio \
102 halt \
103 help \
104 iso9660 \
105 jpeg \
106 loadbios \
107 loadenv \
108 loopback \
109 linux \
110 ls \
111 memdisk \
112 minicmd \
113 nativedisk \
114 normal \
115 ntfs \
116 part_gpt \
117 part_msdos \
118 png \
119 probe \
120 reboot \
121 regexp \
122 search \
123 search_fs_file \
124 search_fs_uuid \
125 search_label \
126 tar \
127 test \
128 tga \
129 true \
130 usb_keyboard
131
cd1a2927
MT
132###############################################################################
133# Top-level Rules
134###############################################################################
135
cd1a2927
MT
136install : $(TARGET)
137
fd0763dc 138check :
cd1a2927 139
fd0763dc 140download :
cd1a2927 141
fd0763dc 142md5 :
cd1a2927
MT
143
144###############################################################################
145# Installation Details
146###############################################################################
147
148$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
42e4fa80
MT
149 # Update /etc/system-release, because the string might have changed
150 # since stage2 has been executed..
151 echo "$(SYSTEM_RELEASE)" > /etc/system-release
152
7c62b3a5
MT
153 # Create a directory to authorise the CDROM in
154 rm -rf $(DIR_TMP)/cdrom && mkdir -p $(DIR_TMP)/cdrom
cd1a2927 155
1b453c76
MT
156 # Clear mtab (prevents .journal problems)
157 rm -vf /etc/mtab
9df6d70f
AF
158 echo > /etc/mtab
159
1b453c76 160 # Create filelist for packaging.
dc7d6b20 161 BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \
1b453c76
MT
162 $(DIR_SRC)/src/scripts/archive.files \
163 $(DIR_SRC)/config/rootfiles/common \
cd8ee302 164 > $(DIR_TMP)/ROOTFILES
1b453c76 165
cd1a2927
MT
166 # Compress root filesystem
167 # Reason for this tar+untar+tar is removing of entries listed two or more in src/ROOTFILES
cd8ee302
MT
168 rm -rf $(DIR_TMP)/root && mkdir -p $(DIR_TMP)/root
169 tar -c --exclude='#*' --exclude='proc/*' --exclude='dev/pts/*' --exclude='tmp/*' \
170 --exclude='__pycache__' \
171 -C / --files-from=$(DIR_TMP)/ROOTFILES | tar -x -C $(DIR_TMP)/root
172 rm -f $(DIR_TMP)/ROOTFILES
173 mkdir $(DIR_TMP)/root/sys
7c62b3a5 174 cd $(DIR_TMP)/root && tar cf - * | xz $(XZ_OPT) > $(DIR_TMP)/cdrom/distro.img
cd8ee302 175 rm -rf $(DIR_TMP)/root
03ad5f93 176
cd1a2927 177 # Other files
7c62b3a5
MT
178 touch $(DIR_TMP)/cdrom/$(SNAME)-$(VERSION)-core$(CORE).media
179 sed 's/VERSION/$(VERSION)/' $(DIR_SRC)/config/cdrom/README.txt > $(DIR_TMP)/cdrom/README.txt
180 cp $(DIR_SRC)/doc/COPYING $(DIR_TMP)/cdrom/
cd1a2927 181
7c62b3a5
MT
182 # Install documentation
183 -mkdir -pv $(DIR_TMP)/cdrom/doc
184 cp $(DIR_SRC)/doc/{ChangeLog,packages-list.txt} $(DIR_TMP)/cdrom/doc
185
186 mkdir -p $(DIR_TMP)/cdrom/boot/isolinux
4790db5f
MT
187
188ifeq "$(HAS_KERNEL)" "1"
7c62b3a5
MT
189 cp /boot/vmlinuz-$(KVER)-ipfire $(DIR_TMP)/cdrom/boot/isolinux/vmlinuz
190 dracut --force --early-microcode -a "installer" --strip --xz $(DIR_TMP)/cdrom/boot/isolinux/instroot $(KVER)-ipfire
4790db5f
MT
191endif
192
193ifeq "$(HAS_ISOLINUX)" "1"
7c62b3a5
MT
194 dd if=/dev/zero bs=1k count=2 > $(DIR_TMP)/cdrom/boot/isolinux/boot.catalog
195 cp $(DIR_SRC)/config/syslinux/boot.png $(DIR_TMP)/cdrom/boot/isolinux/boot.png
196 cp /usr/share/syslinux/isolinux.bin $(DIR_TMP)/cdrom/boot/isolinux/isolinux.bin
197 cp /usr/share/hwdata/pci.ids $(DIR_TMP)/cdrom/boot/isolinux/pci.ids
198 cp -vf /usr/share/syslinux/*.c32 $(DIR_TMP)/cdrom/boot/isolinux/
df2ac655
MT
199 sed -e "s/VERSION/$(VERSION) - Core $(CORE)/g" \
200 $(DIR_SRC)/config/syslinux/syslinux.cfg \
7c62b3a5 201 > $(DIR_TMP)/cdrom/boot/isolinux/isolinux.cfg
1b453c76 202endif
5f387a1b 203
b7407cca
MT
204ifeq "$(HAS_MEMTEST)" "1"
205 # Install memtest
7c62b3a5 206 cp /usr/lib/memtest86+/memtest.bin $(DIR_TMP)/cdrom/boot/isolinux/memtest
b7407cca
MT
207endif
208
0ce1e490 209ifeq "$(HAS_IPXE)" "1"
7c62b3a5 210 cp /usr/share/ipfire-netboot/ipxe.lkrn $(DIR_TMP)/cdrom/boot/isolinux/netboot
0ce1e490
MT
211endif
212
5f52a956 213ifeq "$(EFI)" "1"
5765b49b
MT
214 # Generate embedded GRUB configuration
215 sed -e "s/NAME/$(NAME)/g" -e "s/VERSION/$(VERSION)/g" -e "s/ARCH/$(BUILD_ARCH)/g" \
216 $(DIR_SRC)/config/cdrom/grub-efi.cfg > /tmp/grub-efi.cfg
217
5f387a1b 218 # Build a GRUB EFI image
7c62b3a5 219 mkdir -pv $(DIR_TMP)/cdrom/EFI/BOOT
5f387a1b 220 grub-mkimage \
a1eb7761 221 --format=$(GRUB_ARCH)-efi \
7c62b3a5
MT
222 --output=$(DIR_TMP)/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
223 --config=$(DIR_TMP)/grub-efi.cfg \
5f387a1b
MT
224 --compression=xz \
225 --prefix=/EFI/BOOT \
de7c8df8 226 $$(for mod in $(GRUB_EFI_MODULES); do [ -f "/usr/lib/grub/$(GRUB_ARCH)-efi/$${mod}.mod" ] && echo "$${mod}"; done)
5f387a1b 227
6b44fee7 228 # Install GRUB configuration
7c62b3a5 229 mkdir -pv $(DIR_TMP)/cdrom/EFI/BOOT
6b44fee7 230 sed -e "s/NAME/$(NAME)/g" -e "s/VERSION/$(VERSION)/g" -e "s/ARCH/$(BUILD_ARCH)/g" \
7c62b3a5 231 < $(DIR_SRC)/config/cdrom/grub.cfg > $(DIR_TMP)/cdrom/EFI/BOOT/grub.cfg
6b44fee7
MT
232
233 # Create the EFI Eltorito image
7c62b3a5
MT
234 dd if=/dev/zero of=$(DIR_TMP)/cdrom/boot/isolinux/efiboot.img bs=1k count=1440
235 mkdosfs -F 12 -n "IPFIRE_EFI" $(DIR_TMP)/cdrom/boot/isolinux/efiboot.img
6b44fee7 236
5f387a1b 237 # Mount the EFI image
7c62b3a5
MT
238 mkdir -pv $(DIR_TMP)/efiboot.img
239 mount -o loop $(DIR_TMP)/cdrom/boot/isolinux/efiboot.img $(DIR_TMP)/efiboot.img
5f387a1b
MT
240
241 # Copy the bootloader into the image
7c62b3a5
MT
242 mkdir -p $(DIR_TMP)/efiboot.img/EFI/BOOT
243 cp -a $(DIR_TMP)/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
244 $(DIR_TMP)/efiboot.img/EFI/BOOT/boot$(EFI_ARCH).efi
5f387a1b
MT
245
246 # Cleanup
7c62b3a5
MT
247 umount $(DIR_TMP)/efiboot.img
248 rm -rf $(DIR_TMP)/efiboot.img $(DIR_TMP)/grub-efi.cfg
5f52a956 249endif
5f387a1b 250
7c62b3a5 251 cd $(DIR_TMP)/cdrom && find -type f ! -name md5sum.txt | grep -v "./boot" | \
1b453c76
MT
252 xargs md5sum > md5sum.txt
253
bc8fe5ff 254 mkdir -p /install/images
7c62b3a5 255 cd $(DIR_TMP)/cdrom && mkisofs $(ISO_ARGS) \
5f52a956
MT
256 -o /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso .
257
092bc105 258ifeq "$(HAS_ISOLINUX)" "1"
7b4323c6 259 isohybrid $(ISOHYBRID_ARGS) /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso
1b453c76 260endif