From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.5595.1583460113905782964 for ; Thu, 05 Mar 2020 18:01:54 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: bob.c.feng@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2020 18:01:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,520,1574150400"; d="scan'208";a="234635564" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga008.jf.intel.com with ESMTP; 05 Mar 2020 18:01:50 -0800 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 5 Mar 2020 18:01:50 -0800 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX603.ccr.corp.intel.com (10.109.6.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 6 Mar 2020 10:01:47 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.1713.004; Fri, 6 Mar 2020 10:01:47 +0800 From: "Bob Feng" To: "devel@edk2.groups.io" , "ard.biesheuvel@linaro.org" CC: "lersek@redhat.com" Subject: Re: [edk2-devel] [PATCH v3 00/14] Ovmf: use LoadImage/StartImage for loading command line images Thread-Topic: [edk2-devel] [PATCH v3 00/14] Ovmf: use LoadImage/StartImage for loading command line images Thread-Index: AQHV8vRxTQbMeHhnbUqlot4Oj1t1x6g6zznQ Date: Fri, 6 Mar 2020 02:01:47 +0000 Message-ID: <98e6a0e0f82048a2b20b263c4f752fcc@intel.com> References: <20200305134607.20125-1-ard.biesheuvel@linaro.org> In-Reply-To: <20200305134607.20125-1-ard.biesheuvel@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ard, I found this patch set cause Ovmf platform build failure on windows with V= S2017.=20 The error message is as following: Generating code d:\edk2\OvmfPkg\QemuKernelLoaderFsDxe\QemuKernelLoaderFsDxe.c(130): error = C2220: warning treated as error - no 'object' file generated d:\edk2\OvmfPkg\QemuKernelLoaderFsDxe\QemuKernelLoaderFsDxe.c(130): warnin= g C4132: 'mEfiFileProtocolTemplate': const object should be initialized TcpTimer.c Finished generating code NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studi= o\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\cl.exe"' : retu= rn code '0x2' Stop. build.py... : error 7000: Failed to execute command C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\= Tools\MSVC\14.16.27023\bin\Hostx86\x86\nmake.exe /nologo tbuild [d:\edk2\Bu= ild\OvmfIa32\DEBUG_VS2017\IA32\OvmfPkg\QemuKernelLoaderFsDxe\QemuKernelLoad= erFsDxe] build.py... : error F002: Failed to build module d:\edk2\OvmfPkg\QemuKernelLoaderFsDxe\QemuKernelLoaderFsDxe.inf [I= A32, VS2017, DEBUG] Please help to provide patch to fix it. Thanks, Bob -----Original Message----- From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ard = Biesheuvel Sent: Thursday, March 5, 2020 9:46 PM To: devel@edk2.groups.io Cc: lersek@redhat.com; Ard Biesheuvel Subject: [edk2-devel] [PATCH v3 00/14] Ovmf: use LoadImage/StartImage for = loading command line images On ArmVirtQemu, we require the kernel passed via the QEMU -kernel option t= o have a PE/COFF header and an EFI stub, so that it can be loaded and start= ed using the LoadImage and StartImage boot services, respectively. This means that, on builds that enable secure boot or measured boot, the k= ernel image gets authenticated and/or measured as well. On X86, for historical reasons, we never use LoadImage or StartImage, whic= h means that: - kernel images are never authenticated or measured, - calling Exit() from within the boot stub will attempt tp terminate the calling image, which is likely to end badly. So instead, split and generalize the code that exists today for ArmVirtQem= u, and wire it up for x86 so that LoadImage and StartImage are used unless = there is a true need for the special Linux boot protocol. The first 6 patches are only intended to be a refactoring of the existing = code, and should not result in any functional changes for either ArmVirtQem= u or OVMF. Patch #12 (now #13 adds the new Linux specific initrd loadfile2 protocol t= hat aims to simplify initrd loading from Linux when booting via the PE stub= . Patch #13 (now #14) is optional, and disables the Linux loader fallback on= builds that have secure boot enabled. Changes since [v2]: - rename gX86QemuKernelLoadedImageGuid to gOvmfLoadedX86LinuxKernelProtoco= lGuid, and define the associated struct type OVMF_LOADED_X86_LINUX_KERNEL in th= e protocol header file - mention that the new protocol is internal ABI and subject to backward incompatible change at any time - align legacy loader logic more closely with the generic one - modify legacy mixed mode handling to prevent returning a stale handle - add Laszlo's ack to #4, #6, #8, #12 and #13 - fix up some style issues and out of date/inaccurate comments (Laszlo) Changes since [v1]: - handle EFI_SECURITY_VIOLATION return codes from gBS->LoadImage inside th= e QemuLoadImageLib implementation consistently, instead of propagating it - change the prototype of QemuStartKernelImage () to take the handle by reference, allowing the fallback x86 code to reload the image onto a fresh handle if needed - add new patch to declare gX86QemuKernelLoadedImageGuid, and make it a true protocol instead of just a GUID - drop unnecessary 'wrapper' struct around QEMU_LEGACY_LOADED_IMAGE (#10) - switch to QemuFwCfgRead32() consistently - fix numerous other minor style and logic issues pointed out by Laszlo - add Laszlo's ack to #1, #2, #3, #5, #7, #11 and #14 (*) (*) v2+ numbering Code can be found here: https://github.com/ardbiesheuvel/edk2/tree/ovmf-loadimage-startimage-v1 https://github.com/ardbiesheuvel/edk2/tree/ovmf-loadimage-startimage-v2 https://github.com/ardbiesheuvel/edk2/tree/ovmf-loadimage-startimage-v3 [v1] http://mid.mail-archive.com/20200302072936.29221-1-ard.biesheuvel@lin= aro.org [v2] http://mid.mail-archive.com/20200304095233.21046-1-ard.biesheuvel@lin= aro.org Ard Biesheuvel (14): OvmfPkg: add GUID for the QEMU kernel loader fs media device path OvmfPkg: export abstract QEMU blob filesystem in standalone driver OvmfPkg: introduce QemuLoadImageLib library class OvmfPkg: provide a generic implementation of QemuLoadImageLib ArmVirtPkg: incorporate the new QEMU kernel loader driver and library ArmVirtPkg/PlatformBootManagerLib: switch to separate QEMU loader OvmfPkg/QemuKernelLoaderFsDxe: don't expose kernel command line OvmfPkg/QemuKernelLoaderFsDxe: add support for the kernel setup block OvmfPkg: create protocol and GUID header for loaded x86 Linux kernels OvmfPkg: implement QEMU loader library for X86 with legacy fallback OvmfPkg: add new QEMU kernel image loader components OvmfPkg/PlatformBootManagerLib: switch to QemuLoadImageLib OvmfPkg/QemuKernelLoaderFsDxe: add support for new Linux initrd device path OvmfPkg: use generic QEMU image loader for secure boot enabled builds ArmVirtPkg/ArmVirtQemu.dsc | 2 + ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 1 + ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 + .../PlatformBootManagerLib.inf | 9 +- .../PlatformBootManagerLib/QemuKernel.c | 1061 +---------------- .../Include/Guid/QemuKernelLoaderFsMedia.h | 18 + OvmfPkg/Include/Library/QemuLoadImageLib.h | 84 ++ .../Protocol/OvmfLoadedX86LinuxKernel.h | 32 + .../GenericQemuLoadImageLib.c | 276 +++++ .../GenericQemuLoadImageLib.inf | 38 + .../PlatformBootManagerLib.inf | 2 +- .../PlatformBootManagerLib/QemuKernel.c | 144 +-- .../X86QemuLoadImageLib/X86QemuLoadImageLib.c | 567 +++++++++ .../X86QemuLoadImageLib.inf | 42 + OvmfPkg/OvmfPkg.dec | 57 +- OvmfPkg/OvmfPkgIa32.dsc | 6 + OvmfPkg/OvmfPkgIa32.fdf | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 6 + OvmfPkg/OvmfPkgIa32X64.fdf | 1 + OvmfPkg/OvmfPkgX64.dsc | 6 + OvmfPkg/OvmfPkgX64.fdf | 1 + .../QemuKernelLoaderFsDxe.c | 367 +++--- .../QemuKernelLoaderFsDxe.inf | 50 + 23 files changed, 1354 insertions(+), 1419 deletions(-) create mode 1006= 44 OvmfPkg/Include/Guid/QemuKernelLoaderFsMedia.h create mode 100644 OvmfPkg/Include/Library/QemuLoadImageLib.h create mode 100644 OvmfPkg/Include/Protocol/OvmfLoadedX86LinuxKernel.h create mode 100644 OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoa= dImageLib.c create mode 100644 OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoa= dImageLib.inf create mode 100644 OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLi= b.c create mode 100644 OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLi= b.inf copy ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c =3D> OvmfPkg/= QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c (77%) create mode 100644 Ovm= fPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf -- 2.17.1