Files
bpfire/lfs/cdrom
Michael Tremer c061d66fca cdrom: Change format to XZ and compress in parallel
This allows us to use all processor cores to compress
the image faster.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-10-17 14:58:52 +01:00

121 lines
5.1 KiB
Plaintext

###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007-2013 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
###############################################################################
# Definitions
###############################################################################
include Config
VER = ipfire
THISAPP = cdrom
TARGET = $(DIR_INFO)/$(THISAPP)
ifeq "$(BUILD_PLATFORM)" "arm"
TAR_OPTIONS =
else
TAR_OPTIONS = --xz
endif
# Enable multi-threaded compression for LZMA
export XZ_OPT = --threads=0
###############################################################################
# Top-level Rules
###############################################################################
install : $(TARGET)
check :
download :
md5 :
###############################################################################
# Installation Details
###############################################################################
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
# Update /etc/system-release, because the string might have changed
# since stage2 has been executed..
echo "$(SYSTEM_RELEASE)" > /etc/system-release
rm -rf /install/cdrom /tmp/*
mkdir -p /install/cdrom/doc
# Clear mtab (prevents .journal problems)
rm -vf /etc/mtab
echo > /etc/mtab
# Create filelist for packaging.
BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \
$(DIR_SRC)/src/scripts/archive.files \
$(DIR_SRC)/config/rootfiles/common \
> /tmp/ROOTFILES
# Compress root filesystem
# Reason for this tar+untar+tar is removing of entries listed two or more in src/ROOTFILES
tar -c -C / --files-from=/tmp/ROOTFILES \
-f /$(SNAME).tar --exclude='#*' --exclude='dev/pts/*' \
--exclude='proc/*' --exclude='tmp/ROOTFILES'
rm -f /tmp/ROOTFILES
tar -x -C /tmp -f /$(SNAME).tar
rm -f /$(SNAME).tar
@mkdir /tmp/sys
cd /tmp && tar cf /install/cdrom/distro.img $(TAR_OPTIONS) * && rm -rf *
# Other files
touch /install/cdrom/$(SNAME)-$(VERSION)-core$(CORE).media
sed 's/VERSION/$(VERSION)/' $(DIR_SRC)/config/cdrom/README.txt > /install/cdrom/README.txt
cp $(DIR_SRC)/doc/COPYING /install/cdrom/
cp $(DIR_SRC)/doc/{ChangeLog,packages-list.txt} /install/cdrom/doc
# Make the ISO
mkdir -p /install/cdrom/boot/isolinux
dd if=/dev/zero bs=1k count=2 > /install/cdrom/boot/isolinux/boot.catalog
ifneq "$(BUILD_PLATFORM)" "arm"
cp /boot/vmlinuz-$(KVER)-ipfire /install/cdrom/boot/isolinux/vmlinuz
dracut --force -a "installer" --strip --xz /install/cdrom/boot/isolinux/instroot $(KVER)-ipfire
cp $(DIR_SRC)/config/syslinux/boot.png /install/cdrom/boot/isolinux/boot.png
cp /usr/lib/memtest86+/memtest.bin /install/cdrom/boot/isolinux/memtest
cp /usr/share/ipfire-netboot/ipxe.lkrn /install/cdrom/boot/isolinux/netboot
cp /usr/share/syslinux/isolinux.bin /install/cdrom/boot/isolinux/isolinux.bin
cp /usr/share/hwdata/pci.ids /install/cdrom/boot/isolinux/pci.ids
cp -vf /usr/share/syslinux/*.c32 /install/cdrom/boot/isolinux/
sed -e "s/VERSION/$(VERSION) - Core $(CORE)/g" \
$(DIR_SRC)/config/syslinux/syslinux.cfg \
> /install/cdrom/boot/isolinux/isolinux.cfg
endif
cd /install/cdrom && find -type f ! -name md5sum.txt | grep -v "./boot" | \
xargs md5sum > md5sum.txt
mkdir -p /install/images
ifeq "$(BUILD_PLATFORM)" "arm"
cd /install/cdrom && mkisofs -J -r -V "$(NAME)_$(VERSION)" \
. > /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso
else
cd /install/cdrom && mkisofs -J -r -V "$(NAME)_$(VERSION)" \
-b boot/isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table \
-c boot/isolinux/boot.catalog . > /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso
isohybrid /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso
endif