Bug 12153

Summary: in an esdk, devtool fails to build ovmf
Product: [Yocto Project Subprojects] eSDK Reporter: brian avery <brian.avery>
Component: eSDKAssignee: Unassigned <unassigned>
Status: ACCEPTED --- QA Contact: Francisco Pedraza <francisco.j.pedraza.gonzalez>
Severity: normal    
Priority: Medium CC: bluelightning, randy.macleod, richard.purdie, sgw
Version: 2.4   
Target Milestone: 5.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description brian avery 2017-10-02 20:20:52 UTC
off of master, in an esdk built for core-image-base genericx86-64 and wic, suppose we want to boot the genericx86-64 image in qemu.

In order to do this, you need to run qemu with ovmf since the default genericx86-64 uses grub-efi.

Unfortuneately,
esdk$>devtool modify ovmf
esdk$>devtool build ovmf 
the build fails with:
edksetup.sh: line 88: tmp/work/core2-64-poky-linux/ovmf/git-r0/devtooltmp-08kyux9h/workdir/recipe-sysroot-native/usr/bin/edk2_basetools/BaseTools/BuildEnv: No such file or directory
Comment 1 Saul Wold 2017-10-04 20:45:04 UTC
This is built with adding wic to IMAGE_FSTYPES and enabling booting in qmeu.
Comment 2 Rebecca Chang 2017-11-15 03:51:49 UTC
(In reply to comment #1)
> This is built with adding wic to IMAGE_FSTYPES and enabling booting in qmeu.

I'm trying to reproduce the issue here. Do you mean, by adding wic to IMAGE_FSTYPES in local.conf, we can boot genericx86-64 image in qemu?

MACHINE = "genericx86-64"
IMAGE_FSTYPES += "wic"

I've tried the above configurations but runqemu failed. Is there any configurations that is missing?
----- snip -----
$ runqemu tmp/deploy/images/genericx86-64/core-image-base-genericx86-64.wic
runqemu - INFO - Running MACHINE=genericx86-64 bitbake -e...
runqemu - INFO - Overriding conf file setting of STAGING_DIR_NATIVE to /media/rebeccas/yocto/12153/tmp/work/core2-64-poky-linux/defaultpkgname/1.0-r0/recipe-sysroot-native from Bitbake environment
runqemu - INFO - Continuing with the following parameters:

MACHINE: [genericx86-64]
FSTYPE: [wic]
ROOTFS: [/media/rebeccas/yocto/12153/tmp/deploy/images/genericx86-64/core-image-base-genericx86-64.wic]
CONFFILE: [/media/rebeccas/yocto/12153/tmp/deploy/images/genericx86-64/core-image-base-genericx86-64.qemuboot.conf]

runqemu - INFO - Setting up tap interface under sudo
runqemu - INFO - Running bitbake qemu-helper-native -e...
runqemu - ERROR - Native sysroot directory /media/rebeccas/yocto/12153/tmp/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin doesn't exist
Cleanup

----- snip -----
Comment 3 Rebecca Chang 2018-01-03 07:05:05 UTC
It seems like the sysroot for ovmf-native is not being build when we build ovmf in eSDK.
Comment 4 Rebecca Chang 2018-01-10 08:23:55 UTC
I have drilled down to the point where devtool unable to find edksetup.sh due to the wrongly configured variable BBAKE_EDK_TOOLS_PATH in <ovmf-source>/OvmfPkg/build.sh and it came from a environment variable, STAGING_BINDIR_NATIVE.

Within a native build environment, EDK_TOOLS_PATH was set by do_patch post task functions, "fix_basetools_location". And its STAGING_BINDIR_NATIVE is pointed to RSS by looking at the output from “bitbake -e”.

However, in eSDK environment, patching was done by oe.patch module in within devtool. And it appears that the STAGING_BINDIR_NATIVE is wrongly set, hence causing BBAKE_EDK_TOOLS_PATH having the wrong BBAKE_EDK_TOOLS_PATH path and hence causing ovmf unable to be compiled within eSDK.

Problematic STAGING_BINDIR_NATIVE:
/poky_sdk/tmp/work/i586-poky-linux/ovmf/git-r0/devtooltmp-sui06mnf/workdir/recipe-sysroot-native/usr/bin/edk2_basetools/BaseTools

A correct STAGING_BINDIR_NATIVE:
/poky_sdk/tmp/work/i586-poky-linux/ovmf/git-r0/recipe-sysroot-native/usr/bin/edk2_basetools/BaseTools

I'm now looking at devtool standard.py <def _extract_source()> where devtooltmp-* was created and how does it impact the STAGING_BINDIR_NATIVE.
Comment 5 Rebecca Chang 2018-04-03 19:06:04 UTC
In fix_basetools_location_class-target():

- sed -i -e 's#BBAKE_EDK_TOOLS_PATH#${STAGING_BINDIR_NATIVE}/${EDK_TOOLS_DIR}#' ${S}/OvmfPkg/build.sh
+ sed -i -e 's#BBAKE_EDK_TOOLS_PATH#$STAGING_BINDIR_NATIVE/${EDK_TOOLS_DIR}#' ${S}/OvmfPkg/build.sh

This will fix the issue in eSDK but crashing normal build.
Comment 6 Randy MacLeod 2023-10-24 14:24:30 UTC
Bulk move from 4.99 or 0.00 to 5.99
Comment 7 Randy MacLeod 2025-02-14 16:46:36 UTC
bulk change to add Saul's non-WR address.
Comment 8 Randy MacLeod 2025-02-14 16:48:23 UTC
Bulk change: Remove Saul's old WR address.