1 #
2 # Makefile for CRUX
3 # Copyright (c) 2003-2005 Per Liden <per@fukt.bth.se>
4 #
5
6 CRUXVERSION = 3.3
7 CUSTOMVERSION =
8 COLLECTIONS = core opt xorg
9 KERNEL_MIRROR = https://cdn.kernel.org
10 KERNEL_VERSION = 4.9.6
11 KERNEL_PATCHES =
12 BB_VERSION = 1.25.1
13 MEMTEST_VERSION = 5.01
14 SYSLINUX_VERSION = 6.03
15 PKG_EXT = pkg.tar.xz
16 PKGMK_CONF = $(PWD)/pkgmk.conf
17 PORTS_DIR = $(PWD)/ports
18 FAKE_ROOT_DIR = $(PWD)/tmp/fake_root
19 ROOTFS_DIR = $(PWD)/tmp/rootfs
20 DATE_STR = $(shell date +'%Y%m%d')
21 IMG_ROOT_DIR = $(PWD)/tmp/img_root
22 SRCISO_ROOT_DIR = $(PWD)/tmp/srciso_root
23 ISO_FILENAME = $(PWD)/crux-$(CRUXVERSION)$(CUSTOMVERSION).iso
24 SRCISO_FILENAME = $(PWD)/crux-$(CRUXVERSION)$(CUSTOMVERSION)-source.iso
25 ISO_PACKAGES = filesystem bash dash coreutils bzip2 e2fsprogs jfsutils \
26 xfsprogs reiserfsprogs patch findutils glibc grep gzip kbd \
27 kmod less gawk ncurses inetutils pkgutils \
28 procps readline sed shadow sysklogd sysvinit tar \
29 util-linux vim which dialog nano mdadm pciutils libusb libusb-compat \
30 sysfsutils usbutils eudev zlib openssl openssh \
31 dhcpcd wget iproute2 libpcre iputils libgmp libdevmapper lvm2 \
32 attr acl libcap btrfs-progs lzo parted xz \
33 efibootmgr efivar gnu-efi libmpfr dosfstools \
34 libgcrypt libgpg-error popt cryptsetup start-stop-daemon \
35 linux-firmware wpa_supplicant dbus libnl wireless-tools file
36
37 PORTS_core = $(shell /bin/ls -I README $(PORTS_DIR)/core)
38 PORTS_opt = $(shell /bin/cat packages.opt)
39 PORTS_xorg = $(shell /bin/cat packages.xorg)
40
41 ifeq ($(FORCE),yes)
42 PKGMK_FORCE=-f
43 else
44 PKGMK_FORCE=
45 endif
46
47 ifeq ($(DOWNLOAD),yes)
48 PKGMK_DOWNLOAD=-do
49 else
50 PKGMK_DOWNLOAD=-d
51 endif
52
53 .PHONY: help check-root check-log $(COLLECTIONS) all all-chroot bootstrap \
54 initramfs kernel-clean clean iso \
55 busybox-clean initramfs-clean memtest-clean syslinux-clean \
56 grub2-efi grub2-efi-clean grub2-efi-distclean
57
58 help:
59 @echo "CRUX Makefile"
60 @echo "Targets:"
61 @echo " <collection> build single collection"
62 @echo " all build all collections"
63 @echo " bootstrap bootstrap all collections"
64 @echo " kernel download and build kernel"
65 @echo " iso create iso image"
66 @echo "Collections:"
67 @echo " $(COLLECTIONS)"
68
69 check-root:
70 @if [ "$(shell id -u)" != "0" ]; then \
71 echo "You need to be root to do this."; \
72 exit 1; \
73 fi
74
75 check-log:
76 @grep "^=======> ERROR:"; \
77 if [ "$$?" = "0" ]; then \
78 echo "(see log file for details)"; \
79 exit 1; \
80 else \
81 exit 0; \
82 fi
83
84
85 # kernel
86 kernel/linux-$(KERNEL_VERSION).tar.xz:
87 cd kernel && wget $(KERNEL_MIRROR)/pub/linux/kernel/v4.x/linux-$(KERNEL_VERSION).tar.xz
88
89 kernel/linux-$(KERNEL_VERSION): kernel/linux-$(KERNEL_VERSION).tar.xz
90 tar -C kernel -xJmf kernel/linux-$(KERNEL_VERSION).tar.xz
91 for FILE in $(KERNEL_PATCHES); do \
92 (cd kernel/linux-$(KERNEL_VERSION) && patch -p1 -i ../$$FILE;) \
93 done
94 sed -i -e 's,\($$(Q)echo "$$(KERNELVERSION)\)$$$$($$(CONFIG_SHELL).*" >,\1" >,' kernel/linux-$(KERNEL_VERSION)/Makefile
95
96 kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage: kernel/linux-$(KERNEL_VERSION).config | kernel/linux-$(KERNEL_VERSION)
97 make -C kernel/linux-$(KERNEL_VERSION) mrproper
98 cp -f kernel/linux-$(KERNEL_VERSION).config kernel/linux-$(KERNEL_VERSION)/.config
99 make -C kernel/linux-$(KERNEL_VERSION) oldconfig
100 make -C kernel/linux-$(KERNEL_VERSION) all
101
102 kernel: kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage
103
104 kernel-clean:
105 rm -rf kernel/linux-$(KERNEL_VERSION)
106
107 kernel-distclean: kernel-clean
108 rm -f kernel/linux-$(KERNEL_VERSION).tar.xz
109
110
111
112 # busybox
113 busybox/busybox-$(BB_VERSION).tar.bz2:
114 @cd busybox && wget http://busybox.net/downloads/busybox-$(BB_VERSION).tar.bz2
115
116 busybox/busybox-$(BB_VERSION): busybox/busybox-$(BB_VERSION).tar.bz2
117 @tar -C busybox -xjmf busybox/busybox-$(BB_VERSION).tar.bz2
118
119 busybox/busybox: busybox/busybox-$(BB_VERSION)
120 @cp -f busybox/busybox-$(BB_VERSION).config busybox/busybox-$(BB_VERSION)/.config
121 @make -C busybox/busybox-$(BB_VERSION) oldconfig
122 @make -C busybox/busybox-$(BB_VERSION)
123 @cp busybox/busybox-$(BB_VERSION)/busybox busybox/busybox
124
125 busybox: busybox/busybox
126
127 busybox-source: busybox/busybox-$(BB_VERSION).tar.bz2
128
129 busybox-clean:
130 rm -rf busybox/busybox-$(BB_VERSION) busybox/busybox
131
132 busybox-distclean: busybox-clean
133 rm -f busybox/busybox-$(BB_VERSION).tar.bz2
134
135
136
137 # grub2-efi
138 grub2-efi: /usr/bin/grub-mkimage
139 mkdir -p iso/EFI
140 /usr/bin/grub-mkimage -c iso/grub-early.cfg -o iso/EFI/bootx64.efi -O x86_64-efi -p "" iso9660 normal search search_fs_file
141 /usr/bin/grub-mkimage -c iso/grub-early.cfg -o iso/EFI/bootia32.efi -O i386-efi -p "" iso9660 normal search search_fs_file
142
143 iso/efiboot.img: grub2-efi
144 dd if=/dev/zero of=iso/efiboot.img count=4096
145 mkdosfs -n CRUX-EFI iso/efiboot.img
146 mkdir -p iso/efiboot
147 mount -o loop iso/efiboot.img iso/efiboot
148 mkdir -p iso/efiboot/EFI/boot
149 cp iso/EFI/bootx64.efi iso/efiboot/EFI/boot/
150 cp iso/EFI/bootia32.efi iso/efiboot/EFI/boot/
151 umount iso/efiboot
152
153 grub2-efi-clean:
154 rm -f iso/EFI/*.efi
155 rm -rf iso/efiboot iso/efiboot.img
156
157
158
159 # memtest86+
160 iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin.gz:
161 cd iso/isolinux && wget http://www.memtest.org/download/$(MEMTEST_VERSION)/memtest86+-$(MEMTEST_VERSION).bin.gz
162
163 iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin: iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin.gz
164 zcat iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin.gz > iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin
165
166 memtest: iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin
167
168 memtest-clean:
169 rm -f iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin
170
171 memtest-distclean: memtest-clean
172 rm -f iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin.gz
173
174
175
176 # syslinux
177 iso/syslinux-$(SYSLINUX_VERSION).tar.xz:
178 cd iso && wget https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-$(SYSLINUX_VERSION).tar.xz
179
180 iso/syslinux-$(SYSLINUX_VERSION): iso/syslinux-$(SYSLINUX_VERSION).tar.xz
181 tar -C iso -Jxf iso/syslinux-$(SYSLINUX_VERSION).tar.xz
182
183 iso/syslinux-$(SYSLINUX_VERSION)/bios/core/isolinux.bin: iso/syslinux-$(SYSLINUX_VERSION)
184
185 syslinux: iso/syslinux-$(SYSLINUX_VERSION)/bios/core/isolinux.bin
186
187 syslinux-clean:
188 rm -rf iso/syslinux-$(SYSLINUX_VERSION)
189
190 syslinux-distclean: syslinux-clean
191 rm -f iso/syslinux-$(SYSLINUX_VERSION).tar.xz
192
193
194
195 clean: kernel-clean busybox-clean initramfs-clean grub2-efi-clean
196 @rm -rf tmp modules_install.log $(ISO_FILENAME) \
197 `basename $(ISO_FILENAME) .iso`.md5
198
199 distclean: clean kernel-distclean setup.dependencies-clean
200
201 $(COLLECTIONS): check-root
202 @for p in $(PORTS_$(@)); do \
203 if [ "$$p" != "COPYING" -a "$$p" != "COPYRIGHT" ]; then \
204 echo "port: $$p"; \
205 (cd $(PORTS_DIR)/$@/$$p && pkgmk -cf $(PKGMK_CONF) $(PKGMK_DOWNLOAD) $(PKGMK_FORCE)); \
206 fi; \
207 done
208
209 all: $(COLLECTIONS)
210
211 all-chroot: check-root
212 @echo "Creating chroot environment"
213 @rm -rf $(FAKE_ROOT_DIR)
214 @mkdir -p $(FAKE_ROOT_DIR)
215 @echo "Installing packages"
216 @mkdir -p $(FAKE_ROOT_DIR)/var/lib/pkg
217 @touch $(FAKE_ROOT_DIR)/var/lib/pkg/db
218 @for COLL in $(COLLECTIONS); do \
219 for PACKAGE in $(PORTS_DIR)/$$COLL/*/*.$(PKG_EXT); do \
220 echo " $$PACKAGE"; \
221 pkgadd -r $(FAKE_ROOT_DIR) $$PACKAGE; \
222 done; \
223 done
224 @echo "Installing kernel source (linux-$(KERNEL_VERSION)) into $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION)..."
225 @mkdir -p $(FAKE_ROOT_DIR)/usr/src
226 @tar Jxf kernel/linux-$(KERNEL_VERSION).tar.xz -C $(FAKE_ROOT_DIR)/usr/src/
227 @for FILE in $(KERNEL_PATCHES); do \
228 cp kernel/$$FILE $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION)/; \
229 (cd $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION) && \
230 patch -p1 -i $$FILE); \
231 done
232 @cp kernel/linux-$(KERNEL_VERSION).config $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION)/.config
233 @echo "Preparing kernel source..."
234 @(cd $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION) && \
235 make oldconfig && make)
236 @mkdir -p $(FAKE_ROOT_DIR)/lib/modules/$(KERNEL_VERSION)
237 @ln -s /usr/src/linux-$(KERNEL_VERSION) $(FAKE_ROOT_DIR)/lib/modules/$(KERNEL_VERSION)/build
238 @cp -L /etc/resolv.conf $(FAKE_ROOT_DIR)/etc/
239 @cp -L $(PKGMK_CONF) $(FAKE_ROOT_DIR)/etc/
240 @echo "Mounting /dev on $(FAKE_ROOT_DIR)/dev"
241 @mount --bind /dev $(FAKE_ROOT_DIR)/dev
242 @echo "Mounting /proc on $(FAKE_ROOT_DIR)/proc"
243 @mount --bind /proc $(FAKE_ROOT_DIR)/proc
244 @echo "Mounting $$PWD on $(FAKE_ROOT_DIR)/src"
245 @mkdir $(FAKE_ROOT_DIR)/src
246 @mount --bind $$PWD $(FAKE_ROOT_DIR)/src
247 @echo "Entering chroot enrivonment"
248 @chroot $(FAKE_ROOT_DIR) /bin/bash --login -c "cd /src && $(MAKE) FORCE=yes all"
249 @echo "Exiting chroot enrivonment"
250 @echo "Unmounting $(FAKE_ROOT_DIR)/src"
251 @umount $(FAKE_ROOT_DIR)/src
252 @rmdir $(FAKE_ROOT_DIR)/src
253 @echo "Unmounting $(FAKE_ROOT_DIR)/proc"
254 @umount $(FAKE_ROOT_DIR)/proc
255 @echo "Unmounting $(FAKE_ROOT_DIR)/dev"
256 @umount $(FAKE_ROOT_DIR)/dev
257 @echo "Removing chroot environment"
258 @rm -rf $(FAKE_ROOT_DIR)
259
260 bootstrap: check-root kernel
261 @echo "Bootstrap started (`date +'%F %T'`)"
262 @echo "- Stage 0 (`date +'%F %T'`)"
263 @$(MAKE) all > log.stage0 2>&1
264 @$(MAKE) check-log < log.stage0
265 @echo "- Stage 1 (`date +'%F %T'`)"
266 @$(MAKE) all-chroot > log.stage1 2>&1
267 @$(MAKE) check-log < log.stage1
268 @echo "- Stage 2 (`date +'%F %T'`)"
269 @$(MAKE) all-chroot > log.stage2 2>&1
270 @$(MAKE) check-log < log.stage2
271 @echo "Bootstrap completed (`date +'%F %T'`)"
272
273
274
275 # initramfs
276 initramfs: kernel busybox initramfs/init | rootfs
277 @echo "Creating initramfs..."
278 @sed -e "s/#KERNEL_VERSION#/$(KERNEL_VERSION)/g" initramfs/initramfs.lst \
279 > initramfs/initramfs.lst-sed
280 @cd initramfs && ../kernel/linux-$(KERNEL_VERSION)/usr/gen_init_cpio \
281 initramfs.lst-sed > initramfs
282
283 initramfs-clean:
284 if [ -e initramfs/initramfs.lst-sed ]; then rm -f initramfs/initramfs.lst-sed; fi
285 if [ -e initramfs/initramfs ]; then rm -f initramfs/initramfs; fi
286
287
288
289 # rootfs.tar.xz
290 rootfs: kernel busybox
291 @echo "Creating rootfs..."
292 @rm -rf $(ROOTFS_DIR)
293 @mkdir -p $(ROOTFS_DIR)
294 @echo "- Installing packages..."
295 @for PACKAGE in $(ISO_PACKAGES); do \
296 bsdtar -C $(ROOTFS_DIR) -xpf $(PORTS_DIR)/*/$$PACKAGE/$$PACKAGE\#*.$(PKG_EXT); \
297 done
298 @sed -i -e 's/^#PermitRootLogin.*/PermitRootLogin yes/' \
299 $(ROOTFS_DIR)/etc/ssh/sshd_config
300 @echo "- Installing kernel and modules..."
301 @cp kernel/linux-$(KERNEL_VERSION)/System.map $(ROOTFS_DIR)/boot/System.map
302 @cp kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage $(ROOTFS_DIR)/boot/vmlinuz
303 @make -C kernel/linux-$(KERNEL_VERSION) INSTALL_MOD_PATH=$(ROOTFS_DIR) modules_install > modules_install.log 2>&1
304 @echo "- Deleting superfluous files..."
305 @cd $(ROOTFS_DIR) && rm -rf var opt home
306 @mkdir -p $(ROOTFS_DIR)/var/empty $(ROOTFS_DIR)/var/lib
307 @cd $(ROOTFS_DIR)/usr && rm -rf man include lib/*.a lib/*.o lib/gconv lib/locale src
308 @cd $(ROOTFS_DIR)/usr/share && mkdir l v x; cp terminfo/l/linux l; cp terminfo/v/vt100 v; cp terminfo/x/xterm x; rm -rf terminfo/*; mv l v x terminfo
309 @cd $(ROOTFS_DIR)/usr/share && rm -rf et ss vim i18n zoneinfo
310 @cd $(ROOTFS_DIR)/usr/bin && rm cal locale localedef rpcgen compile_et mk_cmds
311 @cd $(ROOTFS_DIR)/usr/sbin && rm groupadd groupdel groupmod useradd userdel usermod grpck pwck iconvconfig
312 @cd $(ROOTFS_DIR)/etc && rm -rf cron resolv.conf lilo.conf sysctl.conf pkgadd.conf pkgmk.conf securetty
313 @cd $(ROOTFS_DIR)/etc/rc.d && find . -type f ! -name "sshd" -exec rm -f '{}' \;
314 @rm $(ROOTFS_DIR)/lib/modules/$(KERNEL_VERSION)/build
315 @echo "- Creating symlinks"
316 @ln -sf /tmp/var $(ROOTFS_DIR)/var
317 @ln -sf /proc/mounts $(ROOTFS_DIR)/etc/mtab
318 @echo "- Updating library links and cache"
319 @ldconfig -r $(ROOTFS_DIR)
320 @echo "- Copying iso/ files..."
321 @for F in motd fstab hosts inittab issue ld.so.conf protocols rc rc.shutdown rc.single services shadow; do \
322 cp iso/etc/$$F $(ROOTFS_DIR)/etc; \
323 done
324 @for F in setup setup-helper setup-chroot serial_console; do \
325 cp iso/bin/$$F $(ROOTFS_DIR)/usr/bin; \
326 done
327 @echo "- Compressing (rootfs.tar.xz)..."
328 @mkdir -p rootfs
329 @(cd $(ROOTFS_DIR) && tar -Jcf ../../rootfs/rootfs.tar.xz . 2>/dev/null)
330
331 rootfs-clean:
332 @rm -rf rootfs
333
334
335 # setup.dependencies
336 iso/setup.dependencies: packages.opt packages.xorg
337 @echo "Creating iso/setup.dependencies ..."
338 @for PORT in $(foreach c,$(COLLECTIONS),$(PORTS_$(c))); do \
339 if [ "$$PORT" != "COPYING" -a "$$PORT" != "COPYRIGHT" ]; then \
340 echo -n $$PORT": "; \
341 prt-get \
342 --no-std-config \
343 $(foreach c,$(COLLECTIONS),--config-append="prtdir $(PORTS_DIR)/$(c)") \
344 quickdep $$PORT; \
345 fi; \
346 done > $@
347
348 setup.dependencies: iso/setup.dependencies packages.all check-deps
349
350 setup.dependencies-clean:
351 @rm iso/setup.dependencies
352 @rm packages.all
353
354 # Write a file with all packages we provide on the iso
355 packages.all: packages.opt packages.xorg
356 @echo "Writing file packages.all ..."
357 @for PORT in $(foreach c,$(COLLECTIONS),$(PORTS_$(c))); do \
358 if [ "$$PORT" != "COPYING" -a "$$PORT" != "COPYRIGHT" ]; then \
359 echo $$PORT; \
360 fi; \
361 done | sort > $@
362
363 # here we check if we have a dep, listed in a Pkgfile, which we do not provide on the iso
364 check-deps: packages.all iso/setup.dependencies
365 @echo "Check for missing dependencies ..."
366 @gawk ' \
367 BEGIN { while ((getline p < "packages.all") > 0) { pkgs[p] }} \
368 { for (p=2; p<=NF; p++) { if ( ! ($$p in pkgs)) { printf(" * %s %s\n", $$1, $$p) }}} \
369 ' iso/setup.dependencies
370
371 # check for duplicate, missing and orphan packages in the ports tree
372 check-portstree: packages.all
373 @cd $(PORTS_DIR) && ./checkportstree
374
375
376 ##### image building #####
377 image-base: check-root kernel initramfs rootfs setup.dependencies iso/efiboot.img
378 @echo "Creating installation image base"
379 @if [ -e $(IMG_ROOT_DIR) ]; then rm -rf $(IMG_ROOT_DIR); fi
380 @mkdir -p $(IMG_ROOT_DIR)/boot
381 @echo "- Installing kernel"
382 @cp kernel/linux-$(KERNEL_VERSION)/System.map $(IMG_ROOT_DIR)/boot/System.map
383 @cp kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage $(IMG_ROOT_DIR)/boot/vmlinuz
384 @echo "- Installing initramfs"
385 @cp initramfs/initramfs $(IMG_ROOT_DIR)/boot/initramfs
386 @echo "- Copying CRUX packages"
387 @mkdir -p $(IMG_ROOT_DIR)/crux
388 @cp doc/handbook/handbook.txt doc/handbook/releasenotes.txt $(IMG_ROOT_DIR)/crux
389 @cp iso/setup.dependencies $(IMG_ROOT_DIR)/crux
390 @mkdir -p $(IMG_ROOT_DIR)/crux/kernel
391 @cp kernel/linux-$(KERNEL_VERSION).tar.xz $(IMG_ROOT_DIR)/crux/kernel
392 @cp kernel/linux-$(KERNEL_VERSION).config $(IMG_ROOT_DIR)/crux/kernel
393 @cp kernel/linux-$(KERNEL_VERSION).defconfig $(IMG_ROOT_DIR)/crux/kernel
394 @for FILE in $(KERNEL_PATCHES); do \
395 cp kernel/$$FILE $(IMG_ROOT_DIR)/crux/kernel; \
396 done
397 @for COLL in $(COLLECTIONS); do \
398 mkdir -p $(IMG_ROOT_DIR)/crux/$$COLL; \
399 cp $(PORTS_DIR)/$$COLL/*/*.$(PKG_EXT) $(IMG_ROOT_DIR)/crux/$$COLL; \
400 done
401 @mkdir -p $(IMG_ROOT_DIR)/tools
402 @echo "- Creating a gzip compressed pkgutils package in /tools"
403 @cp $(IMG_ROOT_DIR)/crux/core/pkgutils*.$(PKG_EXT) $(IMG_ROOT_DIR)/tools
404 @xz -d $(IMG_ROOT_DIR)/tools/pkgutils*.$(PKG_EXT)
405 @gzip $(IMG_ROOT_DIR)/tools/pkgutils*.tar
406 @echo "- Copying rootfs.tar.xz"
407 @cp rootfs/rootfs.tar.xz $(IMG_ROOT_DIR)
408 @echo $(CRUXVERSION)-$(DATE_STR) > $(IMG_ROOT_DIR)/crux-media
409
410
411 ##### iso image building #####
412 iso: image-base memtest syslinux
413 @echo "Copying ISO specific files"
414 @mkdir -p $(IMG_ROOT_DIR)/boot/isolinux
415 @cp iso/syslinux-$(SYSLINUX_VERSION)/bios/core/isolinux.bin $(IMG_ROOT_DIR)/boot/isolinux/
416 @cp iso/syslinux-$(SYSLINUX_VERSION)/bios/com32/elflink/ldlinux/ldlinux.c32 $(IMG_ROOT_DIR)/boot/isolinux/
417 @for F in hdt/hdt.c32 libutil/libutil.c32 gpllib/libgpl.c32 lib/libcom32.c32 cmenu/libmenu/libmenu.c32; do \
418 cp iso/syslinux-$(SYSLINUX_VERSION)/bios/com32/$$F $(IMG_ROOT_DIR)/boot/isolinux/; \
419 done
420 @cp /usr/share/pci.ids $(IMG_ROOT_DIR)/boot/isolinux/
421 @cp iso/isolinux/isolinux.cfg iso/isolinux/*.msg \
422 $(IMG_ROOT_DIR)/boot/isolinux
423 @cp iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin $(IMG_ROOT_DIR)/boot/isolinux/memtest86plus
424 @cp iso/efiboot.img $(IMG_ROOT_DIR)/boot/
425 @mkdir -p $(IMG_ROOT_DIR)/boot/grub/x86_64-efi $(IMG_ROOT_DIR)/boot/grub/i386-efi
426 @cp -a /usr/lib/grub/x86_64-efi/*.mod /usr/lib/grub/x86_64-efi/*.lst $(IMG_ROOT_DIR)/boot/grub/x86_64-efi/
427 @cp -a /usr/lib/grub/i386-efi/*.mod /usr/lib/grub/i386-efi/*.lst $(IMG_ROOT_DIR)/boot/grub/i386-efi/
428 @cp iso/grub.cfg $(IMG_ROOT_DIR)/boot/grub/
429 @echo "- Creating ISO sort table"
430 @echo "$(IMG_ROOT_DIR)/boot 100" > /tmp/iso.sort
431 @echo "$(IMG_ROOT_DIR)/boot/isolinux 200" >> /tmp/iso.sort
432 @echo "$(IMG_ROOT_DIR)/boot/isolinux/isolinux.bin 300" >> /tmp/iso.sort
433 @echo "- Starting genisoimage"
434 @if [ -f $(ISO_FILENAME) ]; then rm -f $(ISO_FILENAME); fi
435 @genisoimage -R -l -J -V "CRUX-$(CRUXVERSION)$(CUSTOMVERSION)" -A CRUX \
436 -b boot/isolinux/isolinux.bin \
437 -c boot/isolinux/isolinux.boot -no-emul-boot -boot-load-size 4 \
438 -boot-info-table \
439 -eltorito-alt-boot -e boot/efiboot.img -no-emul-boot \
440 -sort /tmp/iso.sort -input-charset utf-8 -o "$(ISO_FILENAME)" $(IMG_ROOT_DIR)
441 @isohybrid -u $(ISO_FILENAME)
442 @md5sum `basename $(ISO_FILENAME)` > `basename $(ISO_FILENAME) .iso`.md5
443 @rm /tmp/iso.sort
444 @echo "Done: $(shell date)"
445
446
447 source-iso: busybox-source packages.all kernel/linux-$(KERNEL_VERSION).tar.xz
448 @echo "Creating ISO image with sources ($(SRCISO_FILENAME))"
449 @rm -rf $(SRCISO_ROOT_DIR)
450 @mkdir -p $(SRCISO_ROOT_DIR)/ports $(SRCISO_ROOT_DIR)/kernel $(SRCISO_ROOT_DIR)/misc
451 @echo "- Copying ports"
452 @for PORT in $(shell /bin/cat packages.all); do \
453 find $(PORTS_DIR) -mindepth 2 -maxdepth 2 -name $$PORT -type d -exec cp -r {} $(SRCISO_ROOT_DIR)/ports \; ; \
454 rm -f $(SRCISO_ROOT_DIR)/ports/$$PORT/.footprint \
455 $(SRCISO_ROOT_DIR)/ports/$$PORT/.md5sum \
456 $(SRCISO_ROOT_DIR)/ports/$$PORT/*.$(PKG_EXT); \
457 done
458 @echo "- Copying misc sources"
459 @cp busybox/busybox-$(BB_VERSION).tar.bz2 $(SRCISO_ROOT_DIR)/misc
460 @echo "- Copying kernel and patches"
461 @cp kernel/linux-$(KERNEL_VERSION).tar.xz $(SRCISO_ROOT_DIR)/kernel
462 @for PATCH in $(KERNEL_PATCHES); do cp kernel/$$PATCH $(SRCISO_ROOT_DIR)/kernel; done
463 @echo "- Creating README"
464 @echo "This ISO image contains sources for the packages, kernel and utilities" > $(SRCISO_ROOT_DIR)/README
465 @echo "supplied with/used in CRUX $(CRUXVERSION)." >> $(SRCISO_ROOT_DIR)/README
466 @echo "- Starting genisoimage"
467 @genisoimage -R -l -J -V CRUX-$(CRUXVERSION) -A CRUX -o $(SRCISO_FILENAME) $(SRCISO_ROOT_DIR)
468 @md5sum `basename $(SRCISO_FILENAME)` > `basename $(SRCISO_FILENAME) .iso`.md5
469
470 # End of file
|