Commit a9e161b4 authored by Michael Shigorin's avatar Michael Shigorin

gfxboot brought to reasonable shape

Also included: - reworked syslinux feature inclusion - syslinux: s/textprompt/prompt/ - README++
parent 30bb8137
# 1. configure distro
# 2. configure subprofiles, prepare package lists
# 2. configure subprofiles, prepare package lists/groups and hooks
# 3. build subprofiles
# 4. build image
......@@ -9,7 +9,7 @@ include profile.mk
include iso.mk
# this could have come from environment;
# if not, can be symlinked if r/w, or made anew
# 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)
endif
......
......@@ -33,5 +33,6 @@ make distclean server-light.iso
или несколько субпрофилей каталоги/файлы и могут выполнять
необходимые действия во время сборки после копирования
(generate.sh, generate.mk). NB: добавляем в $(FEATURES)
(из того же config.mk, который будет включён в distro.mk)
- списки пакетов: большая человеческая просьба по возможности
избегать дублирования и подумать над pkg/lists/tagged...
......@@ -19,41 +19,38 @@ include functions.mk
# request particular image subprofile inclusion
sub/%:
$(call add,SUBPROFILES,$(@:sub/%=%))
@$(call add,SUBPROFILES,$(@:sub/%=%))
distro/init:
@echo "** starting distro configuration build process"
@:> $(CONFIG)
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/base: distro/init sub/stage1 use/syslinux/localboot.cfg
@$(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))
# bootloader test target
distro/syslinux: distro/base use/syslinux/ui/menu use/syslinux/localboot use/hdt use/memtest boot/isolinux
distro/installer: distro/base sub/install2 use/syslinux/install2
distro/installer: distro/base sub/install2 use/syslinux/install2.cfg
@#$(call put,BRANDING=altlinux-sisyphus) ###
$(call set,BASE_LISTS,base kernel)
$(call set,INSTALL2_PACKAGES,installer-distro-server-light-stage2) ###
@$(call set,BASE_LISTS,base kernel)
@$(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 kernel-server)
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/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))
$(call add,GROUPS,dns-server http-server ftp-server kvm-server)
$(call add,GROUPS,ipmi mysql-server dhcp-server mail-server)
$(call add,GROUPS,monitoring diag-tools)
# FIXME: this belongs to bootsplash feature
#use/bootsplash:
# $(call add,COMMON_TAGS,bootsplash)
boot/%:
$(call set,BOOTLOADER,$*)
@$(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))
@$(call add,GROUPS,dns-server http-server ftp-server kvm-server)
@$(call add,GROUPS,ipmi mysql-server dhcp-server mail-server)
@$(call add,GROUPS,monitoring diag-tools)
# bootloader test target
distro/syslinux: distro/base use/syslinux/ui-gfxboot \
use/hdt use/memtest boot/isolinux
boot/%: distro/init
@$(call set,BOOTLOADER,$*)
include $(BUILDDIR)/.config.mk
SHELL += -x
-include $(BUILDDIR)/.config.mk
# 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:
@echo "** starting feature configuration"
@[ -z $(FEATURES) ] || \
@[ -z "$(FEATURES)" ] || \
for dir in $(sort $(FEATURES)); do \
for sub in $(SUBPROFILES); do \
[ -d $$dir/$$sub/ ] && \
rsync -ab $$dir/$$sub/ $(BUILDDIR)/$$sub/ && { \
type -t git >&/dev/null && \
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
@find $(BUILDDIR) -name '*~' ||:
help:
@echo "** available features:"
@grep '^use/*' */config.mk | cut -f2 -d:
# 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)
@$(call add,SYSLINUX_MODULES,hdt)
@$(call add,SYSLINUX_FILES,/usr/share/pci.ids)
#!/bin/sh
gzip -9 "$WORKDIR"/syslinux/pci.ids ||:
use/memtest:
$(call add,FEATURES,memtest)
$(call add,COMMON_PACKAGES,memtest86+)
$(call add,SYSLINUX_ITEMS,memtest)
@$(call add,FEATURES,memtest)
@$(call add,COMMON_PACKAGES,memtest86+)
@$(call add,SYSLINUX_ITEMS,memtest)
#!/bin/sh -x
#!/bin/sh
mkdir -p "$WORKDIR"/syslinux
MEMTEST="$(find /boot/ -name 'memtest*' -print -quit)"
# hdt recommends adding .bin
# hdt wiki recommends adding .bin
[ -z "$MEMTEST" ] ||
cp -f "$MEMTEST" "$WORKDIR"/syslinux/memtest.bin
ui gfxboot.com
menu title mkimage-profiles 2.0 ###
ui gfxboot bootlogo
menu title mkimage-profiles 2.0
prompt 0
gfxboot bootlogo
ui menu.c32
menu title mkimage-profiles 2.0 ###
menu title mkimage-profiles 2.0
prompt 0
say mkimage-profiles 2.0 ###
say mkimage-profiles 2.0
prompt 1
# UI _does_ automatically enable the feature...
use/syslinux/ui/%:
$(call set,SYSLINUX_UI,$*)
$(call add,FEATURES,syslinux)
$(call add,SYSLINUX_ITEMS,$*)
# UI is overwritten and _does_ automatically enable the feature...
use/syslinux/ui-%:
@$(call add,FEATURES,syslinux)
@$(call set,SYSLINUX_UI,$*)
@$(call add,STAGE1_PACKAGES,syslinux)
if [ "$*" == gfxboot ]; then \
$(call add,STAGE1_PACKAGES,gfxboot); \
$(call add,STAGE1_PACKAGES,branding-$$(BRANDING)-bootloader); \
fi
# ...and menu items don't
use/syslinux/%:
$(call add,SYSLINUX_ITEMS,$*)
# ...while plain modules...
use/syslinux/%.com use/syslinux/%.c32:
@$(call add,SYSLINUX_MODULES,$*)
# ...and menu items don't autoenable it (but stack up themselves)
use/syslinux/%.cfg:
@$(call add,SYSLINUX_CFG,$*)
......@@ -4,35 +4,53 @@ ifndef BOOTLOADER
$(warning syslinux feature enabled but BOOTLOADER undefined)
endif
ifndef SYSLINUX
SYSLINUX = textprompt
ifndef SYSLINUX_UI
$(warning no syslinux ui module configured, falling back to plain text prompt)
SYSLINUX_UI := prompt
endif
### FIXME: too much insight (ab)used
# UI is backed by modules in modern syslinux
# (except for built-in text prompt)
SYSLINUX_MODULES := $(SYSLINUX_MODULES) $(SYSLINUX_UI)
# SUBPROFILES are considered SYSLINUX_CFG too;
# 01defaults.cfg is included indefinitely
SYSLINUX_CFG := $(SYSLINUX_CFG) $(SUBPROFILES) defaults
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)
# we can do SYSLINUX_{CFG,MODULES,FILES}
# CFG have only cfg snippet
# FILES have only filenames (absolute or relative to /usr/lib/syslinux/)
# MODULES must have both cfg snippet and syslinux module filename
# (and get included iff cfg snippet AND module exist)
prep:
@mkdir -p $(DSTDIR)
# syslinux modules come as .com and .c32 files
sysmod = $(wildcard $(addprefix $(MODDIR)/,$(addsuffix .c??,$(1))))
cfg = $(wildcard cfg.in/??$(1).cfg)
# 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)))
# NB: list position determined by file numbering (*.cfg sorting)
all: prep debug
cat $(sort \
$(foreach C,$(SYSLINUX_CFG),$(call cfg,$(C))) \
$(foreach M,$(SYSLINUX_MODULES), \
$(shell cp -pLt $(DSTDIR) -- $(call sysmod,$(M)) && echo $(call cfg,$(M))))) \
/dev/null > $(CONFIG)
[ -z "$(SYSLINUX_FILES)" ] || { \
cd $(MODDIR); \
cp -pLt $(DSTDIR) -- $(SYSLINUX_FILES); \
}
# cat's argument gets evaluated before recipe body execution
prep:
mkdir -p $(DSTDIR)
# for p in $PARTS; do ls ??$p.cfg; done | sort
# for p in $...; 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))))"
@echo "** SYSLINUX_CFG: $(SYSLINUX_CFG)"
@echo "** SYSLINUX_FILES: $(SYSLINUX_FILES)"
@echo "** SYSLINUX_MODULES: $(SYSLINUX_MODULES)"
#!/bin/sh
gfxboot_datadir=/usr/share/gfxboot
bootlogo="`ls $gfxboot_datadir/*/bootlogo | head -1`" ###
if [ ! -f "$bootlogo" ]; then
echo "${0##*/} - SKIP: $bootlogo not found"
ls -alR $gfxboot_datadir
exit 0
fi
cd "$WORKDIR"
mkdir -p syslinux
cd syslinux
# unpack
cpio -iduV <"$bootlogo"
# pack
printf 'init\nlanguages\n' |
cpio -oV >bootlogo
# NB: don"t use ANY quotes ('/") for put()/add()/set() arguments!
# shell will get confused by ' or args get spammed with "
# pay attention to the context in which functions get called:
# e.g. features.in/syslinux/config.mk introduces conditionals
# this one adds whatever is given as an argument
put = $(and $(1),$(put_body))
define put_body
$(log_body)
@printf '%s\n' '$(1)' >> "$(CONFIG)"
{ $(log_body); \
printf '%s\n' '$(1)' >> "$(CONFIG)"; }
endef
# these two take two args
# add() just appends an additive rule...
add = $(and $(1),$(2),$(add_body))
define add_body
$(log_body)
@printf '%s += %s\n' '$(1)' '$(2)' >> "$(CONFIG)"
{ $(log_body); \
printf '%s += %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef
# ...set() comments out any previous definition
# and then appends an assigning rule
set = $(and $(1),$(2),$(set_body))
define set_body
$(log_body)
@subst 's|^$(1)[ ]*+*=.*$$|#& # overridden by $@|' "$(CONFIG)"
@printf '%s = %s\n' '$(1)' '$(2)' >> "$(CONFIG)"
{ $(log_body); \
subst 's|^$(1)[ ]*+*=.*$$|#& # overridden by $@|' "$(CONFIG)"; \
printf '%s = %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef
# is there a way to set a global make var from a recipe?..
define log_body
@grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"
{ grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; }
endef
tags = $(shell echo "$(1)" | bin/tags2lists)
......@@ -23,8 +23,10 @@ prep: disk-info metadata
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
@type -t git >&/dev/null && ( \
cd $(TOPDIR) && \
git show-ref --head --dereference -s -- HEAD 2>/dev/null; \
) >files/.disk/commit
# see also alterator-pkg (backend3/pkg-install)
# FIXME: if we copy --as-needed, maybe just tar . ?
......
......@@ -4,8 +4,10 @@
include $(BUILDDIR)/.config.mk
all: debug
@mkdir -p $(BUILDDIR)/pkg/groups \
&& cp -at $(BUILDDIR)/pkg/groups/ -- $(addsuffix .directory,$(GROUPS))
@[ -n "$(GROUPS)" ] && { \
mkdir -p $(BUILDDIR)/pkg/groups && \
cp -at $(BUILDDIR)/pkg/groups/ -- $(addsuffix .directory,$(GROUPS)); \
} ||:
debug:
@echo "** GROUPS: $(GROUPS)"
......@@ -3,7 +3,11 @@ profile/init:
@rsync -qaH --delete image.in/ "$(BUILDDIR)"/
@touch "$(BUILDDIR)"/.config.mk
@mkdir "$(BUILDDIR)"/.mki
cd $(BUILDDIR); git init -q; git add .; git commit -qam 'init' ###
@type -t git >&/dev/null && \
cd $(BUILDDIR) && \
git init -q && \
git add . && \
git commit -qam 'init'
@rm -f build
@[ -w . ] \
&& ln -sf "$(BUILDDIR)" build \
......
......@@ -3,6 +3,7 @@ include $(BUILDDIR)/.config.mk
all:
@for dir in $(SUBPROFILES); do \
rsync -a $$dir/ $(BUILDDIR)/$$dir/ && \
type -t git >&/dev/null && \
cd $(BUILDDIR)/$$dir/ && \
git add . && \
git commit -qam "$@/$$dir"; \
......
......@@ -3,7 +3,7 @@ include ../functions.mk
include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk
CHROOT_PACKAGES = syslinux $(KERNEL_PACKAGES) $(COMMON_PACKAGES)
CHROOT_PACKAGES = $(KERNEL_PACKAGES) $(STAGE1_PACKAGES) $(COMMON_PACKAGES)
MKI_PACK_RESULTS = data
###
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment