diff --git a/Makefile b/Makefile index 36a28e1a..4f60f9e7 100644 --- a/Makefile +++ b/Makefile @@ -28,4 +28,4 @@ all: @echo '** available distribution targets:' @echo $(DISTROS) | fmt -sw65 | column -t -$(DISTROS): %.iso: | profile/init distro/% profile/populate iso +$(DISTROS): %.iso: | profile/init distro/% boot/isolinux profile/populate iso diff --git a/README b/README index f0729f42..953faef6 100644 --- a/README +++ b/README @@ -16,12 +16,22 @@ make distclean server-light.iso Объекты: - дистрибутивы: distro.mk, могут основываться один на другом; желательно избегать множественного наследования, используя - вместо него блоки use-* -- блоки функциональности use-*: не являются самостоятельными - (не путать с дистрибутивами), но законченными -- субпрофили: + вместо него блоки use/* +- субпрофили (список собирается в $(SUBPROFILES)): + + stage1: propagator (ожидается после syslinux) + install2: инсталятор + main: пакетная база к инсталяции (обязательная и дополнительная) + ... +- блоки функциональности use/*: не являются самостоятельными + (не путать с дистрибутивами), но законченными; могут жить + в distro.mk (или сделать use.mk?), либо же в индивидуальных + features.in/*/config.mk, если необходимо дополнить не только + .config.mk, а и дерево формируемого профиля +- фичи: законченные кусочки функциональности, могут зависеть + друг от друга; сливаются с соответствующими субпрофилями + при сборке BUILDROOT, могут нести с собой копируемые в один + или несколько субпрофилей каталоги/файлы и могут выполнять + необходимые действия во время сборки после копирования + (generate.sh, generate.mk). NB: добавляем в $(FEATURES) - списки пакетов: большая человеческая просьба по возможности - избегать дублирования + избегать дублирования и подумать над pkg/lists/tagged... diff --git a/clean.mk b/clean.mk index 2aed2fe4..4efbea13 100644 --- a/clean.mk +++ b/clean.mk @@ -1,5 +1,6 @@ clean: @echo '** cleaning up...' + @find -name '*~' -delete >&/dev/null @[ -d build/ ] && \ $(MAKE) -C build/ $@ GLOBAL_BUILDDIR=$(shell readlink build) \ ||: diff --git a/distro.mk b/distro.mk index e0938030..896b70d8 100644 --- a/distro.mk +++ b/distro.mk @@ -25,28 +25,32 @@ distro/init: @echo "** starting distro configuration build process" @:> $(CONFIG) -distro/base: distro/init sub/stage1 - $(call set,KFLAVOUR,std-def) ### +distro/base: distro/init sub/stage1 use/syslinux/localboot + $(call set,KFLAVOUR,std-def) $(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release) $(call set,BRANDING,altlinux-desktop) ### $(call set,KERNEL_PACKAGES,kernel-image-$$(KFLAVOUR)) -distro/syslinux: distro/base +# bootloader test target +distro/syslinux: distro/base use/syslinux/ui/menu use/syslinux/localboot use/hdt use/memtest boot/isolinux -# NB: our */* are phony targets really, just for namespace -distro/installer: distro/base sub/install2 +distro/installer: distro/base sub/install2 use/syslinux/install2 @#$(call put,BRANDING=altlinux-sisyphus) ### $(call set,BASE_LISTS,base kernel) $(call set,INSTALL2_PACKAGES,installer-distro-server-light-stage2) ### -distro/server-base: distro/installer sub/main use/memtest86 +distro/server-base: distro/installer sub/main use/syslinux/ui/menu use/memtest $(call add,BASE_LISTS,server-base kernel-server) -distro/server-light: distro/server-base use/bootsplash +distro/server-light: distro/server-base use/hdt $(call set,KFLAVOUR,ovz-smp) # override default $(call set,BRANDING,sisyphus-server-light) $(call add,DISK_LISTS,kernel-wifi) $(call add,BASE_LISTS,$(call tags,base server)) -use/bootsplash: - $(call add,COMMON_TAGS,bootsplash) +# FIXME: this belongs to bootsplash feature +#use/bootsplash: +# $(call add,COMMON_TAGS,bootsplash) + +boot/%: + $(call set,BOOTLOADER,$*) diff --git a/features.in/00example/config.mk b/features.in/00example/config.mk new file mode 100644 index 00000000..e69de29b diff --git a/features.in/00example/generate.mk b/features.in/00example/generate.mk new file mode 100644 index 00000000..e69de29b diff --git a/features.in/00example/generate.sh b/features.in/00example/generate.sh new file mode 100644 index 00000000..e69de29b diff --git a/features.in/Makefile b/features.in/Makefile index 4bf8f1fa..21d45123 100644 --- a/features.in/Makefile +++ b/features.in/Makefile @@ -1,17 +1,24 @@ include $(BUILDDIR)/.config.mk -# make rsync backups +SHELL += -x + +# first rsync what's static, and make backups -- +# these might signal of file clashes (or plain dirt); +# then handle two more ways of implementing a feature all: - @for dir in $(FEATURES); do \ + @echo "** starting feature configuration" + @[ -z $(FEATURES) ] || \ + for dir in $(sort $(FEATURES)); do \ for sub in $(SUBPROFILES); do \ - dest=$${sub%stage1}; \ [ -d $$dir/$$sub/ ] && \ - rsync -ab $$dir/$$sub/ $(BUILDDIR)/$$dest/ && \ - cd $(BUILDDIR)/$$dest/ && \ - git add . && \ - git commit -qam "$@/$$dir/$$sub" && \ - cd ->&/dev/null; \ + rsync -ab $$dir/$$sub/ $(BUILDDIR)/$$sub/ && { \ + cd $(BUILDDIR)/$$sub/ && \ + git add . && \ + git commit -qam "$@/$$dir/$$sub" ||:; \ + cd - >&/dev/null; \ + }; \ done; \ + [ -x $$dir/generate.sh ] && { cd $$dir && ./generate.sh; cd -; }; \ + [ -s $$dir/generate.mk ] && $(MAKE) -C $$dir -f generate.mk; \ done - @# these might signal of file clashes (or plain dirt) - @find $(BUILDDIR) -name '*~' + @find $(BUILDDIR) -name '*~' ||: diff --git a/features.in/hdt/config.mk b/features.in/hdt/config.mk new file mode 100644 index 00000000..3ef4cec9 --- /dev/null +++ b/features.in/hdt/config.mk @@ -0,0 +1,8 @@ +# no "Memory" in hdt's menu, weird +use/hdt: use/memtest + $(call add,SYSLINUX_ITEMS,hdt) + @# ITEMS iterator will happily omit a missing file, so... + $(call add,SYSLINUX_FILES,/usr/lib/syslinux/hdt.c32) + @# TODO: modules.pcimap (optional); maybe gzip + $(call add,SYSLINUX_FILES,/usr/share/pci.ids) + diff --git a/features.in/memtest/config.mk b/features.in/memtest/config.mk index 4b8bed64..6453f63f 100644 --- a/features.in/memtest/config.mk +++ b/features.in/memtest/config.mk @@ -1,3 +1,4 @@ -use/memtest86: - $(call put,COMMON_PACKAGES+=memtest86+) - @# configure syslinux/isolinux as well +use/memtest: + $(call add,FEATURES,memtest) + $(call add,COMMON_PACKAGES,memtest86+) + $(call add,SYSLINUX_ITEMS,memtest) diff --git a/features.in/memtest/stage1/scripts.d/02-memtest b/features.in/memtest/stage1/scripts.d/02-memtest new file mode 100755 index 00000000..57c7f104 --- /dev/null +++ b/features.in/memtest/stage1/scripts.d/02-memtest @@ -0,0 +1,7 @@ +#!/bin/sh -x + +mkdir -p "$WORKDIR"/syslinux +MEMTEST="$(find /boot/ -name 'memtest*' -print -quit)" +# hdt recommends adding .bin +[ -z "$MEMTEST" ] || + cp -f "$MEMTEST" "$WORKDIR"/syslinux/memtest.bin diff --git a/features.in/syslinux/cfg.in/00gfxboot.cfg b/features.in/syslinux/cfg.in/00gfxboot.cfg new file mode 100644 index 00000000..5e5826b2 --- /dev/null +++ b/features.in/syslinux/cfg.in/00gfxboot.cfg @@ -0,0 +1,4 @@ +ui gfxboot.com +menu title mkimage-profiles 2.0 ### +prompt 0 +gfxboot bootlogo diff --git a/features.in/syslinux/cfg.in/00menu.cfg b/features.in/syslinux/cfg.in/00menu.cfg new file mode 100644 index 00000000..bb58db88 --- /dev/null +++ b/features.in/syslinux/cfg.in/00menu.cfg @@ -0,0 +1,3 @@ +ui menu.c32 +menu title mkimage-profiles 2.0 ### +prompt 0 diff --git a/features.in/syslinux/cfg.in/00prompt.cfg b/features.in/syslinux/cfg.in/00prompt.cfg new file mode 100644 index 00000000..cdda3b66 --- /dev/null +++ b/features.in/syslinux/cfg.in/00prompt.cfg @@ -0,0 +1,2 @@ +say mkimage-profiles 2.0 ### +prompt 1 diff --git a/features.in/syslinux/cfg.in/01timeout.cfg b/features.in/syslinux/cfg.in/01timeout.cfg new file mode 100644 index 00000000..9d70c68b --- /dev/null +++ b/features.in/syslinux/cfg.in/01timeout.cfg @@ -0,0 +1 @@ +timeout 200 diff --git a/features.in/syslinux/cfg.in/10localboot.cfg b/features.in/syslinux/cfg.in/10localboot.cfg new file mode 100644 index 00000000..ad3d44ec --- /dev/null +++ b/features.in/syslinux/cfg.in/10localboot.cfg @@ -0,0 +1,3 @@ +label harddisk + menu label ^Continue as usual + localboot 0x80 diff --git a/features.in/syslinux/cfg.in/20install2.cfg b/features.in/syslinux/cfg.in/20install2.cfg new file mode 100644 index 00000000..ae0bd209 --- /dev/null +++ b/features.in/syslinux/cfg.in/20install2.cfg @@ -0,0 +1,8 @@ +label linux + menu label ^Normal install + kernel alt0/vmlinuz + append initrd=alt0/full.cz changedisk vga=0x314 quiet=1 showopts automatic=method:cdrom +label noapic + menu label ^FailSafe(TM) install + kernel alt0/vmlinuz + append initrd=alt0/full.cz changedisk vga=0x314 showopts nolapic noapic acpi=off diff --git a/features.in/syslinux/cfg.in/80rescue.cfg b/features.in/syslinux/cfg.in/80rescue.cfg new file mode 100644 index 00000000..ab539c59 --- /dev/null +++ b/features.in/syslinux/cfg.in/80rescue.cfg @@ -0,0 +1,4 @@ +label rescue + menu label ^Rescue + kernel alt0/vmlinuz + append initrd=alt0/full.cz live fastboot stagename=rescue diff --git a/features.in/syslinux/cfg.in/90hdt.cfg b/features.in/syslinux/cfg.in/90hdt.cfg new file mode 100644 index 00000000..1003964b --- /dev/null +++ b/features.in/syslinux/cfg.in/90hdt.cfg @@ -0,0 +1,5 @@ +label hdt + menu label ^Hardware info + com32 hdt.c32 + append pciids=pci.ids + # NB: data can be gzipped (without .gz suffix) diff --git a/features.in/syslinux/cfg.in/90memtest.cfg b/features.in/syslinux/cfg.in/90memtest.cfg new file mode 100644 index 00000000..cd6a6543 --- /dev/null +++ b/features.in/syslinux/cfg.in/90memtest.cfg @@ -0,0 +1,3 @@ +label memtest + menu label ^Memory Test + linux memtest.bin diff --git a/features.in/syslinux/config.mk b/features.in/syslinux/config.mk new file mode 100644 index 00000000..8593a0c4 --- /dev/null +++ b/features.in/syslinux/config.mk @@ -0,0 +1,9 @@ +# UI _does_ automatically enable the feature... +use/syslinux/ui/%: + $(call set,SYSLINUX_UI,$*) + $(call add,FEATURES,syslinux) + $(call add,SYSLINUX_ITEMS,$*) + +# ...and menu items don't +use/syslinux/%: + $(call add,SYSLINUX_ITEMS,$*) diff --git a/features.in/syslinux/generate.mk b/features.in/syslinux/generate.mk new file mode 100644 index 00000000..27883a76 --- /dev/null +++ b/features.in/syslinux/generate.mk @@ -0,0 +1,38 @@ +include $(BUILDDIR)/.config.mk + +ifndef BOOTLOADER +$(warning syslinux feature enabled but BOOTLOADER undefined) +endif + +ifndef SYSLINUX +SYSLINUX = textprompt +endif + +### FIXME: too much insight (ab)used +DSTDIR := $(BUILDDIR)/stage1/files/syslinux +CONFIG := $(DSTDIR)/$(BOOTLOADER).cfg +PARTS := $(SYSLINUX_UI) $(SYSLINUX_ITEMS) $(SUBPROFILES) timeout +MODDIR := /usr/lib/syslinux + +# compile bootloader config from chosen parts +# NB: list position determined by file numbering (*.cfg) +config: debug copy + @cat $(sort $(foreach P,$(PARTS),$(wildcard cfg.in/??$(P).cfg))) /dev/null > $(CONFIG) + +prep: + @mkdir -p $(DSTDIR) + +# copy over the needed syslinux modules (item.c32 or item.com) +# and SYSLINUX_FILES (list of absolute paths) +copy: prep + @$(foreach F, \ + $(SYSLINUX_FILES) $(wildcard $(addprefix $(MODDIR)/,$(addsuffix .c??,$(SYSLINUX_ITEMS)))), \ + $(shell cp -pLt $(DSTDIR) -- $(F))) + +# for p in $PARTS; do ls ??$p.cfg; done | sort +debug: + @echo "** BOOTLOADER: $(BOOTLOADER)" + @echo "** SYSLINUX_UI: $(SYSLINUX_UI)" + @echo "** SYSLINUX_ITEMS: $(SYSLINUX_ITEMS)" + @echo "** PARTS: $(sort $(foreach P,$(PARTS),$(wildcard cfg.in/??$(P).cfg)))" + @echo "** MODULES: $(wildcard $(addprefix $(MODDIR)/,$(addsuffix .c??,$(SYSLINUX_ITEMS))))" diff --git a/image.in/Makefile b/image.in/Makefile index 44f47d31..6ee62bac 100644 --- a/image.in/Makefile +++ b/image.in/Makefile @@ -14,24 +14,24 @@ BOOT_TYPE = isolinux include $(MKIMAGE_PREFIX)/targets.mk -all: prep copy-tree copy-subdirs run-scripts pack-image +all: prep copy-subdirs copy-tree run-scripts pack-image # FIXME: scripts.d/? prep: disk-info metadata @echo "TOPDIR=$(TOPDIR)" disk-info: - mkdir -p files/.disk - echo "FIXME" >files/.disk/info ### +$(ARCH) - (cd $(TOPDIR); git show-ref --head --dereference -s -- HEAD 2>/dev/null) >files/.disk/commit - [ -s files/.disk/commit ] || rm files/.disk/commit + @mkdir -p files/.disk + @echo "FIXME" >files/.disk/info ### +$(ARCH) + @(cd $(TOPDIR); git show-ref --head --dereference -s -- HEAD 2>/dev/null) >files/.disk/commit + @[ -s files/.disk/commit ] || rm files/.disk/commit # see also alterator-pkg (backend3/pkg-install) # FIXME: groups unmerged, and only .base hardwired in metadata: - mkdir -p files/Metadata - rm -f files/Metadata/pkg-groups.tar - tar -cvf files/Metadata/pkg-groups.tar \ + @mkdir -p files/Metadata + @rm -f files/Metadata/pkg-groups.tar + @tar -cvf files/Metadata/pkg-groups.tar \ -C $(PKGDIR) \ $(shell echo $(call list,.base) | sed 's,$(PKGDIR)/*,,g') diff --git a/image.in/files/.gitignore b/image.in/files/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/image.in/files/syslinux/isolinux.cfg b/image.in/files/syslinux/isolinux.cfg deleted file mode 100644 index 9e1ccf5c..00000000 --- a/image.in/files/syslinux/isolinux.cfg +++ /dev/null @@ -1,28 +0,0 @@ -ui menu.c32 -menu title mkimage-profiles 2.0 -prompt 0 -timeout 200 -# f1 help.txt -# f2 version.txt -# ... -default linux - -label harddisk - menu label Continue as usual - localboot 0x80 -# menu default -label linux - menu label Normal install - kernel alt0/vmlinuz - append initrd=alt0/full.cz changedisk vga=0x314 quiet=1 showopts automatic=method:cdrom -label noapic - menu label FailSafe(TM) install - kernel alt0/vmlinuz - append initrd=alt0/full.cz changedisk vga=0x314 showopts nolapic noapic acpi=off -label rescue - menu label Rescue - kernel alt0/vmlinuz - append initrd=alt0/full.cz live fastboot stagename=rescue -label memtest - menu label Memory Test - kernel memtest diff --git a/iso.mk b/iso.mk index 97dcd8c9..77e475f0 100644 --- a/iso.mk +++ b/iso.mk @@ -1,4 +1,6 @@ +# adding boot/isolinux to prereqs is too late here, +# since profile/populate has already finished by now iso: @echo "** starting image build process" - (cd $(BUILDDIR)/; autoconf; ./configure --with-aptconf=$(HOME)/apt/apt.conf) ### + @(cd $(BUILDDIR)/; autoconf; ./configure --with-aptconf=$(HOME)/apt/apt.conf) ### $(MAKE) -C $(BUILDDIR)/ GLOBAL_BUILDDIR=$(BUILDDIR) diff --git a/pkg.in/lists/Makefile b/pkg.in/lists/Makefile index a799384a..16a0daf4 100644 --- a/pkg.in/lists/Makefile +++ b/pkg.in/lists/Makefile @@ -4,13 +4,13 @@ include $(BUILDDIR)/.config.mk # env | sort -u | grep _LISTS | xargs cp -all: prep test +all: prep debug @$(foreach V, \ $(filter %_LISTS,$(sort $(.VARIABLES))), \ $(if $(filter environment% file,$(origin $V)),\ - $(shell cp --parents -avt $(BUILDDIR)/pkg/lists/ \ - -- $(value $V) >> $(BUILDDIR)/log 2>&1))) - @cp -av .base $(BUILDDIR)/pkg/lists/ + $(shell cp --parents -at $(BUILDDIR)/pkg/lists/ \ + -- $(value $V)))) + @cp -a .base $(BUILDDIR)/pkg/lists/ # moving this into 'all' spoils execution order (clobbers results) prep: @@ -19,7 +19,7 @@ prep: # dump *_LISTS variables' values # TODO: consider GLOBAL_VERBOSE? (currently not coming with .config.mk) # (for cp -v then, too) -test: +debug: @$(foreach V, \ $(filter %_LISTS,$(sort $(.VARIABLES))), \ $(if $(filter environment% file,$(origin $V)),\ diff --git a/profile.mk b/profile.mk index 5094ac2a..ad41f785 100644 --- a/profile.mk +++ b/profile.mk @@ -3,14 +3,14 @@ profile/init: @rsync -qaH --delete image.in/ "$(BUILDDIR)"/ @touch "$(BUILDDIR)"/.config.mk @mkdir "$(BUILDDIR)"/.mki - cd $(BUILDDIR); git init ### + cd $(BUILDDIR); git init -q; git add .; git commit -qam 'init' ### @rm -f build @[ -w . ] \ && ln -sf "$(BUILDDIR)" build \ || echo "** profile directory readonly: skipping symlinks, env only" profile/populate: profile/init - for dir in sub.in features.in pkg.in; do \ + @for dir in sub.in features.in pkg.in; do \ $(MAKE) -C $$dir; \ done diff --git a/sub.in/Makefile b/sub.in/Makefile index 97098a47..df12dc0b 100644 --- a/sub.in/Makefile +++ b/sub.in/Makefile @@ -6,8 +6,8 @@ all: cd $(BUILDDIR)/$$dir/ && \ git add . && \ git commit -qam "$@/$$dir"; \ - cd ->&/dev/null; \ - done + cd - >&/dev/null; \ + done ||: clean: @for dir in $(SUBPROFILES); do \ diff --git a/sub.in/main/Makefile b/sub.in/main/Makefile index c932fe5c..e5938ba3 100644 --- a/sub.in/main/Makefile +++ b/sub.in/main/Makefile @@ -1,4 +1,4 @@ -### installation package base (requisite + optional) +# installation package base (requisite + optional) default: all diff --git a/sub.in/stage1/Makefile b/sub.in/stage1/Makefile index 50013b02..dde93dc8 100644 --- a/sub.in/stage1/Makefile +++ b/sub.in/stage1/Makefile @@ -3,15 +3,16 @@ include ../functions.mk include $(MKIMAGE_PREFIX)/config.mk include $(GLOBAL_BUILDDIR)/.config.mk -CHROOT_PACKAGES = syslinux $(KERNEL_PACKAGES) +CHROOT_PACKAGES = syslinux $(KERNEL_PACKAGES) $(COMMON_PACKAGES) -### MKI_PACK_RESULTS = data +### PROPAGATOR_VERSION = mkimage-profiles 2.0 PROPAGATOR_MAR_MODULES = ./modules PROPAGATOR_INITFS = ./initfs +COPY_TREE = ./files include $(MKIMAGE_PREFIX)/targets.mk -all: build-propagator copy-isolinux run-scripts pack-image +all: build-propagator copy-tree copy-isolinux run-scripts pack-image diff --git a/sub.in/stage1/files/.gitignore b/sub.in/stage1/files/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/sub.in/stage1/scripts.d/01-initfs b/sub.in/stage1/scripts.d/01-initfs index a06f851f..6c4a1365 100644 --- a/sub.in/stage1/scripts.d/01-initfs +++ b/sub.in/stage1/scripts.d/01-initfs @@ -1,6 +1,6 @@ #!/bin/sh echo "file /.VERSION @TMPDIR@/.VERSION 0644 0 0" >"$WORKDIR"/initfs -### FIXME: broken test, we already do branding +# FIXME: broken test, we already do branding [ -z "$(BRANDING)" ] || \ echo "file /bootsplash /bootsplash/bootsplash 0644 0 0" >>"$WORKDIR"/initfs diff --git a/sub.in/stage1/scripts.d/02-txtboot b/sub.in/stage1/scripts.d/02-txtboot deleted file mode 100755 index 3607fb91..00000000 --- a/sub.in/stage1/scripts.d/02-txtboot +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -install -pDm644 /usr/lib/syslinux/menu.c32 "$WORKDIR"/syslinux/menu.c32