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.61
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 -j$(shell nproc) -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 rootfs-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 $(shell $(PWD)/hacks.sh)
262 @echo "Bootstrap started (`date +'%F %T'`)"
263 @echo "- Stage 0 (`date +'%F %T'`)"
264 @$(MAKE) all > log.stage0 2>&1
265 @$(MAKE) check-log < log.stage0
266 @echo "- Stage 1 (`date +'%F %T'`)"
267 @$(MAKE) all-chroot > log.stage1 2>&1
268 @$(MAKE) check-log < log.stage1
269 @echo "- Stage 2 (`date +'%F %T'`)"
270 @$(MAKE) all-chroot > log.stage2 2>&1
271 @$(MAKE) check-log < log.stage2
272 @echo "Bootstrap completed (`date +'%F %T'`)"
273
274
275
276 # initramfs
277 initramfs: kernel busybox initramfs/init | rootfs
278 @echo "Creating initramfs..."
279 @sed -e "s/#KERNEL_VERSION#/$(KERNEL_VERSION)/g" initramfs/initramfs.lst \
280 > initramfs/initramfs.lst-sed
281 @cd initramfs && ../kernel/linux-$(KERNEL_VERSION)/usr/gen_init_cpio \
282 initramfs.lst-sed > initramfs
283
284 initramfs-clean:
285 if [ -e initramfs/initramfs.lst-sed ]; then rm -f initramfs/initramfs.lst-sed; fi
286 if [ -e initramfs/initramfs ]; then rm -f initramfs/initramfs; fi
287
288
289
290 # rootfs.tar.xz
291 rootfs: kernel busybox
292 @echo "Creating rootfs..."
293 @rm -rf $(ROOTFS_DIR)
294 @mkdir -p $(ROOTFS_DIR)
295 @echo "- Installing packages..."
296 @for PACKAGE in $(ISO_PACKAGES); do \
297 bsdtar -C $(ROOTFS_DIR) -xpf $(PORTS_DIR)/*/$$PACKAGE/$$PACKAGE\#*.$(PKG_EXT); \
298 done
299 @sed -i -e 's/^#PermitRootLogin.*/PermitRootLogin yes/' \
300 $(ROOTFS_DIR)/etc/ssh/sshd_config
301 @echo "- Installing kernel and modules..."
302 @cp kernel/linux-$(KERNEL_VERSION)/System.map $(ROOTFS_DIR)/boot/System.map
303 @cp kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage $(ROOTFS_DIR)/boot/vmlinuz
304 @make -C kernel/linux-$(KERNEL_VERSION) INSTALL_MOD_PATH=$(ROOTFS_DIR) modules_install > modules_install.log 2>&1
305 @echo "- Deleting superfluous files..."
306 @cd $(ROOTFS_DIR) && rm -rf var opt home
307 @mkdir -p $(ROOTFS_DIR)/var/empty $(ROOTFS_DIR)/var/lib
308 @cd $(ROOTFS_DIR)/usr && rm -rf man include lib/*.a lib/*.o lib/gconv lib/locale src
309 @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
310 @cd $(ROOTFS_DIR)/usr/share && rm -rf et ss vim i18n zoneinfo
311 @cd $(ROOTFS_DIR)/usr/bin && rm cal locale localedef rpcgen compile_et mk_cmds
312 @cd $(ROOTFS_DIR)/usr/sbin && rm groupadd groupdel groupmod useradd userdel usermod grpck pwck iconvconfig
313 @cd $(ROOTFS_DIR)/etc && rm -rf cron resolv.conf lilo.conf sysctl.conf pkgadd.conf pkgmk.conf securetty
314 @cd $(ROOTFS_DIR)/etc/rc.d && find . -type f ! -name "sshd" -exec rm -f '{}' \;
315 @rm $(ROOTFS_DIR)/lib/modules/$(KERNEL_VERSION)/build
316 @echo "- Creating symlinks"
317 @ln -sf /tmp/var $(ROOTFS_DIR)/var
318 @ln -sf /proc/mounts $(ROOTFS_DIR)/etc/mtab
319 @echo "- Updating library links and cache"
320 @ldconfig -r $(ROOTFS_DIR)
321 @echo "- Copying iso/ files..."
322 @for F in motd fstab hosts inittab issue ld.so.conf protocols rc rc.shutdown rc.single services shadow; do \
323 cp iso/etc/$$F $(ROOTFS_DIR)/etc; \
324 done
325 @for F in setup setup-helper setup-chroot serial_console; do \
326 cp iso/bin/$$F $(ROOTFS_DIR)/usr/bin; \
327 done
328 @echo "- Compressing (rootfs.tar.xz)..."
329 @mkdir -p rootfs
330 @(cd $(ROOTFS_DIR) && tar -Jcf ../../rootfs/rootfs.tar.xz . 2>/dev/null)
331
332 rootfs-clean:
333 @rm -rf rootfs
334
335
336 # setup.dependencies
337 iso/setup.dependencies: packages.opt packages.xorg
338 @echo "Creating iso/setup.dependencies ..."
339 @for PORT in $(foreach c,$(COLLECTIONS),$(PORTS_$(c))); do \
340 if [ "$$PORT" != "COPYING" -a "$$PORT" != "COPYRIGHT" ]; then \
341 echo -n $$PORT": "; \
342 prt-get \
343 --no-std-config \
344 $(foreach c,$(COLLECTIONS),--config-append="prtdir $(PORTS_DIR)/$(c)") \
345 quickdep $$PORT; \
346 fi; \
347 done > $@
348
349 setup.dependencies: iso/setup.dependencies packages.all check-deps
350
351 setup.dependencies-clean:
352 @rm iso/setup.dependencies
353 @rm packages.all
354
355 # Write a file with all packages we provide on the iso
356 packages.all: packages.opt packages.xorg
357 @echo "Writing file packages.all ..."
358 @for PORT in $(foreach c,$(COLLECTIONS),$(PORTS_$(c))); do \
359 if [ "$$PORT" != "COPYING" -a "$$PORT" != "COPYRIGHT" ]; then \
360 echo $$PORT; \
361 fi; \
362 done | sort > $@
363
364 # here we check if we have a dep, listed in a Pkgfile, which we do not provide on the iso
365 check-deps: packages.all iso/setup.dependencies
366 @echo "Check for missing dependencies ..."
367 @gawk ' \
368 BEGIN { while ((getline p < "packages.all") > 0) { pkgs[p] }} \
369 { for (p=2; p<=NF; p++) { if ( ! ($$p in pkgs)) { printf(" * %s %s\n", $$1, $$p) }}} \
370 ' iso/setup.dependencies
371
372 # check for duplicate, missing and orphan packages in the ports tree
373 check-portstree: packages.all
374 @cd $(PORTS_DIR) && ./checkportstree
375
376
377 ##### image building #####
378 image-base: check-root kernel initramfs rootfs setup.dependencies iso/efiboot.img
379 @echo "Creating installation image base"
380 @if [ -e $(IMG_ROOT_DIR) ]; then rm -rf $(IMG_ROOT_DIR); fi
381 @mkdir -p $(IMG_ROOT_DIR)/boot
382 @echo "- Installing kernel"
383 @cp kernel/linux-$(KERNEL_VERSION)/System.map $(IMG_ROOT_DIR)/boot/System.map
384 @cp kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage $(IMG_ROOT_DIR)/boot/vmlinuz
385 @echo "- Installing initramfs"
386 @cp initramfs/initramfs $(IMG_ROOT_DIR)/boot/initramfs
387 @echo "- Copying CRUX packages"
388 @mkdir -p $(IMG_ROOT_DIR)/crux
389 @cp doc/handbook/handbook.txt doc/handbook/releasenotes.txt $(IMG_ROOT_DIR)/crux
390 @cp iso/setup.dependencies $(IMG_ROOT_DIR)/crux
391 @mkdir -p $(IMG_ROOT_DIR)/crux/kernel
392 @cp kernel/linux-$(KERNEL_VERSION).tar.xz $(IMG_ROOT_DIR)/crux/kernel
393 @cp kernel/linux-$(KERNEL_VERSION).config $(IMG_ROOT_DIR)/crux/kernel
394 @cp kernel/linux-$(KERNEL_VERSION).defconfig $(IMG_ROOT_DIR)/crux/kernel
395 @for FILE in $(KERNEL_PATCHES); do \
396 cp kernel/$$FILE $(IMG_ROOT_DIR)/crux/kernel; \
397 done
398 @for COLL in $(COLLECTIONS); do \
399 mkdir -p $(IMG_ROOT_DIR)/crux/$$COLL; \
400 cp $(PORTS_DIR)/$$COLL/*/*.$(PKG_EXT) $(IMG_ROOT_DIR)/crux/$$COLL; \
401 done
402 @mkdir -p $(IMG_ROOT_DIR)/tools
403 @echo "- Creating a gzip compressed pkgutils package in /tools"
404 @cp $(IMG_ROOT_DIR)/crux/core/pkgutils*.$(PKG_EXT) $(IMG_ROOT_DIR)/tools
405 @xz -d $(IMG_ROOT_DIR)/tools/pkgutils*.$(PKG_EXT)
406 @gzip $(IMG_ROOT_DIR)/tools/pkgutils*.tar
407 @echo "- Copying rootfs.tar.xz"
408 @cp rootfs/rootfs.tar.xz $(IMG_ROOT_DIR)
409 @echo $(CRUXVERSION)-$(DATE_STR) > $(IMG_ROOT_DIR)/crux-media
410
411
412 ##### iso image building #####
413 iso: image-base memtest syslinux
414 @echo "Copying ISO specific files"
415 @mkdir -p $(IMG_ROOT_DIR)/boot/isolinux
416 @cp iso/syslinux-$(SYSLINUX_VERSION)/bios/core/isolinux.bin $(IMG_ROOT_DIR)/boot/isolinux/
417 @cp iso/syslinux-$(SYSLINUX_VERSION)/bios/com32/elflink/ldlinux/ldlinux.c32 $(IMG_ROOT_DIR)/boot/isolinux/
418 @for F in hdt/hdt.c32 libutil/libutil.c32 gpllib/libgpl.c32 lib/libcom32.c32 cmenu/libmenu/libmenu.c32; do \
419 cp iso/syslinux-$(SYSLINUX_VERSION)/bios/com32/$$F $(IMG_ROOT_DIR)/boot/isolinux/; \
420 done
421 @cp /usr/share/pci.ids $(IMG_ROOT_DIR)/boot/isolinux/
422 @cp iso/isolinux/isolinux.cfg iso/isolinux/*.msg \
423 $(IMG_ROOT_DIR)/boot/isolinux
424 @cp iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin $(IMG_ROOT_DIR)/boot/isolinux/memtest86plus
425 @cp iso/efiboot.img $(IMG_ROOT_DIR)/boot/
426 @mkdir -p $(IMG_ROOT_DIR)/boot/grub/x86_64-efi $(IMG_ROOT_DIR)/boot/grub/i386-efi
427 @cp -a /usr/lib/grub/x86_64-efi/*.mod /usr/lib/grub/x86_64-efi/*.lst $(IMG_ROOT_DIR)/boot/grub/x86_64-efi/
428 @cp -a /usr/lib/grub/i386-efi/*.mod /usr/lib/grub/i386-efi/*.lst $(IMG_ROOT_DIR)/boot/grub/i386-efi/
429 @cp iso/grub.cfg $(IMG_ROOT_DIR)/boot/grub/
430 @echo "- Creating ISO sort table"
431 @echo "$(IMG_ROOT_DIR)/boot 100" > /tmp/iso.sort
432 @echo "$(IMG_ROOT_DIR)/boot/isolinux 200" >> /tmp/iso.sort
433 @echo "$(IMG_ROOT_DIR)/boot/isolinux/isolinux.bin 300" >> /tmp/iso.sort
434 @echo "- Starting genisoimage"
435 @if [ -f $(ISO_FILENAME) ]; then rm -f $(ISO_FILENAME); fi
436 @genisoimage -R -l -J -V "CRUX-$(CRUXVERSION)$(CUSTOMVERSION)" -A CRUX \
437 -b boot/isolinux/isolinux.bin \
438 -c boot/isolinux/isolinux.boot -no-emul-boot -boot-load-size 4 \
439 -boot-info-table \
440 -eltorito-alt-boot -e boot/efiboot.img -no-emul-boot \
441 -sort /tmp/iso.sort -input-charset utf-8 -o "$(ISO_FILENAME)" $(IMG_ROOT_DIR)
442 @isohybrid -u $(ISO_FILENAME)
443 @md5sum `basename $(ISO_FILENAME)` > `basename $(ISO_FILENAME) .iso`.md5
444 @rm /tmp/iso.sort
445 @echo "Done: $(shell date)"
446
447
448 source-iso: busybox-source packages.all kernel/linux-$(KERNEL_VERSION).tar.xz
449 @echo "Creating ISO image with sources ($(SRCISO_FILENAME))"
450 @rm -rf $(SRCISO_ROOT_DIR)
451 @mkdir -p $(SRCISO_ROOT_DIR)/ports $(SRCISO_ROOT_DIR)/kernel $(SRCISO_ROOT_DIR)/misc
452 @echo "- Copying ports"
453 @for PORT in $(shell /bin/cat packages.all); do \
454 find $(PORTS_DIR) -mindepth 2 -maxdepth 2 -name $$PORT -type d -exec cp -r {} $(SRCISO_ROOT_DIR)/ports \; ; \
455 rm -f $(SRCISO_ROOT_DIR)/ports/$$PORT/.footprint \
456 $(SRCISO_ROOT_DIR)/ports/$$PORT/.md5sum \
457 $(SRCISO_ROOT_DIR)/ports/$$PORT/*.$(PKG_EXT); \
458 done
459 @echo "- Copying misc sources"
460 @cp busybox/busybox-$(BB_VERSION).tar.bz2 $(SRCISO_ROOT_DIR)/misc
461 @echo "- Copying kernel and patches"
462 @cp kernel/linux-$(KERNEL_VERSION).tar.xz $(SRCISO_ROOT_DIR)/kernel
463 @for PATCH in $(KERNEL_PATCHES); do cp kernel/$$PATCH $(SRCISO_ROOT_DIR)/kernel; done
464 @echo "- Creating README"
465 @echo "This ISO image contains sources for the packages, kernel and utilities" > $(SRCISO_ROOT_DIR)/README
466 @echo "supplied with/used in CRUX $(CRUXVERSION)." >> $(SRCISO_ROOT_DIR)/README
467 @echo "- Starting genisoimage"
468 @genisoimage -R -l -J -V CRUX-$(CRUXVERSION) -A CRUX -o $(SRCISO_FILENAME) $(SRCISO_ROOT_DIR)
469 @md5sum `basename $(SRCISO_FILENAME)` > `basename $(SRCISO_FILENAME) .iso`.md5
470
471 # End of file
|