2012-06-18 22:00:32 +04:00
# step 4: build the virtual machine image
IMAGE_PACKAGES = $( SYSTEM_PACKAGES) \
$( COMMON_PACKAGES) \
$( BASE_PACKAGES) \
$( THE_PACKAGES) \
$( call list,$( BASE_LISTS) $( THE_LISTS) ) \
$( call kpackages,$( THE_KMODULES) $( BASE_KMODULES) ,$( KFLAVOURS) )
# intermediate chroot archive
VM_TARBALL := $( IMAGE_OUTDIR) /$( IMAGE_NAME) .tar
2012-06-19 17:51:56 +04:00
VM_RAWDISK := $( IMAGE_OUTDIR) /$( IMAGE_NAME) .raw
2012-06-18 22:00:32 +04:00
2012-06-21 22:39:37 +04:00
i f e q ( , $( ROOTPW ) )
$( error please provide root password via ROOTPW )
e n d i f
2012-06-18 22:00:32 +04:00
check-sudo :
@if ! type -t sudo >& /dev/null; then \
echo "** error: sudo not available, see doc/vm.txt" >& 2; \
exit 1; \
fi
2012-06-19 17:51:56 +04:00
prepare-image : check -sudo
2012-06-18 22:00:32 +04:00
@if ! sudo $( TOPDIR) /bin/tar2vm \
2012-06-19 17:51:56 +04:00
" $( VM_TARBALL) " " $( VM_RAWDISK) " $$ VM_SIZE; then \
2012-06-18 22:00:32 +04:00
echo "** error: sudo tar2vm failed, see also doc/vm.txt" >& 2; \
exit 1; \
fi
2012-06-19 17:51:56 +04:00
convert-image : prepare -image
@case " $( IMAGE_TYPE) " in \
2012-06-26 00:10:27 +04:00
"img" ) mv " $( VM_RAWDISK) " " $( IMAGE_OUTPATH) " ; exit 0; ; \
2012-06-19 17:51:56 +04:00
"vhd" ) VM_FORMAT = "vpc" ; ; \
*) VM_FORMAT = " $( IMAGE_TYPE) " ; \
esac ; \
if ! type -t qemu-img >& /dev/null; then \
echo "** warning: qemu-img not available" >& 2; \
else \
qemu-img convert -O " $$ VM_FORMAT " \
" $( VM_RAWDISK) " " $( IMAGE_OUTPATH) " ; \
2012-06-26 00:10:27 +04:00
rm " $( VM_RAWDISK) " ; \
2012-06-19 17:51:56 +04:00
fi
2012-06-26 00:22:35 +04:00
run-image-scripts : GLOBAL_CLEANUP_PACKAGES := $( CLEANUP_PACKAGES )
2012-06-18 22:00:32 +04:00
run-image-scripts : GLOBAL_ROOTPW := $( ROOTPW )
2012-06-19 17:51:56 +04:00
# override
2012-06-18 22:00:32 +04:00
pack-image : MKI_PACK_RESULTS := tar :$( VM_TARBALL )
all : $( GLOBAL_DEBUG ) build -image copy -tree run -image -scripts pack -image \
convert-image postprocess $( GLOBAL_CLEAN_WORKDIR)