features' day

- get rid of $dest
- work on features.in/syslinux
- README++
This commit is contained in:
Michael Shigorin 2010-09-14 13:18:53 +03:00
parent 4cb23d7ccd
commit c8b578dd9a
34 changed files with 172 additions and 81 deletions

View File

@ -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

20
README
View File

@ -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...

View File

@ -1,5 +1,6 @@
clean:
@echo '** cleaning up...'
@find -name '*~' -delete >&/dev/null
@[ -d build/ ] && \
$(MAKE) -C build/ $@ GLOBAL_BUILDDIR=$(shell readlink build) \
||:

View File

@ -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,$*)

View File

View File

View File

View File

@ -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/ && \
rsync -ab $$dir/$$sub/ $(BUILDDIR)/$$sub/ && { \
cd $(BUILDDIR)/$$sub/ && \
git add . && \
git commit -qam "$@/$$dir/$$sub" && \
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 '*~' ||:

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -0,0 +1,4 @@
ui gfxboot.com
menu title mkimage-profiles 2.0 ###
prompt 0
gfxboot bootlogo

View File

@ -0,0 +1,3 @@
ui menu.c32
menu title mkimage-profiles 2.0 ###
prompt 0

View File

@ -0,0 +1,2 @@
say mkimage-profiles 2.0 ###
prompt 1

View File

@ -0,0 +1 @@
timeout 200

View File

@ -0,0 +1,3 @@
label harddisk
menu label ^Continue as usual
localboot 0x80

View File

@ -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

View File

@ -0,0 +1,4 @@
label rescue
menu label ^Rescue
kernel alt0/vmlinuz
append initrd=alt0/full.cz live fastboot stagename=rescue

View File

@ -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)

View File

@ -0,0 +1,3 @@
label memtest
menu label ^Memory Test
linux memtest.bin

View File

@ -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,$*)

View File

@ -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))))"

View File

@ -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')

0
image.in/files/.gitignore vendored Normal file
View File

View File

@ -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

4
iso.mk
View File

@ -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)

View File

@ -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)),\

View File

@ -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

View File

@ -7,7 +7,7 @@ all:
git add . && \
git commit -qam "$@/$$dir"; \
cd - >&/dev/null; \
done
done ||:
clean:
@for dir in $(SUBPROFILES); do \

View File

@ -1,4 +1,4 @@
### installation package base (requisite + optional)
# installation package base (requisite + optional)
default: all

View File

@ -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

0
sub.in/stage1/files/.gitignore vendored Normal file
View File

View File

@ -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

View File

@ -1,2 +0,0 @@
#!/bin/sh
install -pDm644 /usr/lib/syslinux/menu.c32 "$WORKDIR"/syslinux/menu.c32