Patchwork boot-directdisk: add the support of vmdk

login
register
mail settings
Submitter yanjun.zhu
Date Dec. 4, 2013, 6:50 a.m.
Message ID <1386139839-10522-1-git-send-email-yanjun.zhu@windriver.com>
Download mbox | patch
Permalink /patch/62767/
State New
Headers show

Comments

yanjun.zhu - Dec. 4, 2013, 6:50 a.m.
---
 meta/classes/boot-directdisk.bbclass |   24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
João Henrique Freitas - Dec. 13, 2013, 12:40 a.m.
Hi,

Is ${IMAGE_FSTYPE} correct?

I can't find this variable.

Maybe IMAGE_FSTYPES ?

Thanks.


On Wed, Dec 4, 2013 at 4:50 AM, Zhu Yanjun <yanjun.zhu@windriver.com> wrote:

> ---
>  meta/classes/boot-directdisk.bbclass |   24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/meta/classes/boot-directdisk.bbclass
> b/meta/classes/boot-directdisk.bbclass
> index 5535728..b2bd210 100644
> --- a/meta/classes/boot-directdisk.bbclass
> +++ b/meta/classes/boot-directdisk.bbclass
> @@ -88,6 +88,15 @@ build_boot_dd() {
>                 grubefi_hddimg_populate $HDDDIR
>         fi
>
> +       if [ ${IMAGE_FSTYPE} = "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
> +                               install -m 0644 ${SYSLINUX_SPLASH}
> ${HDDDIR}${SYSLINUXDIR}/splash.lss
> +                       fi
> +               fi
> +       fi
> +
>         BLOCKS=`du -bks $HDDDIR | cut -f 1`
>         BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}`
>
> @@ -119,17 +128,22 @@ build_boot_dd() {
>         parted $IMAGE mkpart primary fat16 0 ${END1}B
>         parted $IMAGE unit B mkpart primary ext2 ${END2}B ${END3}B
>         parted $IMAGE set 1 boot on
> -       parted $IMAGE print
> +
> +       if [ ${IMAGE_FSTYPE} != "vmdk" ]; then
> +               parted $IMAGE print
> +       fi
>
>         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
>
>         OFFSET=`expr $END2 / 512`
> -       if [ "${PCBIOS}" = "1" ]; then
> -               dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE
> conv=notrunc
> +       if [ ${IMAGE_FSTYPE} != "vmdk" ]; then
> +               if [ "${PCBIOS}" = "1" ]; then
> +                       dd if=${STAGING_DATADIR}/syslinux/mbr.bin
> of=$IMAGE conv=notrunc
> +               fi
> +               dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 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
> +       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.7.9.5
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

Patch

diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 5535728..b2bd210 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -88,6 +88,15 @@  build_boot_dd() {
 		grubefi_hddimg_populate $HDDDIR
 	fi
 
+	if [ ${IMAGE_FSTYPE} = "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
+				install -m 0644 ${SYSLINUX_SPLASH} ${HDDDIR}${SYSLINUXDIR}/splash.lss
+			fi
+		fi
+	fi
+
 	BLOCKS=`du -bks $HDDDIR | cut -f 1`
 	BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}`
 
@@ -119,17 +128,22 @@  build_boot_dd() {
 	parted $IMAGE mkpart primary fat16 0 ${END1}B
 	parted $IMAGE unit B mkpart primary ext2 ${END2}B ${END3}B
 	parted $IMAGE set 1 boot on 
-	parted $IMAGE print
+
+	if [ ${IMAGE_FSTYPE} != "vmdk" ]; then
+		parted $IMAGE print
+	fi
 
 	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
 
 	OFFSET=`expr $END2 / 512`
-	if [ "${PCBIOS}" = "1" ]; then
-		dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc
+	if [ ${IMAGE_FSTYPE} != "vmdk" ]; then
+		if [ "${PCBIOS}" = "1" ]; then
+			dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc
+		fi
+		dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 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	
+	dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512      
 
 	cd ${DEPLOY_DIR_IMAGE}
 	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect