Re: [OE-core] [PATCH v4 05/12] ovmf: deploy firmware in image directory

2017-01-27 Thread Patrick Ohly
On Thu, 2017-01-26 at 19:25 -0800, Ricardo Neri wrote:
> On Mon, 2017-01-23 at 08:45 +0100, Patrick Ohly wrote:
> > > On the other hand, this is a new recipe and this may not be super
> > > critical. Especially if you meant that only OVMF will not support
> > > installing bios.bin in sysroot. Maybe all is needed is some
> > > clarification in the commit message.
> > 
> > Care to suggest something? ;-) To me, "traditional usage of ovmf ...
> > is
> > no longer supported" already says that this is a statement about ovmf,
> > not the bios parameter, so I'm not sure how to reword this.
> 
> Perhaps specifying what "traditional usage" means, both when using
> runqemu or qemu directly. I think this is useful as you devoted a fair
> amount of effort to enable your work in qemu. Mentioning the qemu
> features could be useful to people using qemu directly.

I've tried to make the commit message more useful in V5.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.



-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH v4 05/12] ovmf: deploy firmware in image directory

2017-01-26 Thread Ricardo Neri
On Mon, 2017-01-23 at 08:45 +0100, Patrick Ohly wrote:
> > On the other hand, this is a new recipe and this may not be super
> > critical. Especially if you meant that only OVMF will not support
> > installing bios.bin in sysroot. Maybe all is needed is some
> > clarification in the commit message.
> 
> Care to suggest something? ;-) To me, "traditional usage of ovmf ...
> is
> no longer supported" already says that this is a statement about ovmf,
> not the bios parameter, so I'm not sure how to reword this.

Perhaps specifying what "traditional usage" means, both when using
runqemu or qemu directly. I think this is useful as you devoted a fair
amount of effort to enable your work in qemu. Mentioning the qemu
features could be useful to people using qemu directly.

Thanks and BR,
Ricardo

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH v4 05/12] ovmf: deploy firmware in image directory

2017-01-22 Thread Patrick Ohly
On Sun, 2017-01-22 at 23:23 -0800, Ricardo Neri wrote:
> On Fri, 2017-01-20 at 15:12 +0100, Patrick Ohly wrote:
> > The traditional usage of ovmf via the qemu bios parameter is no longer
> > supported
> 
> I don't see dropping support for this option in this series.
>
>  Is part of
> another series? I just checked the poky repo and I still the the option
> supported. Or do you mean that only the ovmf recipe will not support
> exporting bios.bin?

Yes, the latter.

> > and therefore it is not necessary to create a "bios.bin"
> > file in the target sysroot.
> 
> Wouldn't this particular part of the patch break the existing runqemu.
> If this is the case, perhaps the last patch (or a patch towards the end
> of the series) can remove this functionality in both places.

Could be done, but personally I prefer to add something new before
taking away the old approach. This might not be applicable here (because
there is no other bios), but it still "feels" safer.

> On the other hand, this is a new recipe and this may not be super
> critical. Especially if you meant that only OVMF will not support
> installing bios.bin in sysroot. Maybe all is needed is some
> clarification in the commit message.

Care to suggest something? ;-) To me, "traditional usage of ovmf ... is
no longer supported" already says that this is a statement about ovmf,
not the bios parameter, so I'm not sure how to reword this.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.



-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH v4 05/12] ovmf: deploy firmware in image directory

2017-01-22 Thread Ricardo Neri
On Fri, 2017-01-20 at 15:12 +0100, Patrick Ohly wrote:
> The traditional usage of ovmf via the qemu bios parameter is no longer
> supported

I don't see dropping support for this option in this series. Is part of
another series? I just checked the poky repo and I still the the option
supported. Or do you mean that only the ovmf recipe will not support
exporting bios.bin?

> and therefore it is not necessary to create a "bios.bin"
> file in the target sysroot.

Wouldn't this particular part of the patch break the existing runqemu.
If this is the case, perhaps the last patch (or a patch towards the end
of the series) can remove this functionality in both places.

