Commit 5c571b9a authored by Michael Shigorin's avatar Michael Shigorin

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
parent 71c59a45
# step 4: build image (final stage) # step 4: build image (final stage)
# #
# NB: this metaprofile directory forms the initial BUILDDIR/ # NB: this directory forms the initial BUILDDIR/
ifndef GLOBAL_BUILDDIR ifndef GLOBAL_BUILDDIR
$(error GLOBAL_BUILDDIR not defined) $(error GLOBAL_BUILDDIR not defined)
...@@ -21,7 +21,7 @@ COPY_TREE = ./files ...@@ -21,7 +21,7 @@ COPY_TREE = ./files
BOOT_TYPE = isolinux BOOT_TYPE = isolinux
# outdir shouldn't be wiped clean before use # outdir shouldn't be wiped clean before use
CLEANUP_OUTDIR = CLEANUP_OUTDIR ?=
APTCONF := $(wildcard $(APTCONF)) APTCONF := $(wildcard $(APTCONF))
ifeq "$(APTCONF)" "" ifeq "$(APTCONF)" ""
...@@ -39,9 +39,6 @@ ifeq "$(INSTALLER_KFLAVOUR)$(KFLAVOURS)" "" ...@@ -39,9 +39,6 @@ ifeq "$(INSTALLER_KFLAVOUR)$(KFLAVOURS)" ""
metadata: metadata:
@echo "** skipping metadata target, no stage1 kernel installed" @echo "** skipping metadata target, no stage1 kernel installed"
else 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: metadata:
@mkdir -p files/Metadata @mkdir -p files/Metadata
@rm -f files/Metadata/pkg-groups.tar @rm -f files/Metadata/pkg-groups.tar
...@@ -49,15 +46,14 @@ metadata: ...@@ -49,15 +46,14 @@ metadata:
@echo "$(call kpackages,$(KMODULES),$(KFLAVOURS))" >> $(call list,.base) @echo "$(call kpackages,$(KMODULES),$(KFLAVOURS))" >> $(call list,.base)
@echo "$(COMMON_PACKAGES)" | tr ' ' '\n\n' >> $(call list,.base) @echo "$(COMMON_PACKAGES)" | tr ' ' '\n\n' >> $(call list,.base)
@echo "branding-$(BRANDING)-release" >> $(call list,.base) @echo "branding-$(BRANDING)-release" >> $(call list,.base)
@tar -cvf files/Metadata/pkg-groups.tar \ # see also alterator-pkg (backend3/pkg-install); we only tar up what's up to it
-C $(PKGDIR) \ @tar -cvf files/Metadata/pkg-groups.tar -C $(PKGDIR) \
$$(echo $(call list,.base) \ $$(echo $(call list,.base) \
$(call list,$(GROUPS)) \ $(call list,$(GROUPS)) \
$(call group,$(GROUPS)) \ $(call group,$(GROUPS)) \
| sed 's,$(PKGDIR)/*,,g') | sed 's,$(PKGDIR)/*,,g')
endif endif
# FIXME: scripts.d/?
prep: $(GLOBAL_DEBUG) dot-disk metadata $(IMAGEDIR) prep: $(GLOBAL_DEBUG) dot-disk metadata $(IMAGEDIR)
$(IMAGEDIR): $(IMAGEDIR):
...@@ -67,9 +63,9 @@ $(IMAGEDIR): ...@@ -67,9 +63,9 @@ $(IMAGEDIR):
pack-image: OUTDIR = $(IMAGEDIR) pack-image: OUTDIR = $(IMAGEDIR)
debug: debug:
echo "TOPDIR=$(TOPDIR)" @echo "TOPDIR=$(TOPDIR)"
echo "ARCH=$(ARCH)" @echo "ARCH=$(ARCH)"
echo "GLOBAL_HSH_APT_CONFIG=$(GLOBAL_HSH_APT_CONFIG)" @echo "GLOBAL_HSH_APT_CONFIG=$(GLOBAL_HSH_APT_CONFIG)"
dot-disk: dot-disk:
@mkdir -p files/.disk @mkdir -p files/.disk
......
#!/bin/sh
# TODO: invent some way to remove this inter-subprofile thing
rm -vf $WORKDIR/{squashcfg.mk,initfs}
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
sub/%: sub/%:
@$(call add,SUBPROFILES,$(@:sub/%=%)) @$(call add,SUBPROFILES,$(@:sub/%=%))
sub/install2: sub/stage1
boot/%: distro/.init boot/%: distro/.init
@$(call set,BOOTLOADER,$*) @$(call set,BOOTLOADER,$*)
......
...@@ -10,6 +10,9 @@ include $(GLOBAL_BUILDDIR)/distcfg.mk ...@@ -10,6 +10,9 @@ include $(GLOBAL_BUILDDIR)/distcfg.mk
include $(GLOBAL_BUILDDIR)/functions.mk include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.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); # need kernel modules only (which require corresponding kernel-image);
# these go into work chroot; NB: no vmlinuz there # these go into work chroot; NB: no vmlinuz there
IMAGE_PACKAGES_REGEXP = $(call kpackages,$(INSTALLER_KMODULES),$(INSTALLER_KFLAVOUR)) IMAGE_PACKAGES_REGEXP = $(call kpackages,$(INSTALLER_KMODULES),$(INSTALLER_KFLAVOUR))
...@@ -21,4 +24,4 @@ MKI_PACK_RESULTS = squash:altinst ...@@ -21,4 +24,4 @@ MKI_PACK_RESULTS = squash:altinst
include $(MKIMAGE_PREFIX)/targets.mk include $(MKIMAGE_PREFIX)/targets.mk
all: build-image run-image-scripts pack-image all: | build-image run-image-scripts pack-image
...@@ -40,8 +40,10 @@ CHROOT_PACKAGES_REGEXP += $(STAGE1_PACKAGES_REGEXP) ...@@ -40,8 +40,10 @@ CHROOT_PACKAGES_REGEXP += $(STAGE1_PACKAGES_REGEXP)
CHROOT_PACKAGES = $(STAGE1_PACKAGES) $(COMMON_PACKAGES) CHROOT_PACKAGES = $(STAGE1_PACKAGES) $(COMMON_PACKAGES)
# scripts prepare bootloader configuration, too # scripts prepare bootloader configuration, too
# NB: we pass tested squashfs options for ../install2/Makefile
all: | debug prepare-workdir copy-tree run-scripts build-propagator \ all: | debug prepare-workdir copy-tree run-scripts build-propagator \
copy-$(BOOTLOADER) pack-image copy-$(BOOTLOADER) pack-image
@cp $(OUTDIR)/squashcfg.mk $(GLOBAL_BUILDDIR)/
debug: debug:
@if test -n "$(GLOBAL_VERBOSE)"; then \ @if test -n "$(GLOBAL_VERBOSE)"; then \
......
#!/bin/sh #!/bin/sh
echo "file /.VERSION @TMPDIR@/.VERSION 0644 0 0" >"$WORKDIR"/initfs 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
#!/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
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