]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/cdrom
Merge branch 'next' into efi
[ipfire-2.x.git] / lfs / cdrom
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2013 IPFire Team <info@ipfire.org> #
5 # #
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. #
10 # #
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. #
15 # #
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/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER = ipfire
28
29 THISAPP = cdrom
30 TARGET = $(DIR_INFO)/$(THISAPP)
31
32 ifeq "$(BUILD_PLATFORM)" "arm"
33 TAR_OPTIONS =
34 else
35 TAR_OPTIONS = --lzma
36 endif
37
38 HAS_MEMTEST = 0
39 HAS_IPXE = 0
40 HAS_ISOLINUX = 0
41 HAS_KERNEL = 1
42
43 ifeq "$(BUILD_PLATFORM)" "x86"
44 HAS_MEMTEST = 1
45 HAS_IPXE = 1
46 HAS_ISOLINUX = 1
47 endif
48
49 ifeq "$(BUILD_ARCH)" "armv5tel"
50 HAS_KERNEL = 0
51 endif
52
53 ISO_ARGS = -J -r -v \
54 -A "$(NAME) $(VERSION) $(BUILD_ARCH)" \
55 -V "$(NAME) $(VERSION) $(BUILD_ARCH)"
56
57 ISOHYBRID_ARGS =
58
59 ifeq "$(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
66 endif
67
68 ifeq "$(EFI)" "1"
69 ISO_ARGS += \
70 -eltorito-alt-boot \
71 -e boot/isolinux/efiboot.img
72
73 ISOHYBRID_ARGS += --uefi
74 endif
75
76 ###############################################################################
77 # Top-level Rules
78 ###############################################################################
79
80 install : $(TARGET)
81
82 check :
83
84 download :
85
86 md5 :
87
88 ###############################################################################
89 # Installation Details
90 ###############################################################################
91
92 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
93 # Update /etc/system-release, because the string might have changed
94 # since stage2 has been executed..
95 echo "$(SYSTEM_RELEASE)" > /etc/system-release
96
97 rm -rf /install/cdrom /tmp/*
98 mkdir -p /install/cdrom/doc
99
100 # Clear mtab (prevents .journal problems)
101 rm -vf /etc/mtab
102 echo > /etc/mtab
103
104 # Create filelist for packaging.
105 BUILDTARGET="$(BUILDTARGET)" BUILD_ARCH="$(BUILD_ARCH)" KVER="$(KVER)" \
106 $(DIR_SRC)/src/scripts/archive.files \
107 $(DIR_SRC)/config/rootfiles/common \
108 > /tmp/ROOTFILES
109
110 # Compress root filesystem
111 # Reason for this tar+untar+tar is removing of entries listed two or more in src/ROOTFILES
112 tar -c --exclude='#*' --exclude='proc/*' --exclude='dev/pts/*' --exclude='tmp/ROOTFILES' \
113 -C / --files-from=/tmp/ROOTFILES -f /$(SNAME).tar
114 rm -f /tmp/ROOTFILES
115 tar -x -C /tmp -f /$(SNAME).tar
116 rm -f /$(SNAME).tar
117 @mkdir /tmp/sys
118 cd /tmp && tar cf - * | xz $(XZ_OPT) > /install/cdrom/distro.img && rm -rf *
119
120 # Other files
121 touch /install/cdrom/$(SNAME)-$(VERSION)-core$(CORE).media
122 sed 's/VERSION/$(VERSION)/' $(DIR_SRC)/config/cdrom/README.txt > /install/cdrom/README.txt
123 cp $(DIR_SRC)/doc/COPYING /install/cdrom/
124 cp $(DIR_SRC)/doc/{ChangeLog,packages-list.txt} /install/cdrom/doc
125
126 mkdir -p /install/cdrom/boot/isolinux
127
128 ifeq "$(HAS_KERNEL)" "1"
129 cp /boot/vmlinuz-$(KVER)-ipfire /install/cdrom/boot/isolinux/vmlinuz
130 dracut --force -a "installer" --strip --xz /install/cdrom/boot/isolinux/instroot $(KVER)-ipfire
131 endif
132
133 ifeq "$(HAS_ISOLINUX)" "1"
134 dd if=/dev/zero bs=1k count=2 > /install/cdrom/boot/isolinux/boot.catalog
135 cp $(DIR_SRC)/config/syslinux/boot.png /install/cdrom/boot/isolinux/boot.png
136 cp /usr/share/syslinux/isolinux.bin /install/cdrom/boot/isolinux/isolinux.bin
137 cp /usr/share/hwdata/pci.ids /install/cdrom/boot/isolinux/pci.ids
138 cp -vf /usr/share/syslinux/*.c32 /install/cdrom/boot/isolinux/
139 sed -e "s/VERSION/$(VERSION) - Core $(CORE)/g" \
140 $(DIR_SRC)/config/syslinux/syslinux.cfg \
141 > /install/cdrom/boot/isolinux/isolinux.cfg
142 endif
143
144 ifeq "$(HAS_MEMTEST)" "1"
145 # Install memtest
146 cp /usr/lib/memtest86+/memtest.bin /install/cdrom/boot/isolinux/memtest
147 endif
148
149 ifeq "$(HAS_IPXE)" "1"
150 cp /usr/share/ipfire-netboot/ipxe.lkrn /install/cdrom/boot/isolinux/netboot
151 endif
152
153 ifeq "$(EFI)" "1"
154 # Generate embedded GRUB configuration
155 sed -e "s/NAME/$(NAME)/g" -e "s/VERSION/$(VERSION)/g" -e "s/ARCH/$(BUILD_ARCH)/g" \
156 $(DIR_SRC)/config/cdrom/grub-efi.cfg > /tmp/grub-efi.cfg
157
158 # Build a GRUB EFI image
159 mkdir -pv /install/cdrom/EFI/BOOT
160 grub-mkimage \
161 --format=$(GRUB_ARCH)-efi \
162 --output=/install/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
163 --config=/tmp/grub-efi.cfg \
164 --compression=xz \
165 --prefix=/EFI/BOOT \
166 $(GRUB_EFI_MODULES)
167
168 # Install GRUB configuration
169 mkdir -pv /install/cdrom/EFI/BOOT
170 sed -e "s/NAME/$(NAME)/g" -e "s/VERSION/$(VERSION)/g" -e "s/ARCH/$(BUILD_ARCH)/g" \
171 < $(DIR_SRC)/config/cdrom/grub.cfg > /install/cdrom/EFI/BOOT/grub.cfg
172
173 # Create the EFI Eltorito image
174 dd if=/dev/zero of=/install/cdrom/boot/isolinux/efiboot.img bs=1k count=1440
175 mkdosfs -F 12 -n "IPFIRE_EFI" /install/cdrom/boot/isolinux/efiboot.img
176
177 # Mount the EFI image
178 mkdir -pv /install/efiboot.img
179 mount -o loop /install/cdrom/boot/isolinux/efiboot.img /install/efiboot.img
180
181 # Copy the bootloader into the image
182 mkdir -pv /install/efiboot.img/EFI/BOOT
183 cp -a /install/cdrom/EFI/BOOT/boot$(EFI_ARCH).efi \
184 /install/efiboot.img/EFI/BOOT/boot$(EFI_ARCH).efi
185
186 # Cleanup
187 umount /install/efiboot.img
188 rm -rf /install/efiboot.img /tmp/grub-efi.cfg
189 endif
190
191 cd /install/cdrom && find -type f ! -name md5sum.txt | grep -v "./boot" | \
192 xargs md5sum > md5sum.txt
193
194 mkdir -p /install/images
195 cd /install/cdrom && mkisofs $(ISO_ARGS) \
196 -o /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso .
197
198 ifeq "$(HAS_ISOLINUX)" "1"
199 isohybrid $(ISOHYBRID_ARGS) /install/images/$(SNAME)-$(VERSION).$(BUILD_ARCH)-full-core$(CORE).iso
200 endif