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