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