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