]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - lfs/cdrom
cdrom: Install memtest only on x86
[people/pmueller/ipfire-2.x.git] / lfs / cdrom
CommitLineData
cd1a2927 1###############################################################################
cd1a2927 2# #
70df8302 3# IPFire.org - A linux based firewall #
fab611b3 4# Copyright (C) 2007-2013 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
38ISO_ARGS = -J -r -v \
5765b49b
MT
39 -A "$(NAME) $(VERSION) $(BUILD_ARCH)" \
40 -V "$(NAME) $(VERSION) $(BUILD_ARCH)" \
5f52a956
MT
41 -no-emul-boot \
42 -boot-load-size 4 \
43 -boot-info-table \
44 -b boot/isolinux/isolinux.bin \
45 -c boot/isolinux/boot.catalog
46
7b4323c6 47# Only build a stub ISO for ARM
f096a2ea 48ifeq "$(BUILD_ARCH)" "armv5tel"
5765b49b 49 ISO_ARGS = -J -r -V "$(NAME) $(VERSION) $(BUILD_ARCH)"
f4330e19 50endif
7b4323c6
MT
51
52ISOHYBRID_ARGS =
53
5f52a956
MT
54ifeq "$(EFI)" "1"
55 ISO_ARGS += \
56 -eltorito-alt-boot \
57 -e boot/isolinux/efiboot.img
7b4323c6
MT
58
59 ISOHYBRID_ARGS += --uefi
5f52a956
MT
60endif
61
b7407cca
MT
62HAS_MEMTEST = 0
63
64ifeq "$(BUILD_PLATFORM)" "x86"
65 HAS_MEMTEST = 1
66endif
67
cd1a2927
MT
68###############################################################################
69# Top-level Rules
70###############################################################################
71
cd1a2927
MT
72install : $(TARGET)
73
fd0763dc 74check :
cd1a2927 75
fd0763dc 76download :
cd1a2927 77
fd0763dc 78md5 :
cd1a2927
MT
79
80###############################################################################
81# Installation Details
82###############################################################################
83
84$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
42e4fa80
MT
85 # Update /etc/system-release, because the string might have changed
86 # since stage2 has been executed..
87 echo "$(SYSTEM_RELEASE)" > /etc/system-release
88
cd1a2927 89 rm -rf /install/cdrom /tmp/*
1b453c76 90 mkdir -p /install/cdrom/doc
cd1a2927 91
1b453c76
MT
92 # Clear mtab (prevents .journal problems)
93 rm -vf /etc/mtab
9df6d70f
AF
94 echo > /etc/mtab
95
1b453c76 96 # Create filelist for packaging.
dc7d6b20 97 BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \
1b453c76
MT
98 $(DIR_SRC)/src/scripts/archive.files \
99 $(DIR_SRC)/config/rootfiles/common \
100 > /tmp/ROOTFILES
101
cd1a2927
MT
102 # Compress root filesystem
103 # Reason for this tar+untar+tar is removing of entries listed two or more in src/ROOTFILES
c2297690
MF
104 tar -c --exclude='#*' --exclude='proc/*' --exclude='dev/pts/*' --exclude='tmp/ROOTFILES' \
105 -C / --files-from=/tmp/ROOTFILES -f /$(SNAME).tar
50f96334 106 rm -f /tmp/ROOTFILES
cd1a2927
MT
107 tar -x -C /tmp -f /$(SNAME).tar
108 rm -f /$(SNAME).tar
069680ac 109 @mkdir /tmp/sys
0054a52b 110 cd /tmp && tar cf - * | xz $(XZ_OPT) > /install/cdrom/distro.img && rm -rf *
03ad5f93 111
cd1a2927 112 # Other files
fab611b3 113 touch /install/cdrom/$(SNAME)-$(VERSION)-core$(CORE).media
03ad5f93 114 sed 's/VERSION/$(VERSION)/' $(DIR_SRC)/config/cdrom/README.txt > /install/cdrom/README.txt
f8031af5
MT
115 cp $(DIR_SRC)/doc/COPYING /install/cdrom/
116 cp $(DIR_SRC)/doc/{ChangeLog,packages-list.txt} /install/cdrom/doc
cd1a2927 117
0afc6d83 118 # Make the ISO
1b453c76
MT
119 mkdir -p /install/cdrom/boot/isolinux
120 dd if=/dev/zero bs=1k count=2 > /install/cdrom/boot/isolinux/boot.catalog
f096a2ea 121ifneq "$(BUILD_ARCH)" "armv5tel"
bc8fe5ff 122 cp /boot/vmlinuz-$(KVER)-ipfire /install/cdrom/boot/isolinux/vmlinuz
3ed1c621 123 dracut --force -a "installer" --strip --xz /install/cdrom/boot/isolinux/instroot $(KVER)-ipfire
df2ac655 124 cp $(DIR_SRC)/config/syslinux/boot.png /install/cdrom/boot/isolinux/boot.png
89fd5ae0 125 cp /usr/share/ipfire-netboot/ipxe.lkrn /install/cdrom/boot/isolinux/netboot
1b453c76 126 cp /usr/share/syslinux/isolinux.bin /install/cdrom/boot/isolinux/isolinux.bin
5f387a1b 127
b7407cca
MT
128ifeq "$(HAS_MEMTEST)" "1"
129 # Install memtest
130 cp /usr/lib/memtest86+/memtest.bin /install/cdrom/boot/isolinux/memtest
131endif
132
5f52a956 133ifeq "$(EFI)" "1"
5765b49b
MT
134 # Generate embedded GRUB configuration
135 sed -e "s/NAME/$(NAME)/g" -e "s/VERSION/$(VERSION)/g" -e "s/ARCH/$(BUILD_ARCH)/g" \
136 $(DIR_SRC)/config/cdrom/grub-efi.cfg > /tmp/grub-efi.cfg
137
5f387a1b 138 # Build a GRUB EFI image
6b44fee7 139 mkdir -pv /install/cdrom/EFI/BOOT
5f387a1b
MT
140 grub-mkimage \
141 --format=$(BUILD_ARCH)-efi \
6b44fee7 142 --output=/install/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
5765b49b 143 --config=/tmp/grub-efi.cfg \
5f387a1b
MT
144 --compression=xz \
145 --prefix=/EFI/BOOT \
146 $(GRUB_EFI_MODULES)
147
6b44fee7
MT
148 # Install GRUB configuration
149 mkdir -pv /install/cdrom/EFI/BOOT
150 sed -e "s/NAME/$(NAME)/g" -e "s/VERSION/$(VERSION)/g" -e "s/ARCH/$(BUILD_ARCH)/g" \
151 < $(DIR_SRC)/config/cdrom/grub.cfg > /install/cdrom/EFI/BOOT/grub.cfg
152
153 # Create the EFI Eltorito image
154 dd if=/dev/zero of=/install/cdrom/boot/isolinux/efiboot.img bs=1k count=1440
155 mkdosfs -F 12 -n "IPFIRE_EFI" /install/cdrom/boot/isolinux/efiboot.img
156
5f387a1b
MT
157 # Mount the EFI image
158 mkdir -pv /install/efiboot.img
159 mount -o loop /install/cdrom/boot/isolinux/efiboot.img /install/efiboot.img
160
161 # Copy the bootloader into the image
162 mkdir -pv /install/efiboot.img/EFI/BOOT
6b44fee7
MT
163 cp -a /install/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
164 /install/efiboot.img/EFI/BOOT/boot$(EFI_ARCH).efi
5f387a1b
MT
165
166 # Cleanup
167 umount /install/efiboot.img
6b44fee7 168 rm -rf /install/efiboot.img /tmp/grub-efi.cfg
5f52a956 169endif
5f387a1b 170
df2ac655
MT
171 cp /usr/share/hwdata/pci.ids /install/cdrom/boot/isolinux/pci.ids
172 cp -vf /usr/share/syslinux/*.c32 /install/cdrom/boot/isolinux/
173 sed -e "s/VERSION/$(VERSION) - Core $(CORE)/g" \
174 $(DIR_SRC)/config/syslinux/syslinux.cfg \
175 > /install/cdrom/boot/isolinux/isolinux.cfg
1b453c76 176endif
d7bf4fe7 177 cd /install/cdrom && find -type f ! -name md5sum.txt | grep -v "./boot" | \
1b453c76
MT
178 xargs md5sum > md5sum.txt
179
bc8fe5ff 180 mkdir -p /install/images
5f52a956
MT
181 cd /install/cdrom && mkisofs $(ISO_ARGS) \
182 -o /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso .
183
7b4323c6 184 isohybrid $(ISOHYBRID_ARGS) /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso