2007-10-14 18:14:33 +02:00
|
|
|
#
|
|
|
|
# Makefile for CRUX
|
|
|
|
# Copyright (c) 2003-2005 Per Liden <per@fukt.bth.se>
|
|
|
|
#
|
|
|
|
|
2016-11-17 21:44:02 +01:00
|
|
|
CRUXVERSION = 3.3
|
2014-04-27 21:50:43 +02:00
|
|
|
CUSTOMVERSION =
|
2008-05-07 22:06:21 +02:00
|
|
|
COLLECTIONS = core opt xorg
|
2017-02-11 19:13:46 +01:00
|
|
|
KERNEL_MIRROR = https://cdn.kernel.org
|
2018-01-21 00:21:12 +01:00
|
|
|
KERNEL_VERSION = 4.14.14
|
2014-10-18 19:25:34 +02:00
|
|
|
KERNEL_PATCHES =
|
2017-02-11 19:13:46 +01:00
|
|
|
BB_VERSION = 1.25.1
|
2015-07-28 17:54:47 +02:00
|
|
|
MEMTEST_VERSION = 5.01
|
2015-09-29 20:26:25 +02:00
|
|
|
SYSLINUX_VERSION = 6.03
|
2010-06-29 18:26:11 +02:00
|
|
|
PKG_EXT = pkg.tar.xz
|
|
|
|
PKGMK_CONF = $(PWD)/pkgmk.conf
|
2008-05-08 09:58:09 +02:00
|
|
|
PORTS_DIR = $(PWD)/ports
|
2007-10-14 18:14:33 +02:00
|
|
|
FAKE_ROOT_DIR = $(PWD)/tmp/fake_root
|
2012-10-04 17:09:54 +02:00
|
|
|
ROOTFS_DIR = $(PWD)/tmp/rootfs
|
2009-05-27 17:15:32 +02:00
|
|
|
DATE_STR = $(shell date +'%Y%m%d')
|
2010-04-21 22:30:09 +02:00
|
|
|
IMG_ROOT_DIR = $(PWD)/tmp/img_root
|
2008-12-19 22:23:59 +01:00
|
|
|
SRCISO_ROOT_DIR = $(PWD)/tmp/srciso_root
|
2009-05-27 17:15:32 +02:00
|
|
|
ISO_FILENAME = $(PWD)/crux-$(CRUXVERSION)$(CUSTOMVERSION).iso
|
|
|
|
SRCISO_FILENAME = $(PWD)/crux-$(CRUXVERSION)$(CUSTOMVERSION)-source.iso
|
2015-07-28 17:54:47 +02:00
|
|
|
ISO_PACKAGES = filesystem bash dash coreutils bzip2 e2fsprogs jfsutils \
|
2007-10-14 18:14:33 +02:00
|
|
|
xfsprogs reiserfsprogs patch findutils glibc grep gzip kbd \
|
2014-02-25 05:05:41 +01:00
|
|
|
kmod less gawk ncurses inetutils pkgutils \
|
2008-09-22 17:08:44 +02:00
|
|
|
procps readline sed shadow sysklogd sysvinit tar \
|
2012-08-03 16:51:15 +02:00
|
|
|
util-linux vim which dialog nano mdadm pciutils libusb libusb-compat \
|
2014-02-25 05:05:41 +01:00
|
|
|
sysfsutils usbutils eudev zlib openssl openssh \
|
2010-06-11 12:11:06 +02:00
|
|
|
dhcpcd wget iproute2 libpcre iputils libgmp libdevmapper lvm2 \
|
2015-09-29 20:26:25 +02:00
|
|
|
attr acl libcap btrfs-progs lzo parted xz \
|
2015-10-20 15:17:58 +02:00
|
|
|
efibootmgr efivar gnu-efi libmpfr dosfstools \
|
2017-02-11 19:13:46 +01:00
|
|
|
libgcrypt libgpg-error popt cryptsetup start-stop-daemon \
|
2018-01-21 00:21:12 +01:00
|
|
|
linux-firmware wpa_supplicant dbus libnl wireless-tools file \
|
|
|
|
elfutils
|
2007-10-14 18:14:33 +02:00
|
|
|
|
2008-05-08 09:58:09 +02:00
|
|
|
PORTS_core = $(shell /bin/ls -I README $(PORTS_DIR)/core)
|
2007-10-26 13:42:13 +02:00
|
|
|
PORTS_opt = $(shell /bin/cat packages.opt)
|
2007-09-10 08:44:18 +02:00
|
|
|
PORTS_xorg = $(shell /bin/cat packages.xorg)
|
2007-10-14 18:14:33 +02:00
|
|
|
|
|
|
|
ifeq ($(FORCE),yes)
|
|
|
|
PKGMK_FORCE=-f
|
|
|
|
else
|
|
|
|
PKGMK_FORCE=
|
|
|
|
endif
|
|
|
|
|
2010-04-21 22:30:09 +02:00
|
|
|
ifeq ($(DOWNLOAD),yes)
|
|
|
|
PKGMK_DOWNLOAD=-do
|
|
|
|
else
|
|
|
|
PKGMK_DOWNLOAD=-d
|
|
|
|
endif
|
|
|
|
|
2010-09-17 22:04:55 +02:00
|
|
|
.PHONY: help check-root check-log $(COLLECTIONS) all all-chroot bootstrap \
|
2015-07-28 17:54:47 +02:00
|
|
|
initramfs kernel-clean clean iso \
|
2015-09-29 20:26:25 +02:00
|
|
|
busybox-clean initramfs-clean memtest-clean syslinux-clean \
|
2014-02-25 22:45:39 +01:00
|
|
|
grub2-efi grub2-efi-clean grub2-efi-distclean
|
2007-10-14 18:14:33 +02:00
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "CRUX Makefile"
|
|
|
|
@echo "Targets:"
|
|
|
|
@echo " <collection> build single collection"
|
|
|
|
@echo " all build all collections"
|
|
|
|
@echo " bootstrap bootstrap all collections"
|
|
|
|
@echo " kernel download and build kernel"
|
|
|
|
@echo " iso create iso image"
|
|
|
|
@echo "Collections:"
|
|
|
|
@echo " $(COLLECTIONS)"
|
|
|
|
|
|
|
|
check-root:
|
2015-06-16 01:30:31 +02:00
|
|
|
@if [ "$(shell id -u)" != "0" ]; then \
|
2007-10-14 18:14:33 +02:00
|
|
|
echo "You need to be root to do this."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
check-log:
|
|
|
|
@grep "^=======> ERROR:"; \
|
|
|
|
if [ "$$?" = "0" ]; then \
|
|
|
|
echo "(see log file for details)"; \
|
|
|
|
exit 1; \
|
|
|
|
else \
|
|
|
|
exit 0; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# kernel
|
2012-12-11 00:11:09 +01:00
|
|
|
kernel/linux-$(KERNEL_VERSION).tar.xz:
|
2015-06-26 22:41:25 +02:00
|
|
|
cd kernel && wget $(KERNEL_MIRROR)/pub/linux/kernel/v4.x/linux-$(KERNEL_VERSION).tar.xz
|
2007-10-14 18:14:33 +02:00
|
|
|
|
2012-12-11 00:11:09 +01:00
|
|
|
kernel/linux-$(KERNEL_VERSION): kernel/linux-$(KERNEL_VERSION).tar.xz
|
|
|
|
tar -C kernel -xJmf kernel/linux-$(KERNEL_VERSION).tar.xz
|
2007-10-14 18:14:33 +02:00
|
|
|
for FILE in $(KERNEL_PATCHES); do \
|
|
|
|
(cd kernel/linux-$(KERNEL_VERSION) && patch -p1 -i ../$$FILE;) \
|
|
|
|
done
|
2010-09-09 01:18:32 +02:00
|
|
|
sed -i -e 's,\($$(Q)echo "$$(KERNELVERSION)\)$$$$($$(CONFIG_SHELL).*" >,\1" >,' kernel/linux-$(KERNEL_VERSION)/Makefile
|
2007-10-14 18:14:33 +02:00
|
|
|
|
2012-08-05 16:23:04 +02:00
|
|
|
kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage: kernel/linux-$(KERNEL_VERSION).config | kernel/linux-$(KERNEL_VERSION)
|
2007-10-14 18:14:33 +02:00
|
|
|
make -C kernel/linux-$(KERNEL_VERSION) mrproper
|
|
|
|
cp -f kernel/linux-$(KERNEL_VERSION).config kernel/linux-$(KERNEL_VERSION)/.config
|
|
|
|
make -C kernel/linux-$(KERNEL_VERSION) oldconfig
|
2017-11-24 21:45:24 +01:00
|
|
|
make -j$(shell nproc) -C kernel/linux-$(KERNEL_VERSION) all
|
2007-10-14 18:14:33 +02:00
|
|
|
|
2010-04-23 21:31:42 +02:00
|
|
|
kernel: kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage
|
2007-10-14 18:14:33 +02:00
|
|
|
|
|
|
|
kernel-clean:
|
|
|
|
rm -rf kernel/linux-$(KERNEL_VERSION)
|
|
|
|
|
|
|
|
kernel-distclean: kernel-clean
|
2012-12-11 00:11:09 +01:00
|
|
|
rm -f kernel/linux-$(KERNEL_VERSION).tar.xz
|
2007-10-14 18:14:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# busybox
|
2008-12-19 21:19:06 +01:00
|
|
|
busybox/busybox-$(BB_VERSION).tar.bz2:
|
|
|
|
@cd busybox && wget http://busybox.net/downloads/busybox-$(BB_VERSION).tar.bz2
|
|
|
|
|
2009-05-28 23:45:40 +02:00
|
|
|
busybox/busybox-$(BB_VERSION): busybox/busybox-$(BB_VERSION).tar.bz2
|
|
|
|
@tar -C busybox -xjmf busybox/busybox-$(BB_VERSION).tar.bz2
|
|
|
|
|
|
|
|
busybox/busybox: busybox/busybox-$(BB_VERSION)
|
|
|
|
@cp -f busybox/busybox-$(BB_VERSION).config busybox/busybox-$(BB_VERSION)/.config
|
|
|
|
@make -C busybox/busybox-$(BB_VERSION) oldconfig
|
|
|
|
@make -C busybox/busybox-$(BB_VERSION)
|
|
|
|
@cp busybox/busybox-$(BB_VERSION)/busybox busybox/busybox
|
2007-10-14 18:14:33 +02:00
|
|
|
|
|
|
|
busybox: busybox/busybox
|
|
|
|
|
2008-12-19 21:19:06 +01:00
|
|
|
busybox-source: busybox/busybox-$(BB_VERSION).tar.bz2
|
|
|
|
|
2007-10-14 18:14:33 +02:00
|
|
|
busybox-clean:
|
2009-05-28 23:45:40 +02:00
|
|
|
rm -rf busybox/busybox-$(BB_VERSION) busybox/busybox
|
|
|
|
|
|
|
|
busybox-distclean: busybox-clean
|
2008-12-19 21:19:06 +01:00
|
|
|
rm -f busybox/busybox-$(BB_VERSION).tar.bz2
|
2007-10-14 18:14:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-11 22:42:24 +01:00
|
|
|
# grub2-efi
|
2014-10-18 19:43:31 +02:00
|
|
|
grub2-efi: /usr/bin/grub-mkimage
|
2015-03-04 01:25:24 +01:00
|
|
|
mkdir -p iso/EFI
|
2014-10-18 19:43:31 +02:00
|
|
|
/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
|
|
|
|
/usr/bin/grub-mkimage -c iso/grub-early.cfg -o iso/EFI/bootia32.efi -O i386-efi -p "" iso9660 normal search search_fs_file
|
2014-01-11 22:42:24 +01:00
|
|
|
|
|
|
|
iso/efiboot.img: grub2-efi
|
2014-04-27 21:50:43 +02:00
|
|
|
dd if=/dev/zero of=iso/efiboot.img count=4096
|
2014-01-11 22:42:24 +01:00
|
|
|
mkdosfs -n CRUX-EFI iso/efiboot.img
|
|
|
|
mkdir -p iso/efiboot
|
|
|
|
mount -o loop iso/efiboot.img iso/efiboot
|
2014-04-27 21:50:43 +02:00
|
|
|
mkdir -p iso/efiboot/EFI/boot
|
2014-10-18 19:43:31 +02:00
|
|
|
cp iso/EFI/bootx64.efi iso/efiboot/EFI/boot/
|
|
|
|
cp iso/EFI/bootia32.efi iso/efiboot/EFI/boot/
|
2014-01-11 22:42:24 +01:00
|
|
|
umount iso/efiboot
|
|
|
|
|
|
|
|
grub2-efi-clean:
|
2014-10-18 19:43:31 +02:00
|
|
|
rm -f iso/EFI/*.efi
|
2014-02-25 22:45:39 +01:00
|
|
|
rm -rf iso/efiboot iso/efiboot.img
|
2014-01-11 22:42:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-17 22:04:55 +02:00
|
|
|
# memtest86+
|
|
|
|
iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin.gz:
|
|
|
|
cd iso/isolinux && wget http://www.memtest.org/download/$(MEMTEST_VERSION)/memtest86+-$(MEMTEST_VERSION).bin.gz
|
|
|
|
|
|
|
|
iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin: iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin.gz
|
|
|
|
zcat iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin.gz > iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin
|
|
|
|
|
|
|
|
memtest: iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin
|
|
|
|
|
|
|
|
memtest-clean:
|
|
|
|
rm -f iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin
|
|
|
|
|
|
|
|
memtest-distclean: memtest-clean
|
|
|
|
rm -f iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin.gz
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-29 20:26:25 +02:00
|
|
|
# syslinux
|
|
|
|
iso/syslinux-$(SYSLINUX_VERSION).tar.xz:
|
|
|
|
cd iso && wget https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-$(SYSLINUX_VERSION).tar.xz
|
|
|
|
|
|
|
|
iso/syslinux-$(SYSLINUX_VERSION): iso/syslinux-$(SYSLINUX_VERSION).tar.xz
|
|
|
|
tar -C iso -Jxf iso/syslinux-$(SYSLINUX_VERSION).tar.xz
|
|
|
|
|
|
|
|
iso/syslinux-$(SYSLINUX_VERSION)/bios/core/isolinux.bin: iso/syslinux-$(SYSLINUX_VERSION)
|
|
|
|
|
|
|
|
syslinux: iso/syslinux-$(SYSLINUX_VERSION)/bios/core/isolinux.bin
|
|
|
|
|
|
|
|
syslinux-clean:
|
|
|
|
rm -rf iso/syslinux-$(SYSLINUX_VERSION)
|
|
|
|
|
|
|
|
syslinux-distclean: syslinux-clean
|
|
|
|
rm -f iso/syslinux-$(SYSLINUX_VERSION).tar.xz
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-24 21:45:24 +01:00
|
|
|
clean: kernel-clean busybox-clean initramfs-clean grub2-efi-clean rootfs-clean
|
2012-08-05 16:23:04 +02:00
|
|
|
@rm -rf tmp modules_install.log $(ISO_FILENAME) \
|
|
|
|
`basename $(ISO_FILENAME) .iso`.md5
|
2007-10-14 18:14:33 +02:00
|
|
|
|
2015-07-28 17:54:47 +02:00
|
|
|
distclean: clean kernel-distclean setup.dependencies-clean
|
2007-10-14 18:14:33 +02:00
|
|
|
|
|
|
|
$(COLLECTIONS): check-root
|
|
|
|
@for p in $(PORTS_$(@)); do \
|
2015-09-25 17:34:32 +02:00
|
|
|
if [ "$$p" != "COPYING" -a "$$p" != "COPYRIGHT" ]; then \
|
|
|
|
echo "port: $$p"; \
|
|
|
|
(cd $(PORTS_DIR)/$@/$$p && pkgmk -cf $(PKGMK_CONF) $(PKGMK_DOWNLOAD) $(PKGMK_FORCE)); \
|
|
|
|
fi; \
|
2007-10-14 18:14:33 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
all: $(COLLECTIONS)
|
|
|
|
|
|
|
|
all-chroot: check-root
|
|
|
|
@echo "Creating chroot environment"
|
|
|
|
@rm -rf $(FAKE_ROOT_DIR)
|
|
|
|
@mkdir -p $(FAKE_ROOT_DIR)
|
|
|
|
@echo "Installing packages"
|
|
|
|
@mkdir -p $(FAKE_ROOT_DIR)/var/lib/pkg
|
|
|
|
@touch $(FAKE_ROOT_DIR)/var/lib/pkg/db
|
|
|
|
@for COLL in $(COLLECTIONS); do \
|
2010-06-26 09:53:54 +02:00
|
|
|
for PACKAGE in $(PORTS_DIR)/$$COLL/*/*.$(PKG_EXT); do \
|
2007-10-14 18:14:33 +02:00
|
|
|
echo " $$PACKAGE"; \
|
|
|
|
pkgadd -r $(FAKE_ROOT_DIR) $$PACKAGE; \
|
|
|
|
done; \
|
|
|
|
done
|
|
|
|
@echo "Installing kernel source (linux-$(KERNEL_VERSION)) into $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION)..."
|
|
|
|
@mkdir -p $(FAKE_ROOT_DIR)/usr/src
|
2012-12-11 00:11:09 +01:00
|
|
|
@tar Jxf kernel/linux-$(KERNEL_VERSION).tar.xz -C $(FAKE_ROOT_DIR)/usr/src/
|
2007-10-14 18:14:33 +02:00
|
|
|
@for FILE in $(KERNEL_PATCHES); do \
|
|
|
|
cp kernel/$$FILE $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION)/; \
|
|
|
|
(cd $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION) && \
|
|
|
|
patch -p1 -i $$FILE); \
|
|
|
|
done
|
|
|
|
@cp kernel/linux-$(KERNEL_VERSION).config $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION)/.config
|
|
|
|
@echo "Preparing kernel source..."
|
|
|
|
@(cd $(FAKE_ROOT_DIR)/usr/src/linux-$(KERNEL_VERSION) && \
|
|
|
|
make oldconfig && make)
|
|
|
|
@mkdir -p $(FAKE_ROOT_DIR)/lib/modules/$(KERNEL_VERSION)
|
|
|
|
@ln -s /usr/src/linux-$(KERNEL_VERSION) $(FAKE_ROOT_DIR)/lib/modules/$(KERNEL_VERSION)/build
|
|
|
|
@cp -L /etc/resolv.conf $(FAKE_ROOT_DIR)/etc/
|
2010-06-26 16:01:42 +02:00
|
|
|
@cp -L $(PKGMK_CONF) $(FAKE_ROOT_DIR)/etc/
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "Mounting /dev on $(FAKE_ROOT_DIR)/dev"
|
|
|
|
@mount --bind /dev $(FAKE_ROOT_DIR)/dev
|
|
|
|
@echo "Mounting /proc on $(FAKE_ROOT_DIR)/proc"
|
|
|
|
@mount --bind /proc $(FAKE_ROOT_DIR)/proc
|
|
|
|
@echo "Mounting $$PWD on $(FAKE_ROOT_DIR)/src"
|
|
|
|
@mkdir $(FAKE_ROOT_DIR)/src
|
|
|
|
@mount --bind $$PWD $(FAKE_ROOT_DIR)/src
|
|
|
|
@echo "Entering chroot enrivonment"
|
|
|
|
@chroot $(FAKE_ROOT_DIR) /bin/bash --login -c "cd /src && $(MAKE) FORCE=yes all"
|
|
|
|
@echo "Exiting chroot enrivonment"
|
|
|
|
@echo "Unmounting $(FAKE_ROOT_DIR)/src"
|
|
|
|
@umount $(FAKE_ROOT_DIR)/src
|
2007-11-27 09:54:06 +01:00
|
|
|
@rmdir $(FAKE_ROOT_DIR)/src
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "Unmounting $(FAKE_ROOT_DIR)/proc"
|
|
|
|
@umount $(FAKE_ROOT_DIR)/proc
|
|
|
|
@echo "Unmounting $(FAKE_ROOT_DIR)/dev"
|
|
|
|
@umount $(FAKE_ROOT_DIR)/dev
|
2007-11-27 09:54:06 +01:00
|
|
|
@echo "Removing chroot environment"
|
|
|
|
@rm -rf $(FAKE_ROOT_DIR)
|
2007-10-14 18:14:33 +02:00
|
|
|
|
2014-05-13 17:57:40 +02:00
|
|
|
bootstrap: check-root kernel
|
2017-11-24 21:45:24 +01:00
|
|
|
$(shell $(PWD)/hacks.sh)
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "Bootstrap started (`date +'%F %T'`)"
|
|
|
|
@echo "- Stage 0 (`date +'%F %T'`)"
|
2015-06-16 01:30:31 +02:00
|
|
|
@$(MAKE) all > log.stage0 2>&1
|
2007-10-14 18:14:33 +02:00
|
|
|
@$(MAKE) check-log < log.stage0
|
|
|
|
@echo "- Stage 1 (`date +'%F %T'`)"
|
2015-06-16 01:30:31 +02:00
|
|
|
@$(MAKE) all-chroot > log.stage1 2>&1
|
2007-10-14 18:14:33 +02:00
|
|
|
@$(MAKE) check-log < log.stage1
|
|
|
|
@echo "- Stage 2 (`date +'%F %T'`)"
|
2015-06-16 01:30:31 +02:00
|
|
|
@$(MAKE) all-chroot > log.stage2 2>&1
|
2007-10-14 18:14:33 +02:00
|
|
|
@$(MAKE) check-log < log.stage2
|
|
|
|
@echo "Bootstrap completed (`date +'%F %T'`)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# initramfs
|
2012-10-04 17:09:54 +02:00
|
|
|
initramfs: kernel busybox initramfs/init | rootfs
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "Creating initramfs..."
|
|
|
|
@sed -e "s/#KERNEL_VERSION#/$(KERNEL_VERSION)/g" initramfs/initramfs.lst \
|
|
|
|
> initramfs/initramfs.lst-sed
|
|
|
|
@cd initramfs && ../kernel/linux-$(KERNEL_VERSION)/usr/gen_init_cpio \
|
|
|
|
initramfs.lst-sed > initramfs
|
|
|
|
|
|
|
|
initramfs-clean:
|
|
|
|
if [ -e initramfs/initramfs.lst-sed ]; then rm -f initramfs/initramfs.lst-sed; fi
|
|
|
|
if [ -e initramfs/initramfs ]; then rm -f initramfs/initramfs; fi
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-04 17:09:54 +02:00
|
|
|
# rootfs.tar.xz
|
|
|
|
rootfs: kernel busybox
|
|
|
|
@echo "Creating rootfs..."
|
|
|
|
@rm -rf $(ROOTFS_DIR)
|
|
|
|
@mkdir -p $(ROOTFS_DIR)
|
|
|
|
@echo "- Installing packages..."
|
2007-10-14 18:14:33 +02:00
|
|
|
@for PACKAGE in $(ISO_PACKAGES); do \
|
2012-10-04 17:09:54 +02:00
|
|
|
bsdtar -C $(ROOTFS_DIR) -xpf $(PORTS_DIR)/*/$$PACKAGE/$$PACKAGE\#*.$(PKG_EXT); \
|
2007-10-14 18:14:33 +02:00
|
|
|
done
|
2017-02-11 19:13:46 +01:00
|
|
|
@sed -i -e 's/^#PermitRootLogin.*/PermitRootLogin yes/' \
|
2012-10-04 17:09:54 +02:00
|
|
|
$(ROOTFS_DIR)/etc/ssh/sshd_config
|
|
|
|
@echo "- Installing kernel and modules..."
|
|
|
|
@cp kernel/linux-$(KERNEL_VERSION)/System.map $(ROOTFS_DIR)/boot/System.map
|
|
|
|
@cp kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage $(ROOTFS_DIR)/boot/vmlinuz
|
2015-06-16 01:30:31 +02:00
|
|
|
@make -C kernel/linux-$(KERNEL_VERSION) INSTALL_MOD_PATH=$(ROOTFS_DIR) modules_install > modules_install.log 2>&1
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "- Deleting superfluous files..."
|
2012-10-04 17:09:54 +02:00
|
|
|
@cd $(ROOTFS_DIR) && rm -rf var opt home
|
|
|
|
@mkdir -p $(ROOTFS_DIR)/var/empty $(ROOTFS_DIR)/var/lib
|
|
|
|
@cd $(ROOTFS_DIR)/usr && rm -rf man include lib/*.a lib/*.o lib/gconv lib/locale src
|
|
|
|
@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
|
|
|
|
@cd $(ROOTFS_DIR)/usr/share && rm -rf et ss vim i18n zoneinfo
|
|
|
|
@cd $(ROOTFS_DIR)/usr/bin && rm cal locale localedef rpcgen compile_et mk_cmds
|
2015-06-16 01:30:31 +02:00
|
|
|
@cd $(ROOTFS_DIR)/usr/sbin && rm groupadd groupdel groupmod useradd userdel usermod grpck pwck iconvconfig
|
|
|
|
@cd $(ROOTFS_DIR)/etc && rm -rf cron resolv.conf lilo.conf sysctl.conf pkgadd.conf pkgmk.conf securetty
|
2012-10-04 17:09:54 +02:00
|
|
|
@cd $(ROOTFS_DIR)/etc/rc.d && find . -type f ! -name "sshd" -exec rm -f '{}' \;
|
2015-06-16 01:30:31 +02:00
|
|
|
@rm $(ROOTFS_DIR)/lib/modules/$(KERNEL_VERSION)/build
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "- Creating symlinks"
|
2012-10-04 17:09:54 +02:00
|
|
|
@ln -sf /tmp/var $(ROOTFS_DIR)/var
|
|
|
|
@ln -sf /proc/mounts $(ROOTFS_DIR)/etc/mtab
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "- Updating library links and cache"
|
2012-10-04 17:09:54 +02:00
|
|
|
@ldconfig -r $(ROOTFS_DIR)
|
|
|
|
@echo "- Copying iso/ files..."
|
2015-06-16 01:30:31 +02:00
|
|
|
@for F in motd fstab hosts inittab issue ld.so.conf protocols rc rc.shutdown rc.single services shadow; do \
|
|
|
|
cp iso/etc/$$F $(ROOTFS_DIR)/etc; \
|
|
|
|
done
|
|
|
|
@for F in setup setup-helper setup-chroot serial_console; do \
|
|
|
|
cp iso/bin/$$F $(ROOTFS_DIR)/usr/bin; \
|
|
|
|
done
|
2012-10-04 17:09:54 +02:00
|
|
|
@echo "- Compressing (rootfs.tar.xz)..."
|
|
|
|
@mkdir -p rootfs
|
|
|
|
@(cd $(ROOTFS_DIR) && tar -Jcf ../../rootfs/rootfs.tar.xz . 2>/dev/null)
|
|
|
|
|
|
|
|
rootfs-clean:
|
|
|
|
@rm -rf rootfs
|
2016-06-20 02:56:30 +02:00
|
|
|
|
2007-10-14 18:14:33 +02:00
|
|
|
|
2008-09-25 22:55:28 +02:00
|
|
|
# setup.dependencies
|
2008-11-01 10:12:30 +01:00
|
|
|
iso/setup.dependencies: packages.opt packages.xorg
|
2008-10-17 21:09:28 +02:00
|
|
|
@echo "Creating iso/setup.dependencies ..."
|
2008-09-25 22:55:28 +02:00
|
|
|
@for PORT in $(foreach c,$(COLLECTIONS),$(PORTS_$(c))); do \
|
2015-07-28 17:54:47 +02:00
|
|
|
if [ "$$PORT" != "COPYING" -a "$$PORT" != "COPYRIGHT" ]; then \
|
|
|
|
echo -n $$PORT": "; \
|
|
|
|
prt-get \
|
|
|
|
--no-std-config \
|
|
|
|
$(foreach c,$(COLLECTIONS),--config-append="prtdir $(PORTS_DIR)/$(c)") \
|
|
|
|
quickdep $$PORT; \
|
|
|
|
fi; \
|
2008-09-25 22:55:28 +02:00
|
|
|
done > $@
|
2016-06-20 02:56:30 +02:00
|
|
|
|
2008-10-24 23:11:41 +02:00
|
|
|
setup.dependencies: iso/setup.dependencies packages.all check-deps
|
2008-09-25 22:55:28 +02:00
|
|
|
|
|
|
|
setup.dependencies-clean:
|
|
|
|
@rm iso/setup.dependencies
|
2008-10-24 23:11:41 +02:00
|
|
|
@rm packages.all
|
2008-10-17 21:09:28 +02:00
|
|
|
|
2016-06-20 02:56:30 +02:00
|
|
|
# Write a file with all packages we provide on the iso
|
2008-11-01 10:12:30 +01:00
|
|
|
packages.all: packages.opt packages.xorg
|
2008-10-24 23:11:41 +02:00
|
|
|
@echo "Writing file packages.all ..."
|
2008-10-17 21:09:28 +02:00
|
|
|
@for PORT in $(foreach c,$(COLLECTIONS),$(PORTS_$(c))); do \
|
2015-07-28 17:54:47 +02:00
|
|
|
if [ "$$PORT" != "COPYING" -a "$$PORT" != "COPYRIGHT" ]; then \
|
|
|
|
echo $$PORT; \
|
|
|
|
fi; \
|
2008-10-24 23:11:41 +02:00
|
|
|
done | sort > $@
|
2008-10-17 21:09:28 +02:00
|
|
|
|
|
|
|
# here we check if we have a dep, listed in a Pkgfile, which we do not provide on the iso
|
2008-10-24 23:11:41 +02:00
|
|
|
check-deps: packages.all iso/setup.dependencies
|
|
|
|
@echo "Check for missing dependencies ..."
|
2008-10-17 21:09:28 +02:00
|
|
|
@gawk ' \
|
2008-10-24 23:11:41 +02:00
|
|
|
BEGIN { while ((getline p < "packages.all") > 0) { pkgs[p] }} \
|
2008-10-17 21:09:28 +02:00
|
|
|
{ for (p=2; p<=NF; p++) { if ( ! ($$p in pkgs)) { printf(" * %s %s\n", $$1, $$p) }}} \
|
|
|
|
' iso/setup.dependencies
|
|
|
|
|
2011-11-14 20:10:30 +01:00
|
|
|
# check for duplicate, missing and orphan packages in the ports tree
|
2008-10-24 23:15:50 +02:00
|
|
|
check-portstree: packages.all
|
|
|
|
@cd $(PORTS_DIR) && ./checkportstree
|
|
|
|
|
2008-09-25 22:55:28 +02:00
|
|
|
|
2010-04-21 22:30:09 +02:00
|
|
|
##### image building #####
|
2015-07-28 17:54:47 +02:00
|
|
|
image-base: check-root kernel initramfs rootfs setup.dependencies iso/efiboot.img
|
2010-04-21 22:30:09 +02:00
|
|
|
@echo "Creating installation image base"
|
|
|
|
@if [ -e $(IMG_ROOT_DIR) ]; then rm -rf $(IMG_ROOT_DIR); fi
|
|
|
|
@mkdir -p $(IMG_ROOT_DIR)/boot
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "- Installing kernel"
|
2010-04-21 22:30:09 +02:00
|
|
|
@cp kernel/linux-$(KERNEL_VERSION)/System.map $(IMG_ROOT_DIR)/boot/System.map
|
2010-04-23 21:31:42 +02:00
|
|
|
@cp kernel/linux-$(KERNEL_VERSION)/arch/x86/boot/bzImage $(IMG_ROOT_DIR)/boot/vmlinuz
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "- Installing initramfs"
|
2010-04-21 22:30:09 +02:00
|
|
|
@cp initramfs/initramfs $(IMG_ROOT_DIR)/boot/initramfs
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "- Copying CRUX packages"
|
2010-04-21 22:30:09 +02:00
|
|
|
@mkdir -p $(IMG_ROOT_DIR)/crux
|
2015-06-16 01:30:31 +02:00
|
|
|
@cp doc/handbook/handbook.txt doc/handbook/releasenotes.txt $(IMG_ROOT_DIR)/crux
|
2010-04-21 22:30:09 +02:00
|
|
|
@cp iso/setup.dependencies $(IMG_ROOT_DIR)/crux
|
|
|
|
@mkdir -p $(IMG_ROOT_DIR)/crux/kernel
|
2012-12-11 00:11:09 +01:00
|
|
|
@cp kernel/linux-$(KERNEL_VERSION).tar.xz $(IMG_ROOT_DIR)/crux/kernel
|
2010-04-21 22:30:09 +02:00
|
|
|
@cp kernel/linux-$(KERNEL_VERSION).config $(IMG_ROOT_DIR)/crux/kernel
|
2013-11-14 15:13:46 +01:00
|
|
|
@cp kernel/linux-$(KERNEL_VERSION).defconfig $(IMG_ROOT_DIR)/crux/kernel
|
2007-10-14 18:14:33 +02:00
|
|
|
@for FILE in $(KERNEL_PATCHES); do \
|
2010-04-21 22:30:09 +02:00
|
|
|
cp kernel/$$FILE $(IMG_ROOT_DIR)/crux/kernel; \
|
2007-10-14 18:14:33 +02:00
|
|
|
done
|
|
|
|
@for COLL in $(COLLECTIONS); do \
|
2010-04-21 22:30:09 +02:00
|
|
|
mkdir -p $(IMG_ROOT_DIR)/crux/$$COLL; \
|
2010-06-26 09:53:54 +02:00
|
|
|
cp $(PORTS_DIR)/$$COLL/*/*.$(PKG_EXT) $(IMG_ROOT_DIR)/crux/$$COLL; \
|
2007-10-14 18:14:33 +02:00
|
|
|
done
|
2010-04-21 22:30:09 +02:00
|
|
|
@mkdir -p $(IMG_ROOT_DIR)/tools
|
2010-06-26 23:10:33 +02:00
|
|
|
@echo "- Creating a gzip compressed pkgutils package in /tools"
|
|
|
|
@cp $(IMG_ROOT_DIR)/crux/core/pkgutils*.$(PKG_EXT) $(IMG_ROOT_DIR)/tools
|
|
|
|
@xz -d $(IMG_ROOT_DIR)/tools/pkgutils*.$(PKG_EXT)
|
2010-06-26 22:04:27 +02:00
|
|
|
@gzip $(IMG_ROOT_DIR)/tools/pkgutils*.tar
|
2012-10-04 17:09:54 +02:00
|
|
|
@echo "- Copying rootfs.tar.xz"
|
|
|
|
@cp rootfs/rootfs.tar.xz $(IMG_ROOT_DIR)
|
2010-04-21 22:30:09 +02:00
|
|
|
@echo $(CRUXVERSION)-$(DATE_STR) > $(IMG_ROOT_DIR)/crux-media
|
|
|
|
|
|
|
|
|
|
|
|
##### iso image building #####
|
2015-09-29 20:26:25 +02:00
|
|
|
iso: image-base memtest syslinux
|
2010-04-21 22:30:09 +02:00
|
|
|
@echo "Copying ISO specific files"
|
|
|
|
@mkdir -p $(IMG_ROOT_DIR)/boot/isolinux
|
2015-09-29 20:26:25 +02:00
|
|
|
@cp iso/syslinux-$(SYSLINUX_VERSION)/bios/core/isolinux.bin $(IMG_ROOT_DIR)/boot/isolinux/
|
|
|
|
@cp iso/syslinux-$(SYSLINUX_VERSION)/bios/com32/elflink/ldlinux/ldlinux.c32 $(IMG_ROOT_DIR)/boot/isolinux/
|
|
|
|
@for F in hdt/hdt.c32 libutil/libutil.c32 gpllib/libgpl.c32 lib/libcom32.c32 cmenu/libmenu/libmenu.c32; do \
|
|
|
|
cp iso/syslinux-$(SYSLINUX_VERSION)/bios/com32/$$F $(IMG_ROOT_DIR)/boot/isolinux/; \
|
2015-07-28 17:54:47 +02:00
|
|
|
done
|
|
|
|
@cp /usr/share/pci.ids $(IMG_ROOT_DIR)/boot/isolinux/
|
2015-06-16 01:30:31 +02:00
|
|
|
@cp iso/isolinux/isolinux.cfg iso/isolinux/*.msg \
|
2010-04-21 22:30:09 +02:00
|
|
|
$(IMG_ROOT_DIR)/boot/isolinux
|
2010-09-17 22:04:55 +02:00
|
|
|
@cp iso/isolinux/memtest86+-$(MEMTEST_VERSION).bin $(IMG_ROOT_DIR)/boot/isolinux/memtest86plus
|
2014-01-11 22:42:24 +01:00
|
|
|
@cp iso/efiboot.img $(IMG_ROOT_DIR)/boot/
|
2015-06-16 01:30:31 +02:00
|
|
|
@mkdir -p $(IMG_ROOT_DIR)/boot/grub/x86_64-efi $(IMG_ROOT_DIR)/boot/grub/i386-efi
|
|
|
|
@cp -a /usr/lib/grub/x86_64-efi/*.mod /usr/lib/grub/x86_64-efi/*.lst $(IMG_ROOT_DIR)/boot/grub/x86_64-efi/
|
|
|
|
@cp -a /usr/lib/grub/i386-efi/*.mod /usr/lib/grub/i386-efi/*.lst $(IMG_ROOT_DIR)/boot/grub/i386-efi/
|
2014-01-11 22:42:24 +01:00
|
|
|
@cp iso/grub.cfg $(IMG_ROOT_DIR)/boot/grub/
|
2007-10-14 18:14:33 +02:00
|
|
|
@echo "- Creating ISO sort table"
|
2010-04-21 22:30:09 +02:00
|
|
|
@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
|
2008-10-17 14:59:42 +02:00
|
|
|
@echo "- Starting genisoimage"
|
2007-10-14 18:14:33 +02:00
|
|
|
@if [ -f $(ISO_FILENAME) ]; then rm -f $(ISO_FILENAME); fi
|
2009-05-27 17:15:32 +02:00
|
|
|
@genisoimage -R -l -J -V "CRUX-$(CRUXVERSION)$(CUSTOMVERSION)" -A CRUX \
|
|
|
|
-b boot/isolinux/isolinux.bin \
|
2007-10-14 18:14:33 +02:00
|
|
|
-c boot/isolinux/isolinux.boot -no-emul-boot -boot-load-size 4 \
|
2014-01-11 22:42:24 +01:00
|
|
|
-boot-info-table \
|
|
|
|
-eltorito-alt-boot -e boot/efiboot.img -no-emul-boot \
|
2017-02-11 19:13:46 +01:00
|
|
|
-sort /tmp/iso.sort -input-charset utf-8 -o "$(ISO_FILENAME)" $(IMG_ROOT_DIR)
|
2015-09-25 17:34:32 +02:00
|
|
|
@isohybrid -u $(ISO_FILENAME)
|
2007-10-14 18:14:33 +02:00
|
|
|
@md5sum `basename $(ISO_FILENAME)` > `basename $(ISO_FILENAME) .iso`.md5
|
|
|
|
@rm /tmp/iso.sort
|
2014-07-01 21:26:30 +02:00
|
|
|
@echo "Done: $(shell date)"
|
2007-10-14 18:14:33 +02:00
|
|
|
|
2007-10-26 13:53:07 +02:00
|
|
|
|
2015-07-28 17:54:47 +02:00
|
|
|
source-iso: busybox-source packages.all kernel/linux-$(KERNEL_VERSION).tar.xz
|
2008-12-19 22:23:59 +01:00
|
|
|
@echo "Creating ISO image with sources ($(SRCISO_FILENAME))"
|
|
|
|
@rm -rf $(SRCISO_ROOT_DIR)
|
2015-06-16 01:30:31 +02:00
|
|
|
@mkdir -p $(SRCISO_ROOT_DIR)/ports $(SRCISO_ROOT_DIR)/kernel $(SRCISO_ROOT_DIR)/misc
|
2008-12-19 22:23:59 +01:00
|
|
|
@echo "- Copying ports"
|
|
|
|
@for PORT in $(shell /bin/cat packages.all); do \
|
|
|
|
find $(PORTS_DIR) -mindepth 2 -maxdepth 2 -name $$PORT -type d -exec cp -r {} $(SRCISO_ROOT_DIR)/ports \; ; \
|
2015-06-16 01:30:31 +02:00
|
|
|
rm -f $(SRCISO_ROOT_DIR)/ports/$$PORT/.footprint \
|
|
|
|
$(SRCISO_ROOT_DIR)/ports/$$PORT/.md5sum \
|
|
|
|
$(SRCISO_ROOT_DIR)/ports/$$PORT/*.$(PKG_EXT); \
|
2008-12-19 22:23:59 +01:00
|
|
|
done
|
|
|
|
@echo "- Copying misc sources"
|
|
|
|
@cp busybox/busybox-$(BB_VERSION).tar.bz2 $(SRCISO_ROOT_DIR)/misc
|
|
|
|
@echo "- Copying kernel and patches"
|
2012-12-11 00:11:09 +01:00
|
|
|
@cp kernel/linux-$(KERNEL_VERSION).tar.xz $(SRCISO_ROOT_DIR)/kernel
|
2008-12-19 22:23:59 +01:00
|
|
|
@for PATCH in $(KERNEL_PATCHES); do cp kernel/$$PATCH $(SRCISO_ROOT_DIR)/kernel; done
|
|
|
|
@echo "- Creating README"
|
|
|
|
@echo "This ISO image contains sources for the packages, kernel and utilities" > $(SRCISO_ROOT_DIR)/README
|
|
|
|
@echo "supplied with/used in CRUX $(CRUXVERSION)." >> $(SRCISO_ROOT_DIR)/README
|
|
|
|
@echo "- Starting genisoimage"
|
|
|
|
@genisoimage -R -l -J -V CRUX-$(CRUXVERSION) -A CRUX -o $(SRCISO_FILENAME) $(SRCISO_ROOT_DIR)
|
|
|
|
@md5sum `basename $(SRCISO_FILENAME)` > `basename $(SRCISO_FILENAME) .iso`.md5
|
|
|
|
|
2007-10-14 18:14:33 +02:00
|
|
|
# End of file
|