Skip to contentSkip to conversation

enhance boot-directdisk.bbclass to generate .vmdk image

RFC PATCH Superseded Dexuan Cui 2 participants 7 messages Jan 10, 2012 – Jan 18, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dexuan Cui

author
#0 lore raw

cover enhance boot-directdisk.bbclass to generate .vmdk image

[RFC][PATCH] enhance boot-directdisk.bbclass to generate .vmdk image

The self-hosted-image work needs a live-bootable and r/w-able image format. The existing .iso isn't ok since it's readonly.
The existing .hddimg is not a good choice, since it has a two-option(boot,install) syslinux function that we don't need: we don't hope a user be potentially able to "install", and I think it may be not suitble to hack build_hddimg to hide the "install"? Moreever, .hddimg is not that compatibible with some devices and we hope to have the most compatibility.

So I think the .hdddirect format is a good choice and I made this patch to adopt it and also enhanced boot-directdisk.bbclass to generate .vmdk image so we can run it on vmware, too. BTW, currently self-hosted-image is the only user of boot-directdisk.bbclass; with the adoption of .hdddirect and .vmdk formats, a user can still use "IMAGE_FSTYPES += 'live'" to generate the .iso and .hddimg format.

Please give comment. Thanks!

Please review the following changes for suitability for inclusion. If you have any objections or suggestions for improvement, please respond to the patches. If you agree with the changes, please provide your Acked-by.

The following changes since commit 468998cddbe1a803096c9b357e1b5daa3b7e8c2e:

command.py: add parseConfigurationFiles API (2012-01-06 16:01:44 +0000)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib dcui/self-hosted-v7
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dcui/self-hosted-v7

Dexuan Cui (1):
self-hosted-image: generate the .hdddirect and .vmdk image files

 meta/classes/boot-directdisk.bbclass          |   10 +++++++++-
 meta/recipes-core/images/self-hosted-image.bb |   11 +++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.6
author
#1 lore raw

RFC PATCH 1/1 self-hosted-image: generate the .hdddirect and .vmdk image files

---
 meta/classes/boot-directdisk.bbclass          |   10 +++++++++-
 meta/recipes-core/images/self-hosted-image.bb |   11 +++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/boot-directdisk.bbclass +9 -1
index 8879ba8..83ec929 100644
@@ -24,6 +24,7 @@ do_bootdirectdisk[depends] += "dosfstools-native:do_populate_sysroot \
                                syslinux-native:do_populate_sysroot \
                                parted-native:do_populate_sysroot \
                                mtools-native:do_populate_sysroot "
+do_bootdirectdisk[depends] += "qemu-native:do_populate_sysroot"
 
 PACKAGES = " "
 EXCLUDE_FROM_WORLD = "1"
@@ -38,7 +39,7 @@ BOOTDD_EXTRA_SPACE ?= "16384"
 
 AUTO_SYSLINUXCFG = "1"
 LABELS = "boot"
-APPEND = "root=/dev/sda2"
+APPEND = "root=/dev/hda2"
 TIMEOUT = "10"
 SYSLINUXCFG  = "${HDDDIR}/syslinux.cfg"
 SYSLINUXMENU = "${HDDDIR}/menu"
