assorted fixups

- more thorough build stages inline doc
- quieter BUILDDIR instantiation
- branding-altlinux-sisyphus by default
- prettify installer selection somewhat
- mkimage #24669 fixed upstream
- sub.in/stage1/modules: +drm (as in m-p-d, for KMS)
- tags2lists: generalize a bit
This commit is contained in:
Michael Shigorin 2010-12-03 16:53:02 +02:00
parent 16e763e9ea
commit ace5cb0ff6
18 changed files with 71 additions and 61 deletions

View File

@ -1,8 +1,11 @@
# steps to build a distribution image:
# --- here
# 1. configure distro
# 2. configure subprofiles, prepare package lists/groups and hooks
# 1. initialize new profile (BUILDDIR) as a copy of image.in/
# 2. configure distro
# 3. copy subprofiles, package lists/groups and script hooks
# from metaprofile to new profile (as needed)
# --- in BUILDDIR
# 3. build subprofiles and subsequently image
# 4. build subprofiles and subsequently image
all help:
@echo '** available distribution targets:'
@ -16,7 +19,8 @@ include iso.mk
# this could have come from environment;
# if not, can be symlinked if r/w, or made anew (NB: immediate assignment)
ifndef BUILDDIR
BUILDDIR := $(shell realpath build || bin/mktmpdir mkimage-profiles.build)
PREFIX := mkimage-profiles.build
BUILDDIR := $(shell [ -s build ] && realpath build || bin/mktmpdir $(PREFIX))
endif
ifdef DEBUG

3
README
View File

@ -15,8 +15,9 @@ configurables: ~/.mkimage/metaconf.mk, see distro.mk
- в профиль копируются только нужные объекты
Стадии работы:
- инициализация дистрибутивного профиля
- сборка конфигурации дистрибутива
- порождение дистрибутивного профиля
- наполнение дистрибутивного профиля
- сборка дистрибутива
Объекты:

View File

@ -10,7 +10,7 @@
# NB: tags are processed using word boundaries,
# so avoid using "-" in tag names
DIR="${1:-pkg.in/lists/tagged}"
DIR="${1:?need base directory}"
warn() {
echo "$0: WARNING: $*" >&2
@ -20,11 +20,13 @@ warn() {
[ -d "$DIR" ] || warn "$DIR nonexistent"
cd "$DIR" || warn "cannot change to $DIR"
find $(sed \
-e "s,\([^&|! ()']\+\),-regex ^.*\\\\<\1\\\\>.*$,g" \
-e "s, *&& *, -a ,g" \
-e "s, *|| *, -o ,g" \
-e "s, *! *, ! ,g" \
-e "s, *( *, ( ,g" \
-e "s, *) *, ) ,g" \
) | sed 's,^\./,,'
# NB: care with quoting
transformed="$(sed \
-e "s,\([^&|! ()']\+\),-regex ^.*\\\\<\1\\\\>.*$,g" \
-e "s, *&& *, -a ,g" \
-e "s, *|| *, -o ,g" \
-e "s, *! *, ! ,g" \
-e "s, *( *, ( ,g" \
-e "s, *) *, ) ,g")"
[ -z "$transformed" ] || find $transformed | sed 's,^\./,,'

View File

@ -1,4 +1,4 @@
# build up distribution's configuration
# step 2: build up distribution's configuration
#
# NB: distro/ targets should be defined here,
# see toplevel Makefile's $(DISTRO) assignment
@ -34,14 +34,15 @@ distro/.init:
# the kernel packages regexp evaluation has to take place at build stage
distro/.base: distro/.init sub/stage1 use/syslinux use/syslinux/localboot.cfg
@$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release)
@$(call set,BRANDING,altlinux-desktop) ###
@$(call set,BRANDING,altlinux-sisyphus)
@$(call set,KFLAVOURS,std-def)
@$(call set,KMODULES,drm)
distro/installer: distro/.base sub/install2 use/syslinux/install2.cfg
@#$(call put,BRANDING=altlinux-sisyphus) ###
@$(call set,INSTALLER,server-light)
@$(call set,INSTALL2_PACKAGES,installer-distro-$$(INSTALLER)-stage2)
@$(call add,INSTALL2_PACKAGES,branding-$$(BRANDING)-alterator)
@$(call add,MAIN_PACKAGES,branding-$$(BRANDING)-release)
@$(call set,BASE_LISTS,base)
@$(call set,INSTALL2_PACKAGES,installer-distro-server-light-stage2) ###
distro/server-base: distro/installer sub/main use/syslinux/ui-menu use/memtest
@$(call add,BASE_LISTS,server-base)
@ -59,7 +60,6 @@ distro/server-light: distro/server-base use/hdt
distro/minicd: distro/server-base
@$(call set,KFLAVOURS,un-def) # we might need the most recent drivers (NB: std-ng lacks aufs2)
@$(call add,MAIN_PACKAGES,etcnet-full)
@$(call set,BRANDING,sisyphus-server-light)
# bootloader test target
distro/syslinux: distro/.base use/syslinux/ui-gfxboot use/hdt use/memtest

View File

@ -1,3 +1,6 @@
# step 3: copy the needed features to $(BUILDDIR)
# (only regarding the needed subprofiles)
-include $(BUILDDIR)/.config.mk
# first rsync what's static, and make backups --

View File

@ -41,4 +41,4 @@ define log_body
endef
# convert tag list into a list of relative package list paths
tags = $(addprefix tagged/,$(shell echo "$(1)" | bin/tags2lists))
tags = $(and $(strip $(1)),$(addprefix tagged/,$(shell echo "$(1)" | bin/tags2lists pkg.in/lists/tagged)))

View File

@ -1,3 +1,7 @@
# step 4: build image (final stage)
#
# NB: this metaprofile directory forms the initial BUILDDIR/
include functions.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(GLOBAL_BUILDDIR)/.config.mk
@ -23,16 +27,19 @@ include $(MKIMAGE_PREFIX)/targets.mk
all: prep copy-subdirs copy-tree run-scripts pack-image
# FIXME: scripts.d/?
prep: debug disk-info metadata
prep: debug dot-disk metadata
debug:
ifdef DEBUG
@echo "TOPDIR=$(TOPDIR)"
@echo "ARCH=$(ARCH)"
@echo "GLOBAL_HSH_APT_CONFIG=$(GLOBAL_HSH_APT_CONFIG)"
endif
disk-info:
dot-disk:
@mkdir -p files/.disk
@echo "FIXME" >files/.disk/info ### +$(ARCH)
@echo "ALT Linux based" >files/.disk/info
@echo "$(ARCH)" >files/.disk/arch
@type -t git >&/dev/null && ( \
cd $(TOPDIR) && \
git show-ref --head --dereference -s -- HEAD 2>/dev/null; \
@ -43,10 +50,8 @@ disk-info:
metadata:
@mkdir -p files/Metadata
@rm -f files/Metadata/pkg-groups.tar
# FIXME: KERNEL_PACKAGES deprecated, this is broken now! -- or not?..
@echo "DEBUG: image.in/Makefile" >&2
@echo -e "\n# auto-added in image.in/Makefile\n$(call kpackages)" >> $(call list,.base)
tar -cvf files/Metadata/pkg-groups.tar \
@echo "branding-$(BRANDING)-release" >> $(call list,.base)
@tar -cvf files/Metadata/pkg-groups.tar \
-C $(PKGDIR) \
$$(echo $(call list,.base) $(call list,$(GROUPS)) $(call group,$(GROUPS)) | sed 's,$(PKGDIR)/*,,g')

4
iso.mk
View File

@ -1,5 +1,7 @@
# step 4 is kicked off here but actually done by image.in/Makefile
#
# adding boot/isolinux to prereqs is too late here,
# since profile/populate has already finished by now
# since profile/populate target is already done by now
#
# NB: /usr/bin/{i586,x86_64} are setarch(8) symlinks

View File

@ -1,3 +1,6 @@
# step 3: copy package lists and groups referenced in distro configuration
# (and only those!) over to $(BUILDDIR)
all:
for dir in lists groups; do \
$(MAKE) -C $$dir BUILDDIR=$(BUILDDIR); \

View File

@ -1,5 +1,5 @@
# copy package lists referenced in distro configuration
# over to build dir
# step 3: copy package groups referenced in distro configuration
# (and only those!) over to $(BUILDDIR)
include $(BUILDDIR)/.config.mk

View File

@ -1,16 +1,17 @@
# copy package lists referenced in distro configuration
# over to build dir
# step 3: copy package lists referenced in distro configuration
# (and only those!) over to $(BUILDDIR)
include $(BUILDDIR)/.config.mk
TARGET := $(BUILDDIR)/pkg/lists/
# env | sort -u | grep _LISTS | xargs cp
all: prep debug
@$(foreach V, \
$(filter %_LISTS,$(sort $(.VARIABLES))), \
$(if $(filter environment% file,$(origin $V)),\
$(shell cp --parents -at $(BUILDDIR)/pkg/lists/ \
$(shell cp --parents -at $(TARGET) \
-- $(value $V))))
@cp -a .base $(GROUPS) $(BUILDDIR)/pkg/lists/
@cp -a .base $(GROUPS) $(TARGET)
# moving this into 'all' spoils execution order (clobbers results)
prep:

View File

@ -1,3 +1,4 @@
# step 1: initialize the off-tree mkimage profile
profile/init:
@echo "** BUILDDIR: $(BUILDDIR)"
@rsync -qaH --delete image.in/ "$(BUILDDIR)"/
@ -15,6 +16,7 @@ profile/init:
echo "** profile directory readonly: skipping symlinks, env only"; \
fi
# this is done after step 2, see toplevel Makefile
profile/populate: profile/init distro/.metaconf
@for dir in sub.in features.in pkg.in; do \
$(MAKE) -C $$dir; \

View File

@ -1,3 +1,5 @@
# step 3: copy the needed subprofiles to $(BUILDDIR)
include $(BUILDDIR)/.config.mk
all:

View File

@ -1,15 +1,12 @@
# step 4: build install2 subprofile (installer "live" part)
default: all
include $(GLOBAL_BUILDDIR)/.config.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
# FIXME: hardwired
#IMAGE_PACKAGES_REGEXP = $(call kimage)
# NB: due to #24669, IMAGE_PACKAGES_REGEXP does need quoting here
IMAGE_PACKAGES_REGEXP = "$(call kpackages)"
#IMAGE_PACKAGES_REGEXP = "$(KERNEL_PACKAGES_REGEXP)"
#IMAGE_PACKAGES_REGEXP = ^kernel-image-(std-def|el-smp)$$
IMAGE_PACKAGES_REGEXP = $(call kpackages)
IMAGE_PACKAGES = $(COMMON_PACKAGES) \
$(INSTALL2_PACKAGES) \
./packages

View File

@ -1,4 +1,4 @@
# installation package base (requisite + optional)
# step 4: build main subprofile (requisite + optional packages for media)
default: all
@ -7,21 +7,11 @@ include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
CHROOT_PACKAGES = apt-utils rsync
PACKAGES_EXPAND_METHOD=regexp
# FIXME: hardwired
#IMAGE_PACKAGES_REGEXP = "$(KERNEL_PACKAGES_REGEXP)"
# NB: due to #24669, IMAGE_PACKAGES_REGEXP does need quoting here
IMAGE_PACKAGES_REGEXP = "$(call kpackages)"
#IMAGE_PACKAGES_REGEXP = $(call kimage) $(call kmodules)
#IMAGE_PACKAGES_REGEXP = ^kernel-image-(std-def|el-smp)$$ ^kernel-modules-(ipset|kvm|ndiswrapper|pf_ring|xtables-addons)-(el-smp|ovz-smp)$$
# TODO: map() list() onto these
IMAGE_PACKAGES = $(call list,.base) \
IMAGE_PACKAGES_REGEXP = $(call kpackages)
IMAGE_PACKAGES = $(call map,list,.base $(BASE_LISTS) $(DISK_LISTS) $(GROUPS)) \
$(COMMON_PACKAGES) \
$(MAIN_PACKAGES) \
$(call list,$(BASE_LISTS)) \
$(call list,$(DISK_LISTS)) \
$(call list,$(GROUPS))
$(MAIN_PACKAGES)
MKI_DESTDIR = ALTLinux/RPMS.main
MKI_PACK_RESULTS = data

View File

@ -1,13 +1,10 @@
# step 4: build stage1 subprofile (installer bootstrap)
include $(GLOBAL_BUILDDIR)/.config.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
# FIXME: hardwired
#CHROOT_PACKAGES_REGEXP = $(call kimage)
# NB: see #24669, CHROOT_PACKAGES_REGEXP does NOT need quoting here
CHROOT_PACKAGES_REGEXP = $(call kpackages)
#CHROOT_PACKAGES_REGEXP = "$(KERNEL_PACKAGES_REGEXP)"
#CHROOT_PACKAGES_REGEXP = ^kernel-image-(std-def|el-smp)$$ ^kernel-modules-(ipset|kvm|ndiswrapper|pf_ring|xtables-addons)-(el-smp|ovz-smp)$$
CHROOT_PACKAGES = $(STAGE1_PACKAGES) $(COMMON_PACKAGES)
MKI_PACK_RESULTS = data

View File

@ -1,5 +1,6 @@
kernel/drivers/ata
kernel/drivers/block
kernel/drivers/gpu/drm
kernel/drivers/hid
kernel/drivers/md
kernel/drivers/net/\([^w]\|w[^i]\).\+\.ko

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
[ -z "$(BRANDING)" ] || \
[ -z "$BRANDING" ] || \
echo "file /bootsplash /bootsplash/bootsplash 0644 0 0" >>"$WORKDIR"/initfs