mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* Re: [ptxdist] Add VirtualBox disk image build script
       [not found]   ` <CAGHsZCNuLTy5YDnh=AsRh95_50B6p_JAMSwfExhS_5+Fh1h-HQ@mail.gmail.com>
@ 2011-09-17 19:09     ` Robert Schwebel
  2011-09-21 20:44       ` Philippe Corbes
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Schwebel @ 2011-09-17 19:09 UTC (permalink / raw)
  To: ptxdist

On Fri, Sep 09, 2011 at 01:44:37PM +0200, Philippe Corbes wrote:
> Ok I modify it ;-)

Any news about this?

rsc
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] Add VirtualBox disk image build script
  2011-09-17 19:09     ` [ptxdist] Add VirtualBox disk image build script Robert Schwebel
@ 2011-09-21 20:44       ` Philippe Corbes
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Corbes @ 2011-09-21 20:44 UTC (permalink / raw)
  To: ptxdist

commit e541451a11e4b39bf9c0ce62b223dfee830b9999
Author: Philippe Corbes <philippe.corbes@gmail.com>
Date:   Wed Sep 21 22:39:35 2011 +0200

    Add VirtualBox disk image build script

    Signed-off-by: Philippe Corbes <philippe.corbes@gmail.com>

diff --git a/platforms/image_hd_vdi.in b/platforms/image_hd_vdi.in
new file mode 100644
index 0000000..7280e13
--- /dev/null
+++ b/platforms/image_hd_vdi.in
@@ -0,0 +1,13 @@
+## SECTION=image
+
+config IMAGE_VDI
+	bool
+	select IMAGE_HD
+	select IMAGE_EXT2
+	select HOST_GENPART
+	prompt "Generate images/hd.vdi"
+	help
+	  Build a VirtualBox's disk image file.
+	  Check "Generate images/hd.img" to define the hd geometry.
+	  This option is available only if VirtualBox is installed on this machine.
+
diff --git a/rules/post/ptxd_make_image_vdi.make
b/rules/post/ptxd_make_image_vdi.make
new file mode 100644
index 0000000..3ce48bc
--- /dev/null
+++ b/rules/post/ptxd_make_image_vdi.make
@@ -0,0 +1,32 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2011 by the Philippe Corbes <philippe.corbes@gmail.com>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+SEL_ROOTFS-$(PTXCONF_IMAGE_VDI)		+= $(IMAGEDIR)/hd.vdi
+
+#
+# image/vdi
+#
+# - $1	the .img image file name
+# - $2	the .vdi image file name
+#
+image/vdi = \
+	$(call image/env) \
+	image_vdi_img="$(1)" \
+	image_vdi_vdi="$(2)" \
+	ptxd_make_image_vdi
+
+$(IMAGEDIR)/%.vdi: $(IMAGEDIR)/%.img
+	@$(call targetinfo)
+	@echo "Creating `basename $@` from `basename $<`";
+	$(call image/vdi,$<,$@)
+	@echo "done."
+	@$(call touch, $@)
+
+# vim: syntax=make
diff --git a/scripts/lib/ptxd_make_image_vdi.sh
b/scripts/lib/ptxd_make_image_vdi.sh
new file mode 100644
index 0000000..69f95c7
--- /dev/null
+++ b/scripts/lib/ptxd_make_image_vdi.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 by Philippe Corbes <philippe.corbes@gmail.com>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# create or update a vdi image from an img file.
+#
+# in:
+# - $image_vdi_img	the source file name
+# - $image_vdi_vdi	the destination file name
+#
+ptxd_make_image_vdi() {
+	local vboxmanage=`whereis VBoxManage|sed -e "s/.* //"`
+	if [ ! -x `expr ${vboxmanage}` ]; then
+		echo "Virtualbox not installed!"
+		exit 1
+	fi
+
+	if [ -f "${image_vdi_vdi}" ]; then
+		# Update the existing vdi file
+		local uuid=$(${vboxmanage} showhdinfo ${image_vdi_vdi}|grep -e
"UUID:"|grep -v "(UUID"|sed -e "s/.* //")
+		rm -f ${image_vdi_vdi}
+		${vboxmanage} convertdd ${image_vdi_img} ${image_vdi_vdi} 2>&1
+		${vboxmanage} internalcommands sethduuid ${image_vdi_vdi} ${uuid}
+	else
+		# First time then create the vdi file
+		${vboxmanage} convertdd ${image_vdi_img} ${image_vdi_vdi} 2>&1
+	fi
+}
+export -f ptxd_make_image_vdi
+

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-21 20:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAGHsZCPqQs7LzTYW2n6RNJ8gSdUd=0h9K_c=nN2CD+q3ep1QCw@mail.gmail.com>
     [not found] ` <20110909101339.GO32665@pengutronix.de>
     [not found]   ` <CAGHsZCNuLTy5YDnh=AsRh95_50B6p_JAMSwfExhS_5+Fh1h-HQ@mail.gmail.com>
2011-09-17 19:09     ` [ptxdist] Add VirtualBox disk image build script Robert Schwebel
2011-09-21 20:44       ` Philippe Corbes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox