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