On the other hand, this is a new recipe and this may not be super
critical. Especially if you meant that only OVMF will not support
installing bios.bin in sysroot. Maybe all is needed is some
clarification in the commit message.

Thanks and BR,
Ricardo

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4 05/12] ovmf: deploy firmware in image directory

2017-01-20 Thread Patrick Ohly
When used with '-drive if=pflash', qemu will store UEFI variables
inside the firmware image file. That is unexpected for a file located in
the sysroot, which should be read-only, while it is normal for image
files in the deploy/images directory. Therefore that directory is a
better place for use with runqemu.

The name was chose so that "runqemu ovmf" can be used as shorthand for
"runqemu /ovmf.qcow2" by treating "ovmf" as the base name
of the BIOS file. "ovmf.secboot.qcow2" is meant to be used for the
Secure Boot enabled firmware.

qcow2 is used because it is needed for "savevm" snapshots of a virtual
machine.

With code and variables stored in the same ovmf.qcow2 it is not
possible to update the firmware code without also overwriting the
variables. For users who care about persistent variables, the code and
variables are also provided as separate files, in ovmf.code.qcow2 and
ovmf.vars.qcow2.

The traditional usage of ovmf via the qemu bios parameter is no longer
supported and therefore it is not necessary to create a "bios.bin"
file in the target sysroot.

Signed-off-by: Patrick Ohly 
---
 meta/recipes-core/ovmf/ovmf_git.bb | 42 ++-
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-core/ovmf/ovmf_git.bb 
b/meta/recipes-core/ovmf/ovmf_git.bb
index 13b583b..895ed6c 100644
--- a/meta/recipes-core/ovmf/ovmf_git.bb
+++ b/meta/recipes-core/ovmf/ovmf_git.bb
@@ -12,11 +12,13 @@ SRC_URI = 
"git://github.com/tianocore/edk2.git;branch=master \
 
 SRCREV="4575a602ca6072ee9d04150b38bfb143cbff8588"
 
+inherit deploy
+
 PARALLEL_MAKE = ""
 
 S = "${WORKDIR}/git"
 
-DEPENDS_class-native="util-linux-native iasl-native ossp-uuid-native"
+DEPENDS_class-native="util-linux-native iasl-native ossp-uuid-native 
qemu-native"
 
 DEPENDS_class-target="ovmf-native"
 
@@ -97,9 +99,22 @@ do_compile_class-target() {
 OVMF_ARCH="IA32"
 fi
 
+# ${WORKDIR}/ovmf is a well-known location where do_install and
+# do_deploy will be able to find the files.
+rm -rf ${WORKDIR}/ovmf
+mkdir ${WORKDIR}/ovmf
+OVMF_DIR_SUFFIX="X64"
+if [ "${TARGET_ARCH}" != "x86_64" ] ; then
+OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
+fi
 FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
-echo FIXED_GCCVER is ${FIXED_GCCVER}
+bbnote FIXED_GCCVER is ${FIXED_GCCVER}
+build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
+
 ${S}/OvmfPkg/build.sh -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER}
+ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd
+ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd
+ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd
 }
 
 do_install_class-native() {
@@ -108,16 +123,21 @@ do_install_class-native() {
 }
 
 do_install_class-target() {
-OVMF_DIR_SUFFIX="X64"
-if [ "${TARGET_ARCH}" != "x86_64" ] ; then
-OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
-fi
-install -d ${D}${datadir}/ovmf
+}
 
-FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
-build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
-install -m 0755 ${build_dir}/FV/OVMF.fd \
-   ${D}${datadir}/ovmf/bios.bin
+do_deploy() {
+}
+do_deploy[cleandirs] = "${DEPLOYDIR}"
+do_deploy_class-target() {
+# For use with "runqemu ovmf".
+for i in \
+ovmf \
+ovmf.code \
+ovmf.vars \
+; do
+qemu-img convert -f raw -O qcow2 ${WORKDIR}/ovmf/$i.fd 
${DEPLOYDIR}/$i.qcow2
+done
 }
+addtask do_deploy after do_compile before do_build
 
 BBCLASSEXTEND = "native"
-- 
git-series 0.9.1
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core