@@ -50,6 +51,7 @@ build_boot_dd() {
 
 	install -d ${HDDDIR}
 	install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage ${HDDDIR}/vmlinuz
+	install -m 0644 ${S}/syslinux.cfg ${HDDDIR}/syslinux.cfg
 	install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys
 
 	BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
@@ -83,6 +85,12 @@ build_boot_dd() {
 	cd ${DEPLOY_DIR_IMAGE}
 	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
 	ln -s ${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
+
+	if [ "${NOVMDK}" != "1" ] ; then
+		${STAGING_BINDIR_NATIVE}/qemu-img convert -O vmdk   \
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect \
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
+	fi
 } 
 
 python do_bootdirectdisk() {
meta/recipes-core/images/self-hosted-image.bb +9 -2
index 111c057..df6c81f 100644
@@ -6,6 +6,13 @@ POKY_EXTRA_INSTALL = "\
 
 IMAGE_FEATURES += "x11-mini"
 
-inherit core-image
+# Needed by boot-directdisk
+ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.ext3"
 
-PR = "r2"
+inherit core-image boot-directdisk
+
+do_bootimg[depends] += "${INITRD_IMAGE}:do_rootfs"
+do_bootimg[depends] += "${IMAGE_BASENAME}:do_rootfs"
+do_bootdirectdisk[depends] += "${PN}:do_rootfs"
+
+PR = "r3"
Signature · 1 line
1.7.6
#2 lore raw

Re: [RFC PATCH 1/1] self-hosted-image: generate the .hdddirect and .vmdk image files

Hi Dexuan,

Please include a complete patch header. Much of your 0/1 content can go here.

Comments below...

Quoted 19 lines · Dexuan Cui
---
 meta/classes/boot-directdisk.bbclass          |   10 +++++++++-
 meta/recipes-core/images/self-hosted-image.bb |   11 +++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/boot-directdisk.bbclass +1 -0
index 8879ba8..83ec929 100644
@@ -24,6 +24,7 @@ do_bootdirectdisk[depends] += "dosfstools-native:do_populate_sysroot \
                                syslinux-native:do_populate_sysroot \
                                parted-native:do_populate_sysroot \
                                mtools-native:do_populate_sysroot "
+do_bootdirectdisk[depends] += "qemu-native:do_populate_sysroot"
 
 PACKAGES = " "
 EXCLUDE_FROM_WORLD = "1"

meta/classes/boot-directdisk.bbclass BOOTDD_EXTRA_SPACE ?= "16384" · line 42

Quoted 5 lines
meta/classes/boot-directdisk.bbclass +1 -1
@@ -38,7 +39,7 @@ BOOTDD_EXTRA_SPACE ?= "16384"
 
 AUTO_SYSLINUXCFG = "1"
 LABELS = "boot"
-APPEND = "root=/dev/sda2"
+APPEND = "root=/dev/hda2"

This seems like it had the potential to break other uses of hdddirect. Qemu may use hda2, but other hdddirect users (external layers for example) may not. This feels like a MACHINE config to me. In fact, machine's do already set APPEND for things like the console.

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 54

Quoted 8 lines
meta/classes/boot-directdisk.bbclass +1 -0
 TIMEOUT = "10"
 SYSLINUXCFG  = "${HDDDIR}/syslinux.cfg"
 SYSLINUXMENU = "${HDDDIR}/menu"
@@ -50,6 +51,7 @@ build_boot_dd() {
 
 	install -d ${HDDDIR}
 	install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage ${HDDDIR}/vmlinuz
+	install -m 0644 ${S}/syslinux.cfg ${HDDDIR}/syslinux.cfg

Hrm... syslinux.cfg wasn't installed before at all?

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 90

Quoted 10 lines
meta/classes/boot-directdisk.bbclass +3 -0
 	install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys
 
 	BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
@@ -83,6 +85,12 @@ build_boot_dd() {
 	cd ${DEPLOY_DIR_IMAGE}
 	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
 	ln -s ${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
+
+	if [ "${NOVMDK}" != "1" ] ; then
+		${STAGING_BINDIR_NATIVE}/qemu-img convert -O vmdk   \

You've added a dependency on qemu-img, please add the appropriate DEPENDS above.

Quoted 26 lines
meta/classes/boot-directdisk.bbclass +3 -0
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect \
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
+	fi
 } 
 
 python do_bootdirectdisk() {
meta/recipes-core/images/self-hosted-image.bb +9 -2
index 111c057..df6c81f 100644
@@ -6,6 +6,13 @@ POKY_EXTRA_INSTALL = "\
 
 IMAGE_FEATURES += "x11-mini"
 
-inherit core-image
+# Needed by boot-directdisk
+ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.ext3"
 
-PR = "r2"
+inherit core-image boot-directdisk
+
+do_bootimg[depends] += "${INITRD_IMAGE}:do_rootfs"
+do_bootimg[depends] += "${IMAGE_BASENAME}:do_rootfs"
+do_bootdirectdisk[depends] += "${PN}:do_rootfs"
+
+PR = "r3"
Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
#3 lore raw

Re: [RFC PATCH 1/1] self-hosted-image: generate the .hdddirect and .vmdk image files

Darren Hart wrote on 2012-01-13:

Quoted 4 lines

Hi Dexuan,

Please include a complete patch header. Much of your 0/1 content can go here.

(Sorry for the late reply! I overlooked the mails...) Ok, I'll pay attention to this in future.

Quoted 25 lines

Comments below...

Quoted 22 lines · Dexuan Cui
---
 meta/classes/boot-directdisk.bbclass          |   10 +++++++++-
 meta/recipes-core/images/self-hosted-image.bb |   11 +++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/meta/classes/boot-directdisk.bbclass index 8879ba8..83ec929 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass @@ -24,6 +24,7 @@ do_bootdirectdisk[depends] += "dosfstools-native:do_populate_sysroot \

syslinux-native:do_populate_sysroot \

parted-native:do_populate_sysroot \

mtools-native:do_populate_sysroot " +do_bootdirectdisk[depends] += "qemu-native:do_populate_sysroot"

PACKAGES = " "
EXCLUDE_FROM_WORLD = "1"

(quoted diff) +0 -0
@@ -38,7 +39,7 @@ BOOTDD_EXTRA_SPACE ?= "16384"
 
Quoted 7 lines

meta/classes/boot-directdisk.bbclass BOOTDD_EXTRA_SPACE ?= "16384" · line 42

Quoted 4 lines
meta/classes/boot-directdisk.bbclass +1 -1
 AUTO_SYSLINUXCFG = "1"
 LABELS = "boot"
-APPEND = "root=/dev/sda2"
+APPEND = "root=/dev/hda2"

This seems like it had the potential to break other uses of hdddirect. Qemu may use hda2, but other hdddirect users (external layers for

Hi Darren, thanks for pointing this out!
I thought it's ok since now I'm the only user ofhdddirect, but I didn't realize I might break external layers...

Quoted 2 lines

example) may not. This feels like a MACHINE config to me. In fact, machine's do already set APPEND for things like the console.

I agree.
So, I think here we should change the = to ?= like the below -APPEND = "root=/dev/sda2"
+APPEND ?= "root=/dev/sda2"
And in meta/conf/machine/include/qemu.inc, I can add a line APPEND = "root=/dev/hda2".

Does this sound ok?

Quoted 6 lines
Quoted 6 lines
meta/classes/boot-directdisk.bbclass +0 -0
 TIMEOUT = "10"
 SYSLINUXCFG  = "${HDDDIR}/syslinux.cfg"
 SYSLINUXMENU = "${HDDDIR}/menu"
@@ -50,6 +51,7 @@ build_boot_dd() {
 
Quoted 6 lines

Review build_boot_dd() { · line 53

Quoted 2 lines
(quoted diff) +0 -0
 	install -d ${HDDDIR}
 	install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage

${HDDDIR}/vmlinuz

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 54

Quoted 1 line
meta/classes/boot-directdisk.bbclass +1 -0
+	install -m 0644 ${S}/syslinux.cfg ${HDDDIR}/syslinux.cfg

Hrm... syslinux.cfg wasn't installed before at all?

I'm not very clear about the history, but according to syslinux.bbclass,
iso and hddimg do invoke syslinux_populate, but hdddirect doesn't -- I suppose hdddirect doesn't need all the functionality of build_syslinux_menu, so it tries to install the files itself, and unluckily it misses syslinux.cfg. Now there is no user of .hdddirect in poky, and I don't know there is any actual external user. This may explain why nobody complains. :-)

Quoted 4 lines
Quoted 4 lines
(quoted diff) +0 -0
 	install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys

${HDDDIR}/ldlinux.sys

Quoted 11 lines

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 90

Quoted 8 lines

BLOCKS=du -bks ${HDDDIR} | cut -f 1 @@ -83,6 +85,12 @@
build_boot_dd() { cd ${DEPLOY_DIR_IMAGE} rm -f
${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect ln -s
${IMAGE_NAME}.hdddirect
${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect

meta/classes/boot-directdisk.bbclass +3 -0
+
+	if [ "${NOVMDK}" != "1" ] ; then
+		${STAGING_BINDIR_NATIVE}/qemu-img convert -O vmdk   \

You've added a dependency on qemu-img, please add the appropriate DEPENDS above.

I have added the line in my patch:
do_bootdirectdisk[depends] += "qemu-native:do_populate_sysroot"

I think this is enough?
Need I add "DEPENDS += "qemu-native", too?

Quoted 11 lines

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 96

Quoted 7 lines
meta/classes/boot-directdisk.bbclass +3 -0
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect \
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
+	fi
 }
 
 python do_bootdirectdisk() {

Darren Hart wrote on 2012-01-13:
On 01/10/2012 10:53 AM, Dexuan Cui wrote:

Quoted 5 lines

A couple additional thoughts about the boot-directdisk class in general:

So build_boot_dd needs a careful audit to ensure the various dd commands do not stomp on eachother iirc, the dd of syslinux/mbr.bin was stomping on the partition table or some such.

Hi Darren,
The dd-ing of mbr.bin actually writes only the first 440 bytes of $IMAGE -- please note the size of mbr.bin(generated by the recipe syslinux, I think) is 440 bytes rather than 512 bytes. :-) I think 440 is safe enough because it's even smaller than 512-16*4=448 bytes.

Quoted 3 lines

Also note that it uses "mkdosfs -d" which we have purged (and it aint coming back if my NACK is worth anything ;-). Sounds like we need to abstract building msdos images into an msdosfs.bbclass. No reason to

Would you volunteer to make a msdosfs.bbclass? :-)

Quoted 2 lines

duplicate all the fatfs overhead calculations I did yesterday (See the patch I sent yesterday to bootimg.bbclass).

I agree.
I see your patch has been in poky master now.
If you could help to make msdosfs.bbclass, I would appreciate that a lot.
Now I'm stick in something else and I'm afraid I can't start to work on this immediately. :-(

Thanks,
-- Dexuan

#4 lore raw

Re: [RFC PATCH 1/1] self-hosted-image: generate the .hdddirect and .vmdk image files

Quoted 52 lines · Dexuan

Darren Hart wrote on 2012-01-13:

Quoted 4 lines

Hi Dexuan,

Please include a complete patch header. Much of your 0/1 content can go here.

(Sorry for the late reply! I overlooked the mails...) Ok, I'll pay attention to this in future.

Quoted 25 lines

Comments below...

Quoted 22 lines · Dexuan Cui
---
 meta/classes/boot-directdisk.bbclass          |   10 +++++++++-
 meta/recipes-core/images/self-hosted-image.bb |   11 +++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/meta/classes/boot-directdisk.bbclass index 8879ba8..83ec929 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass @@ -24,6 +24,7 @@ do_bootdirectdisk[depends] += "dosfstools-native:do_populate_sysroot \

syslinux-native:do_populate_sysroot \

parted-native:do_populate_sysroot \

mtools-native:do_populate_sysroot " +do_bootdirectdisk[depends] += "qemu-native:do_populate_sysroot"

PACKAGES = " "
EXCLUDE_FROM_WORLD = "1"

(quoted diff) +0 -0
@@ -38,7 +39,7 @@ BOOTDD_EXTRA_SPACE ?= "16384"
 
Quoted 7 lines

meta/classes/boot-directdisk.bbclass BOOTDD_EXTRA_SPACE ?= "16384" · line 42

Quoted 4 lines
meta/classes/boot-directdisk.bbclass +1 -1
 AUTO_SYSLINUXCFG = "1"
 LABELS = "boot"
-APPEND = "root=/dev/sda2"
+APPEND = "root=/dev/hda2"

This seems like it had the potential to break other uses of hdddirect. Qemu may use hda2, but other hdddirect users (external layers for

Hi Darren, thanks for pointing this out!
I thought it's ok since now I'm the only user ofhdddirect, but I didn't realize I might break external layers...

Quoted 2 lines

example) may not. This feels like a MACHINE config to me. In fact, machine's do already set APPEND for things like the console.

I agree.
So, I think here we should change the = to ?= like the below

(quoted diff) +1 -1
-APPEND = "root=/dev/sda2"
+APPEND ?= "root=/dev/sda2"

And in meta/conf/machine/include/qemu.inc, I can add a line APPEND = "root=/dev/hda2".

Quoted 1 line

Does this sound ok?

That seems appropriate to me.

Quoted 13 lines
Quoted 7 lines
Quoted 7 lines
meta/classes/boot-directdisk.bbclass +0 -0
 TIMEOUT = "10"
 SYSLINUXCFG  = "${HDDDIR}/syslinux.cfg"
 SYSLINUXMENU = "${HDDDIR}/menu"
@@ -50,6 +51,7 @@ build_boot_dd() {
 
Quoted 6 lines

Review build_boot_dd() { · line 53

Quoted 2 lines
(quoted diff) +0 -0
 	install -d ${HDDDIR}
 	install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage

${HDDDIR}/vmlinuz

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 54

Quoted 1 line
meta/classes/boot-directdisk.bbclass +1 -0
+	install -m 0644 ${S}/syslinux.cfg ${HDDDIR}/syslinux.cfg

Hrm... syslinux.cfg wasn't installed before at all?

Quoted 8 lines

I'm not very clear about the history, but according to syslinux.bbclass, iso and hddimg do invoke syslinux_populate, but hdddirect doesn't -- I
suppose hdddirect doesn't need all the functionality of build_syslinux_menu, so it tries to install the files itself, and unluckily it misses syslinux.cfg. Now there is no user of .hdddirect in poky, and I don't know there is any actual external user. This may explain why nobody complains. :-)

This sounds like an opportunity to modularize and reuse to me.

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
(quoted diff) +0 -0
 	install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys

${HDDDIR}/ldlinux.sys

Quoted 11 lines

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 90

Quoted 8 lines

BLOCKS=du -bks ${HDDDIR} | cut -f 1 @@ -83,6 +85,12 @@
build_boot_dd() { cd ${DEPLOY_DIR_IMAGE} rm -f
${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect ln -s
${IMAGE_NAME}.hdddirect
${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect

meta/classes/boot-directdisk.bbclass +3 -0
+
+	if [ "${NOVMDK}" != "1" ] ; then
+		${STAGING_BINDIR_NATIVE}/qemu-img convert -O vmdk   \

You've added a dependency on qemu-img, please add the appropriate DEPENDS above.

Quoted 5 lines

I have added the line in my patch:
do_bootdirectdisk[depends] += "qemu-native:do_populate_sysroot"

I think this is enough?
Need I add "DEPENDS += "qemu-native", too?

No, I don't think so. Is do_populate_sysroot the right task? That would be my guess as well, but we should be confident.

Quoted 22 lines
Quoted 12 lines

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 96

Quoted 8 lines
meta/classes/boot-directdisk.bbclass +3 -0
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect \
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
+	fi
 }
 
 python do_bootdirectdisk() {

Darren Hart wrote on 2012-01-13:
On 01/10/2012 10:53 AM, Dexuan Cui wrote:

Quoted 5 lines

A couple additional thoughts about the boot-directdisk class in general:

So build_boot_dd needs a careful audit to ensure the various dd commands do not stomp on eachother iirc, the dd of syslinux/mbr.bin was stomping on the partition table or some such.

Hi Darren,
The dd-ing of mbr.bin actually writes only the first 440 bytes of $IMAGE -- please note the size of mbr.bin(generated by the recipe syslinux, I think) is 440 bytes rather than 512 bytes. :-) I think 440 is safe enough because it's even smaller than 512-16*4=448 bytes.

Quoted 4 lines
Quoted 3 lines

Also note that it uses "mkdosfs -d" which we have purged (and it aint coming back if my NACK is worth anything ;-). Sounds like we need to abstract building msdos images into an msdosfs.bbclass. No reason to

Would you volunteer to make a msdosfs.bbclass? :-)

Not in the near future unfortunately, I'm heavily overloaded as it is. That said, please open a bug and we can find an appropriate owner.

Quoted 8 lines
Quoted 3 lines

duplicate all the fatfs overhead calculations I did yesterday (See the patch I sent yesterday to bootimg.bbclass).

I agree.
I see your patch has been in poky master now.
If you could help to make msdosfs.bbclass, I would appreciate that a lot.
Now I'm stick in something else and I'm afraid I can't start to work on this immediately. :-(

Understood. Open the bug and explain what's needed and we'll prioritize and assign it. There may also be others who would like this feature that would be willing to pick up the task.

Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
#5 lore raw

Re: [RFC PATCH 1/1] self-hosted-image: generate the .hdddirect and .vmdk image files

Darren Hart wrote on 2012-01-17:

Quoted 11 lines · Dexuan
Quoted 8 lines

Darren Hart wrote on 2012-01-13:
So, I think here we should change the = to ?= like the below -APPEND = "root=/dev/sda2"
+APPEND ?= "root=/dev/sda2"
And in meta/conf/machine/include/qemu.inc, I can add a line APPEND = "root=/dev/hda2".

Does this sound ok?

That seems appropriate to me.

I decide not to change the line in boot-directdisk.bbclass and I think adding a line
APPEND_${MACHINE} = "root=/dev/hda2"
in qemu.inc should be ok.
This is because ?= can have some side effort, i.e., in the case of atom, in atom-pc.conf, APPEND is already assigned a value that isn't suitable for syslinux.

Quoted 21 lines
Quoted 13 lines
Quoted 7 lines
Quoted 7 lines

TIMEOUT = "10"
SYSLINUXCFG = "${HDDDIR}/syslinux.cfg"
SYSLINUXMENU = "${HDDDIR}/menu"

(quoted diff) +0 -0
@@ -50,6 +51,7 @@ build_boot_dd() {
 
Quoted 6 lines

Review build_boot_dd() { · line 53

Quoted 2 lines
(quoted diff) +0 -0
 	install -d ${HDDDIR}
 	install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage

${HDDDIR}/vmlinuz

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 54

Quoted 1 line
meta/classes/boot-directdisk.bbclass +1 -0
+	install -m 0644 ${S}/syslinux.cfg ${HDDDIR}/syslinux.cfg

Hrm... syslinux.cfg wasn't installed before at all?

Quoted 7 lines

I'm not very clear about the history, but according to syslinux.bbclass, iso and hddimg do invoke syslinux_populate, but hdddirect doesn't -- I suppose hdddirect doesn't need all the functionality of build_syslinux_menu, so it tries to install the files itself, and unluckily it misses syslinux.cfg. Now there is no user of .hdddirect in poky, and I don't know there is any actual external user. This may explain why nobody complains. :-)

Quoted 1 line

This sounds like an opportunity to modularize and reuse to me.

Agree. We should try to improve the code here in future.

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 90

Quoted 13 lines
(quoted diff) +0 -0
 	install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys

${HDDDIR}/ldlinux.sys

BLOCKS=du -bks ${HDDDIR} | cut -f 1 @@ -83,6 +85,12 @@
build_boot_dd() { cd ${DEPLOY_DIR_IMAGE} rm -f
${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect ln -s
${IMAGE_NAME}.hdddirect
${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect

meta/classes/boot-directdisk.bbclass +3 -0
+
+	if [ "${NOVMDK}" != "1" ] ; then
+		${STAGING_BINDIR_NATIVE}/qemu-img convert -O vmdk   \

You've added a dependency on qemu-img, please add the appropriate DEPENDS above.

Quoted 8 lines
Quoted 5 lines

I have added the line in my patch:
do_bootdirectdisk[depends] += "qemu-native:do_populate_sysroot"

I think this is enough?
Need I add "DEPENDS += "qemu-native", too?

No, I don't think so. Is do_populate_sysroot the right task? That would be my guess as well, but we should be confident.

I think it should be ok: do_populate_sysroot installs the utility qemu-img into the sysroot and this is all we need.

Quoted 22 lines
Quoted 22 lines
Quoted 11 lines

meta/classes/boot-directdisk.bbclass build_boot_dd() { · line 96

Quoted 7 lines
meta/classes/boot-directdisk.bbclass +2 -0
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect \
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk +	fi
 }
 
 python do_bootdirectdisk() {

Darren Hart wrote on 2012-01-13:
On 01/10/2012 10:53 AM, Dexuan Cui wrote:

Quoted 5 lines

A couple additional thoughts about the boot-directdisk class in general:

So build_boot_dd needs a careful audit to ensure the various dd commands do not stomp on eachother iirc, the dd of syslinux/mbr.bin was stomping on the partition table or some such.

Hi Darren, The dd-ing of mbr.bin actually writes only the first 440 bytes of $IMAGE -- please note the size of mbr.bin(generated by the recipe syslinux, I think) is 440 bytes rather than 512 bytes. :-) I think 440 is safe enough because it's even smaller than 512-16*4=448 bytes.

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

Also note that it uses "mkdosfs -d" which we have purged (and it aint coming back if my NACK is worth anything ;-). Sounds like we need to abstract building msdos images into an msdosfs.bbclass. No reason to

Would you volunteer to make a msdosfs.bbclass? :-)

Not in the near future unfortunately, I'm heavily overloaded as it is. That said, please open a bug and we can find an appropriate owner.

Ok, I opened a bug http://bugzilla.pokylinux.org/show_bug.cgi?id=1913.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

duplicate all the fatfs overhead calculations I did yesterday (See the patch I sent yesterday to bootimg.bbclass).

I agree.
I see your patch has been in poky master now.
If you could help to make msdosfs.bbclass, I would appreciate that a lot. Now I'm stick in something else and I'm afraid I can't start to work on this immediately. :-(

Quoted 3 lines

Understood. Open the bug and explain what's needed and we'll prioritize and assign it. There may also be others who would like this feature that would be willing to pick up the task.

Hi Darren,
Thanks for all the comments!
I'll send out the v2 patch and Cc you.

Thanks,
-- Dexuan

#6 lore raw

Re: [RFC PATCH 1/1] self-hosted-image: generate the .hdddirect and .vmdk image files

In reply to Dexuan Cui
Quoted 1 line · Dexuan Cui

A couple additional thoughts about the boot-directdisk class in general:

So build_boot_dd needs a careful audit to ensure the various dd commands do not stomp on eachother iirc, the dd of syslinux/mbr.bin was stomping on the partition table or some such.

Also note that it uses "mkdosfs -d" which we have purged (and it aint coming back if my NACK is worth anything ;-). Sounds like we need to abstract building msdos images into an msdosfs.bbclass. No reason to duplicate all the fatfs overhead calculations I did yesterday (See the patch I sent yesterday to bootimg.bbclass).

--
Darren

Quoted 67 lines
---
 meta/classes/boot-directdisk.bbclass          |   10 +++++++++-
 meta/recipes-core/images/self-hosted-image.bb |   11 +++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/boot-directdisk.bbclass +9 -1
index 8879ba8..83ec929 100644
@@ -24,6 +24,7 @@ do_bootdirectdisk[depends] += "dosfstools-native:do_populate_sysroot \
                                syslinux-native:do_populate_sysroot \
                                parted-native:do_populate_sysroot \
                                mtools-native:do_populate_sysroot "
+do_bootdirectdisk[depends] += "qemu-native:do_populate_sysroot"
 
 PACKAGES = " "
 EXCLUDE_FROM_WORLD = "1"
@@ -38,7 +39,7 @@ BOOTDD_EXTRA_SPACE ?= "16384"
 
 AUTO_SYSLINUXCFG = "1"
 LABELS = "boot"
-APPEND = "root=/dev/sda2"
+APPEND = "root=/dev/hda2"
 TIMEOUT = "10"
 SYSLINUXCFG  = "${HDDDIR}/syslinux.cfg"
 SYSLINUXMENU = "${HDDDIR}/menu"
@@ -50,6 +51,7 @@ build_boot_dd() {
 
 	install -d ${HDDDIR}
 	install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage ${HDDDIR}/vmlinuz
+	install -m 0644 ${S}/syslinux.cfg ${HDDDIR}/syslinux.cfg
 	install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys
 
 	BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
@@ -83,6 +85,12 @@ build_boot_dd() {
 	cd ${DEPLOY_DIR_IMAGE}
 	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
 	ln -s ${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
+
+	if [ "${NOVMDK}" != "1" ] ; then
+		${STAGING_BINDIR_NATIVE}/qemu-img convert -O vmdk   \
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect \
+			${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
+	fi
 } 
 
 python do_bootdirectdisk() {
meta/recipes-core/images/self-hosted-image.bb +9 -2
index 111c057..df6c81f 100644
@@ -6,6 +6,13 @@ POKY_EXTRA_INSTALL = "\
 
 IMAGE_FEATURES += "x11-mini"
 
-inherit core-image
+# Needed by boot-directdisk
+ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.ext3"
 
-PR = "r2"
+inherit core-image boot-directdisk
+
+do_bootimg[depends] += "${INITRD_IMAGE}:do_rootfs"
+do_bootimg[depends] += "${IMAGE_BASENAME}:do_rootfs"
+do_bootdirectdisk[depends] += "${PN}:do_rootfs"
+
+PR = "r3"
Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel