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

Generated by cgit