From: Philippe Corbes <philippe.corbes@gmail.com>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] Add VirtualBox disk image build script
Date: Wed, 21 Sep 2011 22:44:49 +0200 [thread overview]
Message-ID: <CAGHsZCO3-XzAmmwREqRUup-UO=28h8UupgjRiS_qzf-NdKsOtw@mail.gmail.com> (raw)
In-Reply-To: <20110917190927.GF5139@pengutronix.de>
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
prev parent reply other threads:[~2011-09-21 20:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 ` Robert Schwebel
2011-09-21 20:44 ` Philippe Corbes [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGHsZCO3-XzAmmwREqRUup-UO=28h8UupgjRiS_qzf-NdKsOtw@mail.gmail.com' \
--to=philippe.corbes@gmail.com \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox