pass squashfs options from stage1 test to install2

This looks a bit weird (two subprofiles become a bit more
tightly coupled) but in fact install2 does depend on stage1,
and if stage1 doesn't create squashcfg.mk then install2 is
just fine with defaults (provided they fit the installer kernel
used).  A proper mkimage test infrastructure might be handy though.

Also there:
- 01-initfs: partial cleanup (bootsplash is obsolete anyways)
- regarding 03-test-kernel's errorlevel test:
  if 0, 1 and 2 need to be distinguished, "!" MUST NOT be used
  as it negates so that 0 becomes 1 and the rest becomes 0
This commit is contained in:
Michael Shigorin 2011-06-14 18:25:55 +04:00
parent 71c59a458a
commit 5c571b9af4
7 changed files with 41 additions and 16 deletions

View File

@ -1,6 +1,6 @@
# step 4: build image (final stage)
#
# NB: this metaprofile directory forms the initial BUILDDIR/
# NB: this directory forms the initial BUILDDIR/
ifndef GLOBAL_BUILDDIR
$(error GLOBAL_BUILDDIR not defined)
@ -21,7 +21,7 @@ COPY_TREE = ./files
BOOT_TYPE = isolinux
# outdir shouldn't be wiped clean before use
CLEANUP_OUTDIR =
CLEANUP_OUTDIR ?=
APTCONF := $(wildcard $(APTCONF))
ifeq "$(APTCONF)" ""
@ -39,9 +39,6 @@ ifeq "$(INSTALLER_KFLAVOUR)$(KFLAVOURS)" ""
metadata:
@echo "** skipping metadata target, no stage1 kernel installed"
else
# see also alterator-pkg (backend3/pkg-install)
# FIXME: if we copy --as-needed, maybe just tar . ?
# TODO: initfs seems conditionally needed as well
metadata:
@mkdir -p files/Metadata
@rm -f files/Metadata/pkg-groups.tar
@ -49,15 +46,14 @@ metadata:
@echo "$(call kpackages,$(KMODULES),$(KFLAVOURS))" >> $(call list,.base)
@echo "$(COMMON_PACKAGES)" | tr ' ' '\n\n' >> $(call list,.base)
@echo "branding-$(BRANDING)-release" >> $(call list,.base)
@tar -cvf files/Metadata/pkg-groups.tar \
-C $(PKGDIR) \
# see also alterator-pkg (backend3/pkg-install); we only tar up what's up to it
@tar -cvf files/Metadata/pkg-groups.tar -C $(PKGDIR) \
$$(echo $(call list,.base) \
$(call list,$(GROUPS)) \
$(call group,$(GROUPS)) \
| sed 's,$(PKGDIR)/*,,g')
endif
# FIXME: scripts.d/?
prep: $(GLOBAL_DEBUG) dot-disk metadata $(IMAGEDIR)
$(IMAGEDIR):
@ -67,9 +63,9 @@ $(IMAGEDIR):
pack-image: OUTDIR = $(IMAGEDIR)
debug:
echo "TOPDIR=$(TOPDIR)"
echo "ARCH=$(ARCH)"
echo "GLOBAL_HSH_APT_CONFIG=$(GLOBAL_HSH_APT_CONFIG)"
@echo "TOPDIR=$(TOPDIR)"
@echo "ARCH=$(ARCH)"
@echo "GLOBAL_HSH_APT_CONFIG=$(GLOBAL_HSH_APT_CONFIG)"
dot-disk:
@mkdir -p files/.disk

4
image.in/scripts.d/00-cleanup Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
# TODO: invent some way to remove this inter-subprofile thing
rm -vf $WORKDIR/{squashcfg.mk,initfs}

View File

@ -4,6 +4,8 @@
sub/%:
@$(call add,SUBPROFILES,$(@:sub/%=%))
sub/install2: sub/stage1
boot/%: distro/.init
@$(call set,BOOTLOADER,$*)

View File

@ -10,6 +10,9 @@ include $(GLOBAL_BUILDDIR)/distcfg.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
# this might have been prepared by ../stage1/scripts.d/03-test-kernel
-include $(GLOBAL_BUILDDIR)/squashcfg.mk
# need kernel modules only (which require corresponding kernel-image);
# these go into work chroot; NB: no vmlinuz there
IMAGE_PACKAGES_REGEXP = $(call kpackages,$(INSTALLER_KMODULES),$(INSTALLER_KFLAVOUR))
@ -21,4 +24,4 @@ MKI_PACK_RESULTS = squash:altinst
include $(MKIMAGE_PREFIX)/targets.mk
all: build-image run-image-scripts pack-image
all: | build-image run-image-scripts pack-image

View File

@ -40,8 +40,10 @@ CHROOT_PACKAGES_REGEXP += $(STAGE1_PACKAGES_REGEXP)
CHROOT_PACKAGES = $(STAGE1_PACKAGES) $(COMMON_PACKAGES)
# scripts prepare bootloader configuration, too
# NB: we pass tested squashfs options for ../install2/Makefile
all: | debug prepare-workdir copy-tree run-scripts build-propagator \
copy-$(BOOTLOADER) pack-image
@cp $(OUTDIR)/squashcfg.mk $(GLOBAL_BUILDDIR)/
debug:
@if test -n "$(GLOBAL_VERBOSE)"; then \

View File

@ -1,6 +1,2 @@
#!/bin/sh
echo "file /.VERSION @TMPDIR@/.VERSION 0644 0 0" >"$WORKDIR"/initfs
# FIXME: broken test, we already do branding
[ -z "$BRANDING" ] || \
echo "file /bootsplash /bootsplash/bootsplash 0644 0 0" >>"$WORKDIR"/initfs

View File

@ -0,0 +1,22 @@
#!/bin/sh
# check relevant kernel features availability
# test for installer-required filesystems support
for opt in CONFIG_SQUASHFS CONFIG_AUFS_FS; do
if grep -q "^$opt=[my]$" /boot/config-*; then
[ -n "$GLOBAL_VERBOSE" ] && echo "** $opt available"
else
if [ "$?" = 1 ]; then # a file exists but lacks the pattern
echo "** error: stage1 kernel must have $opt support" >&2
exit 1
fi
fi
done
# squashfs options: not really neccessary but better than none
# NB: this config file should be carried over into install2
if grep -q '^CONFIG_SQUASHFS_XZ=y$' /boot/config-*; then
echo "PACK_SQUASHFS_OPTS=-comp xz -Xbcj x86" > /.image/squashcfg.mk
else
echo "PACK_SQUASHFS_OPTS=-comp gzip" >> /.image/squashcfg.mk
fi