build-vm, main.mk, pack: add recovery.tar

recovery.tar needed for tavolga (mipsel).
This commit is the result of transferring the required functionality
from build-mr (mipsel rootfs).
This change uses external tool to build Tavolga-compatible
recovery.tar. This simplifies the logic and avoids having
recovery workdir in the profile.
After this change, m-p will require tavolga-image-tools >= 3.0.
This commit is contained in:
Ivan Melnikov 2019-05-19 16:39:04 +07:00 committed by Michael Shigorin
parent dc50249329
commit dc598719d0
3 changed files with 20 additions and 1 deletions

View File

@ -25,6 +25,9 @@ VM_SIZE ?= 0
VM_GZIP_COMMAND ?= gzip
VM_XZ_COMMAND ?= xz -T0
# tavolga
RECOVERY_LINE ?= Press ENTER to start
check-sudo:
@if ! type -t sudo >&/dev/null; then \
echo "** error: sudo not available, see doc/vm.txt" >&2; \
@ -75,6 +78,16 @@ convert-image/qcow2 convert-image/qcow2c convert-image/vmdk \
qemu-img convert $$VM_COMPRESS -O "$$VM_FORMAT" \
"$(VM_RAWDISK)" "$(IMAGE_OUTPATH)"
# for tavolga
convert-image/recovery.tar:
build-recovery-tar \
--image-name $(IMAGE_NAME) \
--date $(DATE) \
--compress-command '$(VM_GZIP_COMMAND)' \
--rootfs "$(VM_TARBALL)" \
--output "$(IMAGE_OUTPATH)" \
--line '$(RECOVERY_LINE)'
post-convert:
@rm -f "$(VM_RAWDISK)"; \
if [ "0$(DEBUG)" -le 1 ]; then rm -f "$(VM_TARBALL)"; fi

View File

@ -38,9 +38,14 @@ endif
# extensions for buld-vm
VM_EXTS := .tar .tar.gz .tar.xz .img .qcow2 .qcow2c .vdi .vmdk .vhd
VM_TAVOLGA_EXTS := .recovery.tar
ifeq (vm,$(IMAGE_CLASS))
$(VM_EXTS:.%=use/pack/%): use/pack; @:
ifeq (mipsel,$(ARCH))
use/pack/recovery.tar: use/pack/tar; @:
endif
endif

View File

@ -61,7 +61,8 @@ VE_TARGETS := $(call targets,ve)
VM_TARGETS := $(call targets,vm)
DISTROS := $(call addsuffices,$(DISTRO_EXTS),$(DISTRO_TARGETS))
VES := $(call addsuffices,$(VE_EXTS),$(VE_TARGETS))
VMS := $(call addsuffices,$(VM_EXTS),$(VM_TARGETS))
VMS := $(call addsuffices,$(VM_EXTS),$(VM_TARGETS)) \
$(call addsuffices,$(VM_TAVOLGA_EXTS), $(filter vm/tavolga-%, $(VM_TARGETS)))
IMAGES := $(DISTROS) $(VES) $(VMS)
.PHONY: $(IMAGES) $(DISTRO_TARGETS) $(VE_TARGETS) $(VM_TARGETS)