From 6b72a23dad5eb4d861d3aa2e33e5f8a38714016b Mon Sep 17 00:00:00 2001
From: Takuya ASADA <syuu@cloudius-systems.com>
Date: Mon, 24 Mar 2014 15:11:42 +0800
Subject: [PATCH] Support VMDK and VDI format

Add osv.vmdk and osv.vdi targets on Makefile.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
---
 Makefile | 4 ++++
 build.mk | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/Makefile b/Makefile
index 121d8acf5..ad8a97f29 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,10 @@ check: export image ?= tests
 check: all
 	./scripts/test.py
 
+osv.vmdk osv.vdi:
+	$(MAKE) -r -C $(dir $(submake)) $@
+.PHONY: osv.vmdk osv.vdi
+
 # "tags" is the default output file of ctags, "TAGS" is that of etags
 tags TAGS:
 	rm -f -- "$@"
diff --git a/build.mk b/build.mk
index 42ac6899f..50402f0a3 100644
--- a/build.mk
+++ b/build.mk
@@ -735,6 +735,12 @@ usr.img: bare.img $(out)/usr.manifest $(out)/cmdline
 		glibcbase=$(glibcbase) -D miscbase=$(miscbase)
 	$(call quiet, $(src)/scripts/imgedit.py setargs $@ "$(shell cat $(out)/cmdline)", IMGEDIT $@)
 
+osv.vmdk osv.vdi:
+	$(call quiet, echo Creating $@ as $(subst osv.,,$@))
+	$(call quiet, qemu-img convert -O $(subst osv.,,$@) usr.img $@)
+	$(call quiet, $(src)/scripts/imgedit.py setargs $@ "--vga $(shell cat $(out)/cmdline)", IMGEDIT $@)
+.PHONY: osv.vmdk osv.vdi
+
 $(jni): INCLUDES += -I /usr/lib/jvm/java/include -I /usr/lib/jvm/java/include/linux/
 
 bootfs.bin: scripts/mkbootfs.py $(java-targets) $(out)/bootfs.manifest $(tests) $(java_tests) $(tools) \
-- 
GitLab