Patchwork boot-directdisk: fix the support of vmdk

login
register
mail settings
Submitter João Henrique Freitas
Date Dec. 20, 2013, 10:10 a.m.
Message ID <1387534224-16453-1-git-send-email-joaohf@gmail.com>
Download mbox | patch
Permalink /patch/63619/
State New
Headers show

Comments

João Henrique Freitas - Dec. 20, 2013, 10:10 a.m.
Previous change (086ce22b88f5ef5f75a83119a32c8b3fdcfa296d) broke
the creating of vmdk images. This protects shell expansion variables
and let dd generate the image to be transformed to vmdk by image-vmdk.class.
---
 meta/classes/boot-directdisk.bbclass | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
Martin Jansa - Dec. 20, 2013, 11:32 a.m.
On Fri, Dec 20, 2013 at 08:10:24AM -0200, Joao Henrique Ferreira de Freitas wrote:
> Previous change (086ce22b88f5ef5f75a83119a32c8b3fdcfa296d) broke
> the creating of vmdk images. This protects shell expansion variables
> and let dd generate the image to be transformed to vmdk by image-vmdk.class.
> ---
>  meta/classes/boot-directdisk.bbclass | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
> index 3277666..4f26f47 100644
> --- a/meta/classes/boot-directdisk.bbclass
> +++ b/meta/classes/boot-directdisk.bbclass
> @@ -88,10 +88,10 @@ build_boot_dd() {
>  		grubefi_hddimg_populate $HDDDIR
>  	fi
>  
> -	if [ ${IMAGE_FSTYPE} = "vmdk" ]; then
> -		if [ x${AUTO_SYSLINUXMENU} = x1 ] ; then
> +	if [ "${IMAGE_FSTYPES}" = "vmdk" ]; then
> +		if [ "x${AUTO_SYSLINUXMENU}" = "x1" ] ; then

IMAGE_FSTYPE looks really as typo, but what if there are multiple
entries in IMAGE_FSTYPES?

OE @ ~/openembedded-core $ git grep IMAGE_FSTYPE | grep -v IMAGE_FSTYPES
meta/classes/boot-directdisk.bbclass:   if [ ${IMAGE_FSTYPE} = "vmdk" ]; then
meta/classes/boot-directdisk.bbclass:   if [ ${IMAGE_FSTYPE} != "vmdk" ]; then
meta/classes/boot-directdisk.bbclass:   if [ ${IMAGE_FSTYPE} != "vmdk" ]; then

Maybe you can use this variable instead:
meta/classes/image.bbclass:IMAGE_TYPE_vmdk = '${@base_contains("IMAGE_FSTYPES", "vmdk", "image-vmdk", "", d)}'

>  			install -m 0644 ${STAGING_DIR}/${MACHINE}/usr/share/syslinux/vesamenu.c32 ${HDDDIR}${SYSLINUXDIR}/vesamenu.c32
> -			if [ x${SYSLINUX_SPLASH} != x ] ; then
> +			if [ "x${SYSLINUX_SPLASH}" != "x" ] ; then
>  				install -m 0644 ${SYSLINUX_SPLASH} ${HDDDIR}${SYSLINUXDIR}/splash.lss
>  			fi
>  		fi
> @@ -129,9 +129,7 @@ build_boot_dd() {
>  	parted $IMAGE unit B mkpart primary ext2 ${END2}B ${END3}B
>  	parted $IMAGE set 1 boot on 
>  
> -	if [ ${IMAGE_FSTYPE} != "vmdk" ]; then
> -		parted $IMAGE print
> -	fi
> +	parted $IMAGE print
>  
>  	awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')\" }" | \
>  		dd of=$IMAGE bs=1 seek=440 conv=notrunc
> @@ -141,10 +139,8 @@ build_boot_dd() {
>  		dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc
>  	fi
>  
> -	if [ ${IMAGE_FSTYPE} != "vmdk" ]; then
> -		dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512
> -		dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512	
> -	fi
> +	dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512
> +	dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512
>  
>  	cd ${DEPLOY_DIR_IMAGE}
>  	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
> -- 
> 1.8.3.2
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Paul Eggleton - Dec. 20, 2013, 11:37 a.m.
On Friday 20 December 2013 12:32:38 Martin Jansa wrote:
> On Fri, Dec 20, 2013 at 08:10:24AM -0200, Joao Henrique Ferreira de Freitas
> wrote:
> > Previous change (086ce22b88f5ef5f75a83119a32c8b3fdcfa296d) broke
> > the creating of vmdk images. This protects shell expansion variables
> > and let dd generate the image to be transformed to vmdk by
> > image-vmdk.class. ---
> > 
> >  meta/classes/boot-directdisk.bbclass | 16 ++++++----------
> >  1 file changed, 6 insertions(+), 10 deletions(-)
> > 
> > diff --git a/meta/classes/boot-directdisk.bbclass
> > b/meta/classes/boot-directdisk.bbclass index 3277666..4f26f47 100644
> > --- a/meta/classes/boot-directdisk.bbclass
> > +++ b/meta/classes/boot-directdisk.bbclass
> > @@ -88,10 +88,10 @@ build_boot_dd() {
> > 
> >  		grubefi_hddimg_populate $HDDDIR
> >  	
> >  	fi
> > 
> > -	if [ ${IMAGE_FSTYPE} = "vmdk" ]; then
> > -		if [ x${AUTO_SYSLINUXMENU} = x1 ] ; then
> > +	if [ "${IMAGE_FSTYPES}" = "vmdk" ]; then
> > +		if [ "x${AUTO_SYSLINUXMENU}" = "x1" ] ; then
> 
> IMAGE_FSTYPE looks really as typo, but what if there are multiple
> entries in IMAGE_FSTYPES?
> 
> OE @ ~/openembedded-core $ git grep IMAGE_FSTYPE | grep -v IMAGE_FSTYPES
> meta/classes/boot-directdisk.bbclass:   if [ ${IMAGE_FSTYPE} = "vmdk" ];
> then meta/classes/boot-directdisk.bbclass:   if [ ${IMAGE_FSTYPE} != "vmdk"
> ]; then meta/classes/boot-directdisk.bbclass:   if [ ${IMAGE_FSTYPE} !=
> "vmdk" ]; then
> 
> Maybe you can use this variable instead:
> meta/classes/image.bbclass:IMAGE_TYPE_vmdk =
> '${@base_contains("IMAGE_FSTYPES", "vmdk", "image-vmdk", "", d)}'

I'd suggest not using that variable as it's an internal implementation detail 
of image.bbclass - just use a similar base_contains() statement.

Cheers,
Paul

Patch

diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 3277666..4f26f47 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -88,10 +88,10 @@  build_boot_dd() {
 		grubefi_hddimg_populate $HDDDIR
 	fi
 
-	if [ ${IMAGE_FSTYPE} = "vmdk" ]; then
-		if [ x${AUTO_SYSLINUXMENU} = x1 ] ; then
+	if [ "${IMAGE_FSTYPES}" = "vmdk" ]; then
+		if [ "x${AUTO_SYSLINUXMENU}" = "x1" ] ; then
 			install -m 0644 ${STAGING_DIR}/${MACHINE}/usr/share/syslinux/vesamenu.c32 ${HDDDIR}${SYSLINUXDIR}/vesamenu.c32
-			if [ x${SYSLINUX_SPLASH} != x ] ; then
+			if [ "x${SYSLINUX_SPLASH}" != "x" ] ; then
 				install -m 0644 ${SYSLINUX_SPLASH} ${HDDDIR}${SYSLINUXDIR}/splash.lss
 			fi
 		fi
@@ -129,9 +129,7 @@  build_boot_dd() {
 	parted $IMAGE unit B mkpart primary ext2 ${END2}B ${END3}B
 	parted $IMAGE set 1 boot on 
 
-	if [ ${IMAGE_FSTYPE} != "vmdk" ]; then
-		parted $IMAGE print
-	fi
+	parted $IMAGE print
 
 	awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')\" }" | \
 		dd of=$IMAGE bs=1 seek=440 conv=notrunc
@@ -141,10 +139,8 @@  build_boot_dd() {
 		dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc
 	fi
 
-	if [ ${IMAGE_FSTYPE} != "vmdk" ]; then
-		dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512
-		dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512	
-	fi
+	dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512
+	dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512
 
 	cd ${DEPLOY_DIR_IMAGE}
 	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect