diff --git a/Makefile b/Makefile index 985d816..d58e37a 100644 --- a/Makefile +++ b/Makefile @@ -7,16 +7,16 @@ CRUXVERSION = 2.6 CUSTOMVERSION = COLLECTIONS = core opt xorg KERNEL_MIRROR = ftp://ftp.kernel.org -KERNEL_VERSION = 2.6.30.5 +KERNEL_VERSION = 2.6.33.2 KERNEL_PATCHES = BB_VERSION = 1.14.1 -SYSLINUX_VERSION = 3.81 +SYSLINUX_VERSION = 3.86 SQUASHFS_VERSION = 4.0 PORTS_DIR = $(PWD)/ports FAKE_ROOT_DIR = $(PWD)/tmp/fake_root SQUASHFS_DIR = $(PWD)/tmp/squashfs DATE_STR = $(shell date +'%Y%m%d') -ISO_ROOT_DIR = $(PWD)/tmp/iso_root +IMG_ROOT_DIR = $(PWD)/tmp/img_root SRCISO_ROOT_DIR = $(PWD)/tmp/srciso_root ISO_FILENAME = $(PWD)/crux-$(CRUXVERSION)$(CUSTOMVERSION).iso NETISO_FILENAME = $(PWD)/crux-$(CRUXVERSION)$(CUSTOMVERSION)-netinst.iso @@ -39,6 +39,12 @@ else PKGMK_FORCE= endif +ifeq ($(DOWNLOAD),yes) +PKGMK_DOWNLOAD=-do +else +PKGMK_DOWNLOAD=-d +endif + .PHONY: help check-root check-log $(COLLECTIONS) all all-chroot bootstrap kernel kernel-clean syslinux syslinux-clean clean iso help: @@ -170,7 +176,7 @@ distclean: clean kernel-distclean syslinux-distclean setup.dependencies-clean $(COLLECTIONS): check-root @for p in $(PORTS_$(@)); do \ echo "port: $$p"; \ - (cd $(PORTS_DIR)/$@/$$p && pkgmk -d $(PKGMK_FORCE)); \ + (cd $(PORTS_DIR)/$@/$$p && pkgmk $(PKGMK_DOWNLOAD) $(PKGMK_FORCE)); \ done all: $(COLLECTIONS) @@ -332,65 +338,75 @@ check-portstree: packages.all @cd $(PORTS_DIR) && ./checkportstree -##### iso building ##### -iso: check-root kernel syslinux initramfs squashfs setup.dependencies unsquashfs - @echo "Creating ISO image ($(ISO_FILENAME))" - @if [ -e $(ISO_ROOT_DIR) ]; then rm -rf $(ISO_ROOT_DIR); fi - @mkdir -p $(ISO_ROOT_DIR)/boot +##### image building ##### +image-base: check-root kernel syslinux initramfs squashfs setup.dependencies unsquashfs + @echo "Creating installation image base" + @if [ -e $(IMG_ROOT_DIR) ]; then rm -rf $(IMG_ROOT_DIR); fi + @mkdir -p $(IMG_ROOT_DIR)/boot @echo "- Installing kernel" - @cp kernel/linux-$(KERNEL_VERSION)/System.map $(ISO_ROOT_DIR)/boot/System.map - @cp kernel/linux-$(KERNEL_VERSION)/arch/i386/boot/bzImage $(ISO_ROOT_DIR)/boot/vmlinuz + @cp kernel/linux-$(KERNEL_VERSION)/System.map $(IMG_ROOT_DIR)/boot/System.map + @cp kernel/linux-$(KERNEL_VERSION)/arch/i386/boot/bzImage $(IMG_ROOT_DIR)/boot/vmlinuz @echo "- Installing initramfs" - @cp initramfs/initramfs $(ISO_ROOT_DIR)/boot/initramfs - @echo "- Copying ISO specific files" - @mkdir -p $(ISO_ROOT_DIR)/boot/isolinux - @cp iso/syslinux-$(SYSLINUX_VERSION)/core/isolinux.bin $(ISO_ROOT_DIR)/boot/isolinux - @cp iso/isolinux/{isolinux.cfg,*.msg,memtest86plus} \ - $(ISO_ROOT_DIR)/boot/isolinux - @echo $(CRUXVERSION)-$(DATE_STR) > $(ISO_ROOT_DIR)/crux-media + @cp initramfs/initramfs $(IMG_ROOT_DIR)/boot/initramfs @echo "- Copying CRUX packages" - @mkdir -p $(ISO_ROOT_DIR)/crux - @cp doc/handbook/{handbook,releasenotes}.txt $(ISO_ROOT_DIR)/crux - @cp iso/setup.dependencies $(ISO_ROOT_DIR)/crux - @mkdir -p $(ISO_ROOT_DIR)/crux/kernel - @cp kernel/linux-$(KERNEL_VERSION).tar.bz2 $(ISO_ROOT_DIR)/crux/kernel - @cp kernel/linux-$(KERNEL_VERSION).config $(ISO_ROOT_DIR)/crux/kernel + @mkdir -p $(IMG_ROOT_DIR)/crux + @cp doc/handbook/{handbook,releasenotes}.txt $(IMG_ROOT_DIR)/crux + @cp iso/setup.dependencies $(IMG_ROOT_DIR)/crux + @mkdir -p $(IMG_ROOT_DIR)/crux/kernel + @cp kernel/linux-$(KERNEL_VERSION).tar.bz2 $(IMG_ROOT_DIR)/crux/kernel + @cp kernel/linux-$(KERNEL_VERSION).config $(IMG_ROOT_DIR)/crux/kernel @for FILE in $(KERNEL_PATCHES); do \ - cp kernel/$$FILE $(ISO_ROOT_DIR)/crux/kernel; \ + cp kernel/$$FILE $(IMG_ROOT_DIR)/crux/kernel; \ done @for COLL in $(COLLECTIONS); do \ - mkdir -p $(ISO_ROOT_DIR)/crux/$$COLL; \ - cp $(PORTS_DIR)/$$COLL/*/*.pkg.tar.gz $(ISO_ROOT_DIR)/crux/$$COLL; \ + mkdir -p $(IMG_ROOT_DIR)/crux/$$COLL; \ + cp $(PORTS_DIR)/$$COLL/*/*.pkg.tar.gz $(IMG_ROOT_DIR)/crux/$$COLL; \ done - @mkdir -p $(ISO_ROOT_DIR)/tools + @mkdir -p $(IMG_ROOT_DIR)/tools @echo "- Copying unsquashfs binary" - @cp iso/squashfs$(SQUASHFS_VERSION)/squashfs-tools/unsquashfs $(ISO_ROOT_DIR)/tools + @cp iso/squashfs$(SQUASHFS_VERSION)/squashfs-tools/unsquashfs $(IMG_ROOT_DIR)/tools @echo "- Copying squashfs filesystem" - @cp squashfs/crux.squashfs $(ISO_ROOT_DIR) + @cp squashfs/crux.squashfs $(IMG_ROOT_DIR) + @echo $(CRUXVERSION)-$(DATE_STR) > $(IMG_ROOT_DIR)/crux-media + + +##### iso image building ##### +iso: image-base + @echo "Copying ISO specific files" + @mkdir -p $(IMG_ROOT_DIR)/boot/isolinux + @cp iso/syslinux-$(SYSLINUX_VERSION)/core/isolinux.bin $(IMG_ROOT_DIR)/boot/isolinux + @cp iso/isolinux/{isolinux.cfg,*.msg,memtest86plus} \ + $(IMG_ROOT_DIR)/boot/isolinux @echo "- Creating ISO sort table" - @echo "$(ISO_ROOT_DIR)/boot 100" > /tmp/iso.sort - @echo "$(ISO_ROOT_DIR)/boot/isolinux 200" >> /tmp/iso.sort - @echo "$(ISO_ROOT_DIR)/boot/isolinux/isolinux.bin 300" >> /tmp/iso.sort + @echo "$(IMG_ROOT_DIR)/boot 100" > /tmp/iso.sort + @echo "$(IMG_ROOT_DIR)/boot/isolinux 200" >> /tmp/iso.sort + @echo "$(IMG_ROOT_DIR)/boot/isolinux/isolinux.bin 300" >> /tmp/iso.sort @echo "- Starting genisoimage" @if [ -f $(ISO_FILENAME) ]; then rm -f $(ISO_FILENAME); fi @if [ -f $(NETISO_FILENAME) ]; then rm -f $(NETISO_FILENAME); fi @genisoimage -R -l -J -V "CRUX-$(CRUXVERSION)$(CUSTOMVERSION)" -A CRUX \ -b boot/isolinux/isolinux.bin \ -c boot/isolinux/isolinux.boot -no-emul-boot -boot-load-size 4 \ - -boot-info-table -sort /tmp/iso.sort -o "$(ISO_FILENAME)" $(ISO_ROOT_DIR) + -boot-info-table -sort /tmp/iso.sort -o "$(ISO_FILENAME)" $(IMG_ROOT_DIR) @md5sum `basename $(ISO_FILENAME)` > `basename $(ISO_FILENAME) .iso`.md5 - @rm $(ISO_ROOT_DIR)/crux.squashfs - @cp squashfs/crux.squashfs-net $(ISO_ROOT_DIR)/crux.squashfs + @rm $(IMG_ROOT_DIR)/crux.squashfs + @cp squashfs/crux.squashfs-net $(IMG_ROOT_DIR)/crux.squashfs @genisoimage -R -l -J -V "CRUX-NET-$(CRUXVERSION)$(CUSTOMVERSION)" -A CRUX \ -b boot/isolinux/isolinux.bin -c boot/isolinux/isolinux.boot \ -exclude-list iso/excludelist.net -no-emul-boot -boot-load-size 4 \ - -boot-info-table -sort /tmp/iso.sort -o "$(NETISO_FILENAME)" $(ISO_ROOT_DIR) + -boot-info-table -sort /tmp/iso.sort -o "$(NETISO_FILENAME)" $(IMG_ROOT_DIR) @md5sum `basename $(NETISO_FILENAME)` > \ `basename $(NETISO_FILENAME) .iso`.md5 @rm /tmp/iso.sort - @rm -rf $(ISO_ROOT_DIR) @echo "Done" +##### usb/disk image building ##### +image: image-base + ./buildimage.sh tmp/crux-$(CRUX_VERSION)$(CUSTOMVERSION).img $(IMG_ROOT_DIR) + + +images: iso image + source-iso: busybox-source packages.all iso/squashfs$(SQUASHFS_VERSION).tar.gz iso/syslinux-$(SYSLINUX_VERSION).tar.gz @echo "Creating ISO image with sources ($(SRCISO_FILENAME))" diff --git a/buildimage.sh b/buildimage.sh new file mode 100644 index 0000000..225445a --- /dev/null +++ b/buildimage.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# creates an image suitable for writing to a USB stick with dd +# requires dosfstools, syslinux + +# image size in megabytes with a bit of extra room just in case +IMG_SIZE=285 + +IMG=$1 +ISO_ROOT_DIR=$2 + +dd if=/dev/zero of=$IMG bs=1M count=$IMG_SIZE +LO=`losetup -f` +losetup $LO $IMG +fdisk $LO <