1 ###############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2018 IPFire Team <info@ipfire.org> #
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. #
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. #
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/>. #
19 ###############################################################################
21 ###############################################################################
23 ###############################################################################
30 TARGET = $(DIR_INFO)/$(THISAPP)
32 ifeq "$(BUILD_PLATFORM)" "arm"
43 ifeq "$(BUILD_PLATFORM)" "x86"
49 ifeq "$(BUILD_ARCH)" "armv5tel"
54 -A "$(NAME) $(VERSION) $(BUILD_ARCH)" \
55 -V "$(NAME) $(VERSION) $(BUILD_ARCH)"
59 ifeq "$(HAS_ISOLINUX)" "1"
64 -b boot/isolinux/isolinux.bin \
65 -c boot/isolinux/boot.catalog
71 -e boot/isolinux/efiboot.img \
74 ISOHYBRID_ARGS += --uefi
129 ###############################################################################
131 ###############################################################################
141 ###############################################################################
142 # Installation Details
143 ###############################################################################
145 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
146 # Update /etc/system-release, because the string might have changed
147 # since stage2 has been executed..
148 echo "$(SYSTEM_RELEASE)" > /etc/system-release
150 rm -rf /install/cdrom /tmp/*
151 mkdir -p /install/cdrom/doc
153 # Clear mtab (prevents .journal problems)
157 # Create filelist for packaging.
158 BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \
159 $(DIR_SRC)/src/scripts/archive.files \
160 $(DIR_SRC)/config/rootfiles/common \
163 # Compress root filesystem
164 # Reason for this tar+untar+tar is removing of entries listed two or more in src/ROOTFILES
165 tar -c --exclude='#*' --exclude='proc/*' --exclude='dev/pts/*' --exclude='tmp/ROOTFILES' \
166 -C / --files-from=/tmp/ROOTFILES -f /$(SNAME).tar
168 tar -x -C /tmp -f /$(SNAME).tar
171 cd /tmp && tar cf - * | xz $(XZ_OPT) > /install/cdrom/distro.img && rm -rf *
174 touch /install/cdrom/$(SNAME)-$(VERSION)-core$(CORE).media
175 sed 's/VERSION/$(VERSION)/' $(DIR_SRC)/config/cdrom/README.txt > /install/cdrom/README.txt
176 cp $(DIR_SRC)/doc/COPYING /install/cdrom/
177 cp $(DIR_SRC)/doc/{ChangeLog,packages-list.txt} /install/cdrom/doc
179 mkdir -p /install/cdrom/boot/isolinux
181 ifeq "$(HAS_KERNEL)" "1"
182 cp /boot/vmlinuz-$(KVER)-ipfire /install/cdrom/boot/isolinux/vmlinuz
183 dracut --force --early-microcode -a "installer" --strip --xz /install/cdrom/boot/isolinux/instroot $(KVER)-ipfire
186 ifeq "$(HAS_ISOLINUX)" "1"
187 dd if=/dev/zero bs=1k count=2 > /install/cdrom/boot/isolinux/boot.catalog
188 cp $(DIR_SRC)/config/syslinux/boot.png /install/cdrom/boot/isolinux/boot.png
189 cp /usr/share/syslinux/isolinux.bin /install/cdrom/boot/isolinux/isolinux.bin
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
197 ifeq "$(HAS_MEMTEST)" "1"
199 cp /usr/lib/memtest86+/memtest.bin /install/cdrom/boot/isolinux/memtest
202 ifeq "$(HAS_IPXE)" "1"
203 cp /usr/share/ipfire-netboot/ipxe.lkrn /install/cdrom/boot/isolinux/netboot
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
211 # Build a GRUB EFI image
212 mkdir -pv /install/cdrom/EFI/BOOT
214 --format=$(GRUB_ARCH)-efi \
215 --output=/install/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
216 --config=/tmp/grub-efi.cfg \
219 $$(for mod in $(GRUB_EFI_MODULES); do [ -f "/usr/lib/grub/$(GRUB_ARCH)-efi/$${mod}.mod" ] && echo "$${mod}"; done)
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
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
230 # Mount the EFI image
231 mkdir -pv /install/efiboot.img
232 mount -o loop /install/cdrom/boot/isolinux/efiboot.img /install/efiboot.img
234 # Copy the bootloader into the image
235 mkdir -pv /install/efiboot.img/EFI/BOOT
236 cp -a /install/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
237 /install/efiboot.img/EFI/BOOT/boot$(EFI_ARCH).efi
240 umount /install/efiboot.img
241 rm -rf /install/efiboot.img /tmp/grub-efi.cfg
244 cd /install/cdrom && find -type f ! -name md5sum.txt | grep -v "./boot" | \
245 xargs md5sum > md5sum.txt
247 mkdir -p /install/images
248 cd /install/cdrom && mkisofs $(ISO_ARGS) \
249 -o /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso .
251 ifeq "$(HAS_ISOLINUX)" "1"
252 isohybrid $(ISOHYBRID_ARGS) /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso