allow switching between vmdk images with IDE or SCSI controller

This commit is contained in:
Jörg Deckert 2021-02-05 16:35:27 +01:00
parent 9a6000e89c
commit abc5c6d49b
1 changed files with 8 additions and 2 deletions

View File

@ -9,6 +9,7 @@ IMAGES = $(VABUILDER_OUTPUT)/images
RAW_IMAGE = $(IMAGES)/$(APPLIANCE).img RAW_IMAGE = $(IMAGES)/$(APPLIANCE).img
QCOW_IMAGE = $(IMAGES)/$(APPLIANCE).qcow QCOW_IMAGE = $(IMAGES)/$(APPLIANCE).qcow
VMDK_IMAGE = $(IMAGES)/$(APPLIANCE).vmdk VMDK_IMAGE = $(IMAGES)/$(APPLIANCE).vmdk
VMDK_TYPE = IDE
XVA_IMAGE = $(IMAGES)/$(APPLIANCE).xva XVA_IMAGE = $(IMAGES)/$(APPLIANCE).xva
LST_FILE = $(IMAGES)/$(APPLIANCE)-packages.lst LST_FILE = $(IMAGES)/$(APPLIANCE)-packages.lst
CHECKSUMS = $(IMAGES)/SHA256SUMS CHECKSUMS = $(IMAGES)/SHA256SUMS
@ -302,7 +303,11 @@ xva: $(XVA_IMAGE)
$(VMDK_IMAGE): $(RAW_IMAGE) $(VMDK_IMAGE): $(RAW_IMAGE)
@print Creating `basename $(VMDK_IMAGE)` @print Creating `basename $(VMDK_IMAGE)`
ifeq ($(VMDK_TYPE),SCSI)
qemu-img convert -f raw -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized,compat6 $(RAW_IMAGE) $(VMDK_IMAGE).tmp
else
qemu-img convert -f raw -O vmdk $(RAW_IMAGE) $(VMDK_IMAGE).tmp qemu-img convert -f raw -O vmdk $(RAW_IMAGE) $(VMDK_IMAGE).tmp
endif
mv $(VMDK_IMAGE).tmp $(VMDK_IMAGE) mv $(VMDK_IMAGE).tmp $(VMDK_IMAGE)
vmdk: $(VMDK_IMAGE) vmdk: $(VMDK_IMAGE)
@ -390,8 +395,9 @@ help:
@echo 'EXTERNAL_KERNEL=YES - Do not build a kernel in the image' @echo 'EXTERNAL_KERNEL=YES - Do not build a kernel in the image'
@echo 'HEADLESS=YES - Build a headless (serial console) image.' @echo 'HEADLESS=YES - Build a headless (serial console) image.'
@echo 'ENABLE_SSHD=YES - Enable sshd to start automatically in the image' @echo 'ENABLE_SSHD=YES - Enable sshd to start automatically in the image'
@echo 'VMDK_TYPE=IDE - VMDK image type (IDE or SCSI)'
@echo @echo
@print 'Example' @print 'Example to build the base appliance'
@echo 'make APPLIANCE=mongodb HEADLESS=YES VIRTIO=YES stage4 qcow clean' @echo 'make APPLIANCE=base HEADLESS=YES VIRTIO=YES stage4 qcow clean'
.PHONY: qcow vmdk clean realclean distclean stage4 image stage4 help appliance-list eclean sync_portage sync_stage3 checksums .PHONY: qcow vmdk clean realclean distclean stage4 image stage4 help appliance-list eclean sync_portage sync_stage3 checksums