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 # 1. configure distro
# 2. configure subprofiles, prepare package lists # 2. configure subprofiles, prepare package lists/groups and hooks
# 3. build subprofiles # 3. build subprofiles
# 4. build image # 4. build image
...@@ -9,7 +9,7 @@ include profile.mk ...@@ -9,7 +9,7 @@ include profile.mk
include iso.mk include iso.mk
# this could have come from environment; # 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 ifndef BUILDDIR
BUILDDIR := $(shell realpath build || bin/mktmpdir mkimage-profiles.build) BUILDDIR := $(shell realpath build || bin/mktmpdir mkimage-profiles.build)
endif endif
......
...@@ -33,5 +33,6 @@ make distclean server-light.iso ...@@ -33,5 +33,6 @@ make distclean server-light.iso
или несколько субпрофилей каталоги/файлы и могут выполнять или несколько субпрофилей каталоги/файлы и могут выполнять
необходимые действия во время сборки после копирования необходимые действия во время сборки после копирования
(generate.sh, generate.mk). NB: добавляем в $(FEATURES) (generate.sh, generate.mk). NB: добавляем в $(FEATURES)
(из того же config.mk, который будет включён в distro.mk)
- списки пакетов: большая человеческая просьба по возможности - списки пакетов: большая человеческая просьба по возможности
избегать дублирования и подумать над pkg/lists/tagged... избегать дублирования и подумать над pkg/lists/tagged...
...@@ -19,41 +19,38 @@ include functions.mk ...@@ -19,41 +19,38 @@ include functions.mk
# request particular image subprofile inclusion # request particular image subprofile inclusion
sub/%: sub/%:
$(call add,SUBPROFILES,$(@:sub/%=%)) @$(call add,SUBPROFILES,$(@:sub/%=%))
distro/init: distro/init:
@echo "** starting distro configuration build process" @echo "** starting distro configuration build process"
@:> $(CONFIG) @:> $(CONFIG)
distro/base: distro/init sub/stage1 use/syslinux/localboot distro/base: distro/init sub/stage1 use/syslinux/localboot.cfg
$(call set,KFLAVOUR,std-def) @$(call set,KFLAVOUR,std-def)
$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release) @$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release)
$(call set,BRANDING,altlinux-desktop) ### @$(call set,BRANDING,altlinux-desktop) ###
$(call set,KERNEL_PACKAGES,kernel-image-$$(KFLAVOUR)) @$(call set,KERNEL_PACKAGES,kernel-image-$$(KFLAVOUR))
# bootloader test target distro/installer: distro/base sub/install2 use/syslinux/install2.cfg
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
@#$(call put,BRANDING=altlinux-sisyphus) ### @#$(call put,BRANDING=altlinux-sisyphus) ###
$(call set,BASE_LISTS,base kernel) @$(call set,BASE_LISTS,base kernel)
$(call set,INSTALL2_PACKAGES,installer-distro-server-light-stage2) ### @$(call set,INSTALL2_PACKAGES,installer-distro-server-light-stage2) ###
distro/server-base: distro/installer sub/main use/syslinux/ui/menu use/memtest distro/server-base: distro/installer sub/main use/syslinux/ui-menu use/memtest
$(call add,BASE_LISTS,server-base kernel-server) @$(call add,BASE_LISTS,server-base kernel-server)
distro/server-light: distro/server-base use/hdt distro/server-light: distro/server-base use/hdt
$(call set,KFLAVOUR,ovz-smp) # override default @$(call set,KFLAVOUR,ovz-smp) # override default
$(call set,BRANDING,sisyphus-server-light) @$(call set,BRANDING,sisyphus-server-light)
$(call add,DISK_LISTS,kernel-wifi) @$(call add,DISK_LISTS,kernel-wifi)
$(call add,BASE_LISTS,$(call tags,base server)) @$(call add,BASE_LISTS,$(call tags,base server))
$(call add,GROUPS,dns-server http-server ftp-server kvm-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,ipmi mysql-server dhcp-server mail-server)
$(call add,GROUPS,monitoring diag-tools) @$(call add,GROUPS,monitoring diag-tools)
# FIXME: this belongs to bootsplash feature # bootloader test target
#use/bootsplash: distro/syslinux: distro/base use/syslinux/ui-gfxboot \
# $(call add,COMMON_TAGS,bootsplash) use/hdt use/memtest boot/isolinux
boot/%: boot/%: distro/init
$(call set,BOOTLOADER,$*) @$(call set,BOOTLOADER,$*)
include $(BUILDDIR)/.config.mk -include $(BUILDDIR)/.config.mk
SHELL += -x
# first rsync what's static, and make backups -- # first rsync what's static, and make backups --
# these might signal of file clashes (or plain dirt); # these might signal of file clashes (or plain dirt);
# then handle two more ways of implementing a feature # then handle two more ways of implementing a feature
all: all:
@echo "** starting feature configuration" @echo "** starting feature configuration"
@[ -z $(FEATURES) ] || \ @[ -z "$(FEATURES)" ] || \
for dir in $(sort $(FEATURES)); do \ for dir in $(sort $(FEATURES)); do \
for sub in $(SUBPROFILES); do \ for sub in $(SUBPROFILES); do \
[ -d $$dir/$$sub/ ] && \ [ -d $$dir/$$sub/ ] && \
rsync -ab $$dir/$$sub/ $(BUILDDIR)/$$sub/ && { \ rsync -ab $$dir/$$sub/ $(BUILDDIR)/$$sub/ && { \
type -t git >&/dev/null && \
cd $(BUILDDIR)/$$sub/ && \ cd $(BUILDDIR)/$$sub/ && \
git add . && \ git add . && \
git commit -qam "$@/$$dir/$$sub" ||:; \ git commit -qam "$@/$$dir/$$sub" ||:; \
cd - >&/dev/null; \ cd - >&/dev/null; \
}; \ } ||:; \
done; \ done; \
[ -x $$dir/generate.sh ] && { cd $$dir && ./generate.sh; cd -; }; \ [ -x $$dir/generate.sh ] && { cd $$dir && ./generate.sh; cd -; }; \
[ -s $$dir/generate.mk ] && $(MAKE) -C $$dir -f generate.mk; \ [ -s $$dir/generate.mk ] && $(MAKE) -C $$dir -f generate.mk; \
done done
@find $(BUILDDIR) -name '*~' ||: @find $(BUILDDIR) -name '*~' ||:
help:
@echo "** available features:"
@grep '^use/*' */config.mk | cut -f2 -d:
# no "Memory" in hdt's menu, weird # no "Memory" in hdt's menu, weird
use/hdt: use/memtest use/hdt: use/memtest
$(call add,SYSLINUX_ITEMS,hdt) @$(call add,SYSLINUX_MODULES,hdt)
@# ITEMS iterator will happily omit a missing file, so... @$(call add,SYSLINUX_FILES,/usr/share/pci.ids)
$(call add,SYSLINUX_FILES,/usr/lib/syslinux/hdt.c32)
@# TODO: modules.pcimap (optional); maybe gzip
$(call add,SYSLINUX_FILES,/usr/share/pci.ids)
#!/bin/sh
gzip -9 "$WORKDIR"/syslinux/pci.ids ||:
use/memtest: use/memtest:
$(call add,FEATURES,memtest) @$(call add,FEATURES,memtest)
$(call add,COMMON_PACKAGES,memtest86+) @$(call add,COMMON_PACKAGES,memtest86+)
$(call add,SYSLINUX_ITEMS,memtest) @$(call add,SYSLINUX_ITEMS,memtest)
#!/bin/sh -x #!/bin/sh
mkdir -p "$WORKDIR"/syslinux mkdir -p "$WORKDIR"/syslinux
MEMTEST="$(find /boot/ -name 'memtest*' -print -quit)" MEMTEST="$(find /boot/ -name 'memtest*' -print -quit)"
# hdt recommends adding .bin # hdt wiki recommends adding .bin
[ -z "$MEMTEST" ] || [ -z "$MEMTEST" ] ||
cp -f "$MEMTEST" "$WORKDIR"/syslinux/memtest.bin cp -f "$MEMTEST" "$WORKDIR"/syslinux/memtest.bin
ui gfxboot.com ui gfxboot bootlogo
menu title mkimage-profiles 2.0 ### menu title mkimage-profiles 2.0
prompt 0 prompt 0
gfxboot bootlogo
ui menu.c32 ui menu.c32
menu title mkimage-profiles 2.0 ### menu title mkimage-profiles 2.0
prompt 0 prompt 0
say mkimage-profiles 2.0 ### say mkimage-profiles 2.0
prompt 1 prompt 1
# UI _does_ automatically enable the feature... # UI is overwritten and _does_ automatically enable the feature...
use/syslinux/ui/%: use/syslinux/ui-%:
$(call set,SYSLINUX_UI,$*) @$(call add,FEATURES,syslinux)
$(call add,FEATURES,syslinux) @$(call set,SYSLINUX_UI,$*)
$(call add,SYSLINUX_ITEMS,$*) @$(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 # ...while plain modules...
use/syslinux/%: use/syslinux/%.com use/syslinux/%.c32:
$(call add,SYSLINUX_ITEMS,$*) @$(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 ...@@ -4,35 +4,53 @@ ifndef BOOTLOADER
$(warning syslinux feature enabled but BOOTLOADER undefined) $(warning syslinux feature enabled but BOOTLOADER undefined)
endif endif
ifndef SYSLINUX ifndef SYSLINUX_UI
SYSLINUX = textprompt $(warning no syslinux ui module configured, falling back to plain text prompt)
SYSLINUX_UI := prompt
endif 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 DSTDIR := $(BUILDDIR)/stage1/files/syslinux
CONFIG := $(DSTDIR)/$(BOOTLOADER).cfg CONFIG := $(DSTDIR)/$(BOOTLOADER).cfg
PARTS := $(SYSLINUX_UI) $(SYSLINUX_ITEMS) $(SUBPROFILES) timeout
MODDIR := /usr/lib/syslinux MODDIR := /usr/lib/syslinux
# compile bootloader config from chosen parts # we can do SYSLINUX_{CFG,MODULES,FILES}
# NB: list position determined by file numbering (*.cfg) # CFG have only cfg snippet
config: debug copy # FILES have only filenames (absolute or relative to /usr/lib/syslinux/)
@cat $(sort $(foreach P,$(PARTS),$(wildcard cfg.in/??$(P).cfg))) /dev/null > $(CONFIG) # MODULES must have both cfg snippet and syslinux module filename
# (and get included iff cfg snippet AND module exist)
prep: # syslinux modules come as .com and .c32 files
@mkdir -p $(DSTDIR) sysmod = $(wildcard $(addprefix $(MODDIR)/,$(addsuffix .c??,$(1))))
cfg = $(wildcard cfg.in/??$(1).cfg)
# copy over the needed syslinux modules (item.c32 or item.com) # NB: list position determined by file numbering (*.cfg sorting)
# and SYSLINUX_FILES (list of absolute paths) all: prep debug
copy: prep cat $(sort \
@$(foreach F, \ $(foreach C,$(SYSLINUX_CFG),$(call cfg,$(C))) \
$(SYSLINUX_FILES) $(wildcard $(addprefix $(MODDIR)/,$(addsuffix .c??,$(SYSLINUX_ITEMS)))), \ $(foreach M,$(SYSLINUX_MODULES), \
$(shell cp -pLt $(DSTDIR) -- $(F))) $(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: debug:
@echo "** BOOTLOADER: $(BOOTLOADER)" @echo "** BOOTLOADER: $(BOOTLOADER)"
@echo "** SYSLINUX_UI: $(SYSLINUX_UI)" @echo "** SYSLINUX_UI: $(SYSLINUX_UI)"
@echo "** SYSLINUX_ITEMS: $(SYSLINUX_ITEMS)" @echo "** SYSLINUX_CFG: $(SYSLINUX_CFG)"
@echo "** PARTS: $(sort $(foreach P,$(PARTS),$(wildcard cfg.in/??$(P).cfg)))" @echo "** SYSLINUX_FILES: $(SYSLINUX_FILES)"
@echo "** MODULES: $(wildcard $(addprefix $(MODDIR)/,$(addsuffix .c??,$(SYSLINUX_ITEMS))))" @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! # NB: don"t use ANY quotes ('/") for put()/add()/set() arguments!
# shell will get confused by ' or args get spammed with " # 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 # this one adds whatever is given as an argument
put = $(and $(1),$(put_body)) put = $(and $(1),$(put_body))
define put_body define put_body
$(log_body) { $(log_body); \
@printf '%s\n' '$(1)' >> "$(CONFIG)" printf '%s\n' '$(1)' >> "$(CONFIG)"; }
endef endef
# these two take two args # these two take two args
# add() just appends an additive rule... # add() just appends an additive rule...
add = $(and $(1),$(2),$(add_body)) add = $(and $(1),$(2),$(add_body))
define add_body define add_body
$(log_body) { $(log_body); \
@printf '%s += %s\n' '$(1)' '$(2)' >> "$(CONFIG)" printf '%s += %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef endef
# ...set() comments out any previous definition # ...set() comments out any previous definition
# and then appends an assigning rule # and then appends an assigning rule
set = $(and $(1),$(2),$(set_body)) set = $(and $(1),$(2),$(set_body))
define set_body define set_body
$(log_body) { $(log_body); \
@subst 's|^$(1)[ ]*+*=.*$$|#& # overridden by $@|' "$(CONFIG)" subst 's|^$(1)[ ]*+*=.*$$|#& # overridden by $@|' "$(CONFIG)"; \
@printf '%s = %s\n' '$(1)' '$(2)' >> "$(CONFIG)" printf '%s = %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef endef
# is there a way to set a global make var from a recipe?.. # is there a way to set a global make var from a recipe?..
define log_body define log_body
@grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)" { grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; }
endef endef
tags = $(shell echo "$(1)" | bin/tags2lists) tags = $(shell echo "$(1)" | bin/tags2lists)
...@@ -23,8 +23,10 @@ prep: disk-info metadata ...@@ -23,8 +23,10 @@ prep: disk-info metadata
disk-info: disk-info:
@mkdir -p files/.disk @mkdir -p files/.disk
@echo "FIXME" >files/.disk/info ### +$(ARCH) @echo "FIXME" >files/.disk/info ### +$(ARCH)
@(cd $(TOPDIR); git show-ref --head --dereference -s -- HEAD 2>/dev/null) >files/.disk/commit @type -t git >&/dev/null && ( \
@[ -s files/.disk/commit ] || rm files/.disk/commit cd $(TOPDIR) && \
git show-ref --head --dereference -s -- HEAD 2>/dev/null; \
) >files/.disk/commit
# see also alterator-pkg (backend3/pkg-install) # see also alterator-pkg (backend3/pkg-install)
# FIXME: if we copy --as-needed, maybe just tar . ? # FIXME: if we copy --as-needed, maybe just tar . ?
......
...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
include $(BUILDDIR)/.config.mk include $(BUILDDIR)/.config.mk
all: debug all: debug
@mkdir -p $(BUILDDIR)/pkg/groups \ @[ -n "$(GROUPS)" ] && { \
&& cp -at $(BUILDDIR)/pkg/groups/ -- $(addsuffix .directory,$(GROUPS)) mkdir -p $(BUILDDIR)/pkg/groups && \
cp -at $(BUILDDIR)/pkg/groups/ -- $(addsuffix .directory,$(GROUPS)); \
} ||:
debug: debug:
@echo "** GROUPS: $(GROUPS)" @echo "** GROUPS: $(GROUPS)"
...@@ -3,7 +3,11 @@ profile/init: ...@@ -3,7 +3,11 @@ profile/init:
@rsync -qaH --delete image.in/ "$(BUILDDIR)"/ @rsync -qaH --delete image.in/ "$(BUILDDIR)"/
@touch "$(BUILDDIR)"/.config.mk @touch "$(BUILDDIR)"/.config.mk
@mkdir "$(BUILDDIR)"/.mki @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 @rm -f build
@[ -w . ] \ @[ -w . ] \
&& ln -sf "$(BUILDDIR)" build \ && ln -sf "$(BUILDDIR)" build \
......
...@@ -3,6 +3,7 @@ include $(BUILDDIR)/.config.mk ...@@ -3,6 +3,7 @@ include $(BUILDDIR)/.config.mk
all: all:
@for dir in $(SUBPROFILES); do \ @for dir in $(SUBPROFILES); do \
rsync -a $$dir/ $(BUILDDIR)/$$dir/ && \ rsync -a $$dir/ $(BUILDDIR)/$$dir/ && \
type -t git >&/dev/null && \
cd $(BUILDDIR)/$$dir/ && \ cd $(BUILDDIR)/$$dir/ && \
git add . && \ git add . && \
git commit -qam "$@/$$dir"; \ git commit -qam "$@/$$dir"; \
......
...@@ -3,7 +3,7 @@ include ../functions.mk ...@@ -3,7 +3,7 @@ include ../functions.mk
include $(MKIMAGE_PREFIX)/config.mk include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.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 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