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