Re: [PATCH v1] ShellPkg: Fix 'ping' command Ip4 receive flow.
Maciej Rabeda
Much appreciated, I'll submit the patch
tomorrow :)
On 31-Mar-20 16:50, Gao, Zhichao wrote:
Acked-by: Zhichao Gao <zhichao.gao@...>-----Original Message----- From: Fu, Siyuan <siyuan.fu@...> Sent: Tuesday, March 31, 2020 7:54 PM To: devel@edk2.groups.io; lersek@...; Ni, Ray <ray.ni@...>; Gao, Zhichao <zhichao.gao@...> Cc: maciej.rabeda@... Subject: RE: [edk2-devel] [PATCH v1] ShellPkg: Fix 'ping' command Ip4 receive flow. Reviewed-by: Siyuan Fu <siyuan.fu@...>-----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Laszlo Ersek Sent: 2020年3月25日 19:34 To: Ni, Ray <ray.ni@...>; Gao, Zhichao <zhichao.gao@...> Cc: devel@edk2.groups.io; maciej.rabeda@... Subject: Re: [edk2-devel] [PATCH v1] ShellPkg: Fix 'ping' command Ip4 receive flow. Ray, Zhichao, On 02/27/20 12:02, Maciej Rabeda wrote:REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2032 'ping' command's receive flow utilizes a single Rx token which it attempts to reuse before recycling the previously received packet. This causes a situation where under ICMP traffic, Ping6OnEchoReplyReceived() function will receive an already recycled packet with EFI_SUCCESS token status and finally dereference invalid pointers from RxData structure. Cc: Ray Ni <ray.ni@...> Cc: Zhichao Gao <zhichao.gao@...> Signed-off-by: Maciej Rabeda <maciej.rabeda@...> --- ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)can you please review this ShellPkg patch? It's been on the list for almost a month now. Thanks Laszlodiff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.cb/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.cindex 23567fa2c1bb..a3fa32515192 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c @@ -614,6 +614,11 @@ Ping6OnEchoReplyReceived ( ON_EXIT: + // + // Recycle the packet before reusing RxToken // + gBS->SignalEvent (Private->IpChoice ==PING_IP_CHOICE_IP6?((EFI_IP6_RECEIVE_DATA*)Private-RxToken.Packet.RxData)->RecycleSignal:((EFI_IP4_RECEIVE_DATA*)Private - RxToken.Packet.RxData)->RecycleSignal); + if (Private->RxCount < Private->SendNum) { // // Continue to receive icmp echo reply packets. @@ -632,10 +637,6 @@ ON_EXIT: // Private->Status = EFI_SUCCESS; } - // - // Singal to recycle the each rxdata here, not at the end of process. - // - gBS->SignalEvent (Private->IpChoice ==PING_IP_CHOICE_IP6?((EFI_IP6_RECEIVE_DATA*)Private-RxToken.Packet.RxData)->RecycleSignal:((EFI_IP4_RECEIVE_DATA*)Private - RxToken.Packet.RxData)->RecycleSignal); } /**
|
|
Re: [PATCH v3 1/3] MdeModulePkg Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL
Michael Kubacki
That has been spelled incorrectly for about 9 years. The file (like many others) also has other spelling errors such as the following. I suggest this be fixed in a separate commit/series focused on fixing spelling errors.
toggle quoted messageShow quoted text
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -102,7 +102,7 @@ AUTH_VAR_LIB_CONTEXT_OUT mAuthContextOut; This function writes data to the FWH at the correct LBA even if the LBAs are fragmented. - @param Global Pointer to VARAIBLE_GLOBAL structure. + @param Global Pointer to VARIABLE_GLOBAL structure. @param Volatile Point out the Variable is Volatile or Non-Volatile. @param SetByIndex TRUE if target pointer is given as index. FALSE if target pointer is absolute. @@ -504,7 +504,7 @@ InitializeVariableQuota ( @return EFI_SUCCESS Reclaim operation has finished successfully. @return EFI_OUT_OF_RESOURCES No enough memory resources or variable space. - @return Others Unexpect error happened during reclaim operation. + @return Others Unexpected error happened during reclaim operation. **/ EFI_STATUS @@ -2561,7 +2561,7 @@ VariableServiceSetVariable ( } // - // Check for reserverd bit in variable attribute. + // Check for reserved bit in variable attribute. // EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated but we still allow // the delete operation of common authenticated variable at user physical presence. // So leave EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS attribute check to AuthVariableLib @@ -3381,7 +3381,7 @@ ConvertNormalVarStorageToAuthVarStorage ( VARIABLE_HEADER *StartPtr; UINT8 *NextPtr; VARIABLE_HEADER *EndPtr; - UINTN AuthVarStroageSize; + UINTN AuthVarStorageSize; AUTHENTICATED_VARIABLE_HEADER *AuthStartPtr; VARIABLE_STORE_HEADER *AuthVarStorage;
On 3/31/2020 1:18 AM, Jiang, Guomin wrote:
There is a spell error in the comments of VariableServiceGetVariable() in Variable.c.
|
|
Re: [PATCH] .azurepipelines: Enable CI for OvmfPkg and EmulatorPkg
Ard Biesheuvel
On 3/31/20 6:26 PM, Sean via Groups.Io wrote:
On Mon, Mar 30, 2020 at 11:41 PM, Ard Biesheuvel wrote:Yes, absolutely. I prototyped it but want to make sure I am calling QEMU with the parameters you would expect to work with ArmVirtPkgThe parameters look fine. Note that you can use the qemu-system-aarch64 binary as well, so no need to install both. PR build results can be seen here: https://dev.azure.com/tianocore/edk2-ci-play/_build/results?buildId=5074&view=resultsYep, looking good. The main focus is obviously on X64 and AARCH64, but that only increases the risk that we might regress on IA32 or ARM without anyone noticing. So having both IA32 and ARM is a good thing.
|
|
Re: [PATCH] .azurepipelines: Enable CI for OvmfPkg and EmulatorPkg
Sean
On Mon, Mar 30, 2020 at 11:41 PM, Ard Biesheuvel wrote:
Not sure I follow. Which command line are we talking about?@Ard - In this Platform CI, ArmVirt is building and running AARCH64 but not ARM 32bit. Would it be valuable to build for ARM too?  I prototyped it but want to make sure I am calling QEMU with the parameters you would expect to work with ArmVirtPkg  qemu-system-arm -M virt -cpu cortex-a15 -pflash /home/vsts/work/1/s/Build/ArmVirtQemu-ARM/DEBUG_GCC5/FV/QEMU_EFI.fd -m 1024 -net none -serial stdio -drive file=fat:rw:/home/vsts/work/1/s/Build/ArmVirtQemu-ARM/DEBUG_GCC5/VirtualDrive,format=raw,media=disk -display none
PR build results can be seen here:Â https://dev.azure.com/tianocore/edk2-ci-play/_build/results?buildId=5074&view=results PR code change:Â https://github.com/spbrogan/edk2/pull/14
|
|
Re: [PATCH] OvmfPkg/PvScsiDxe: Fix VS2019 build error because of implicit cast
Sean
A couple of thoughts.Â
1. I would suggest that ASSERT should not be the only protection for an invalid operation as ASSERT is usually disabled on release builds.  2. We do have a library to make this more explicit and common.  https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/SafeIntLib.h#L548 Thanks
|
|
How to add ignore "IgnoreFiles" for CharEncodingCheck
Zhang, Shenglei
Hi Sean,  I am introducing third party project oniguruma as submodule into edk2, and want to skip CharEncodingCheck for certain files in oniguruma. I tried to add changes like below, but CI build failed. "CharEncodingCheck": { "IgnoreFiles": [[(MdeModulePkg/Universal/RegularExpressionDxe/oniguruma/test/testc.c),(MdeModulePkg/Universal/RegularExpressionDxe/oniguruma/windows/testc.c)] }  So what should I do in CharEncodingCheck_plug_in.yaml? Or how do you handle this kind of case like openssl?         I see you add this to edk2 and hope you could resolve my query. Thanks in advance.  Best Regards, Shenglei Â
|
|
Re: [PATCH v1] ShellPkg: Fix 'ping' command Ip4 receive flow.
Gao, Zhichao
Acked-by: Zhichao Gao <zhichao.gao@...>
toggle quoted messageShow quoted text
-----Original Message-----
|
|
Re: [PATCH] CryptoPkg/FltUsedLib: Add FltUsedLib for float.
Michael D Kinney
ARM and AARCH64 have a compiler intrinsic lib that is linked against all modules.
toggle quoted messageShow quoted text
[LibraryClasses.ARM, LibraryClasses.AARCH64] # # It is not possible to prevent ARM compiler calls to generic intrinsic functions. # This library provides the instrinsic functions generated by a given compiler. # [LibraryClasses.ARM] and NULL mean link this library into all ARM images. # NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf Can we use this same technique for IA32/X64 VS builds? Mike
-----Original Message-----
|
|
Re: API breakages and their implications. Was: [PATCH 1/1] MdeModulePkg: UART Dynamic clock freq Support
Laszlo Ersek
On 03/31/20 11:22, Leif Lindholm wrote:
On Tue, Mar 31, 2020 at 01:53:21 +0000, Ni, Ray wrote:Two comments:Leif,Yes. This is the nature of collaborative development. (1) One of the reasons why I would like to keep all platforms in a single tree is to deal with API changes like this. That way, someone proposing an API change would at least have the chance to fix up all the consumer sites. Of course it would require diligent review from the other pkg maintainers, but it could be implemented without any temprary breakage in the git history even. (2) Specifically about this problem. The vendor GUID approach is not a bad one. How about the following alternative: (2.1) Patch#1: in the "MdeModulePkg/Library/BaseSerialPortLib16550" directory, introduce a header file called "GetClock.h". This header file should declare: UINT32 GetClock ( VOID ); Note: EFIAPI not needed. The header file should be added to the existent "BaseSerialPortLib16550.inf" file, in the [Sources] section. Furthermore, in the same patch, introduce a new source file called "GetClockPcd.c". (Add this file to the INF file as well.) The source file should do: #include <Library/PcdLib.h> #include "GetClock.h" UINT32 GetClock ( VOID ) { return PcdGet32 (PcdSerialClockRate); } Finally, in the same patch#1, modify "BaseSerialPortLib16550.c" to #include "GetClock.h", and to call GetClock() in place of the current PcdGet32 (PcdSerialClockRate) calls. This patch basically splits the PcdGet32 (PcdSerialClockRate) call to a separate translation unit, hiding it behind the more abstract GetClock() API. (2.2) Patch#2: In the *same* "MdeModulePkg/Library/BaseSerialPortLib16550" directory, introduce three new files: - BaseSerialPortLibDynamicFrequency16550.inf - BaseSerialPortLibDynamicFrequency16550.uni - GetClockDynamicFrequency.c I think the contents of these files must be fairly obvious at this point, but anyway: (2.2.1) INF file: - modified copy of the INF file from (2.1) - Update file-top comment, copyright notice, BASE_NAME, MODULE_UNI_FILE, FILE_GUID. - [LibraryClasses]: add dependency on SerialUartClockLib - [Sources]: replace "GetClockPcd.c" with "GetClockDynamicFrequency.c" - [Pcd]: drop PcdSerialClockRate (2.2.2) UNI file: copy and modify the existent UNI file as needed. (2.2.3) GetClockDynamicFrequency.c: #include <Library/SerialUartClockLib.h> #include "GetClock.h" UINT32 GetClock ( VOID ) { return BaseSerialPortGetClock (); } This way, platforms currently consuming "MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf" will see no change whatsoever. Platforms needing the dynamic frequency can resolve SerialPortLib to "MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLibDynamicFrequency16550.inf", *and* also resolve SerialUartClockLib to an instance that matches their needs. All implementation except the GetClock() one will be shared between the two lib instances "BaseSerialPortLib16550" and "BaseSerialPortLibDynamicFrequency16550". This is a frequent pattern in edk2 -- refer to the various module directories that contain two or more INF files. For example: $ git ls-files -- \ MdePkg/*inf \ MdeModulePkg/*inf \ NetworkPkg/*inf \ PcAtChipsetPkg/*inf \ SecurityPkg/*inf \ ShellPkg/*inf \ UefiCpuPkg/*inf \ | rev \ | cut -f 2- -d / \ | rev \ | sort \ | uniq -d This will produce a list of directories where each directory contains at least two INF files: MdeModulePkg/Bus/I2c/I2cDxe MdeModulePkg/Core/PiSmmCore MdeModulePkg/Library/DxeCapsuleLibFmp MdeModulePkg/Library/DxeCoreMemoryAllocationLib MdeModulePkg/Library/DxeResetSystemLib/UnitTest MdeModulePkg/Library/LzmaCustomDecompressLib MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib MdeModulePkg/Library/SmmLockBoxLib MdeModulePkg/Logo MdeModulePkg/Universal/CapsulePei MdeModulePkg/Universal/EbcDxe MdeModulePkg/Universal/FaultTolerantWriteDxe MdeModulePkg/Universal/Variable/RuntimeDxe MdePkg/Library/BaseIoLibIntrinsic MdePkg/Library/BaseUefiDecompressLib MdePkg/Library/PciSegmentLibSegmentInfo MdePkg/Library/UefiDevicePathLib MdePkg/Test/UnitTest/Library/BaseLib MdePkg/Test/UnitTest/Library/BaseSafeIntLib PcAtChipsetPkg/Library/AcpiTimerLib SecurityPkg/HddPassword SecurityPkg/Library/HashLibBaseCryptoRouter SecurityPkg/Library/Tpm2DeviceLibDTpm SecurityPkg/Library/Tpm2DeviceLibRouter SecurityPkg/Tcg/Opal/OpalPassword SecurityPkg/Tcg/Tcg2Config ShellPkg/DynamicCommand/DpDynamicCommand ShellPkg/DynamicCommand/TftpDynamicCommand UefiCpuPkg/CpuFeatures UefiCpuPkg/Library/CpuExceptionHandlerLib UefiCpuPkg/Library/CpuTimerLib UefiCpuPkg/Library/MpInitLib UefiCpuPkg/Library/RegisterCpuFeaturesLib UefiCpuPkg/Library/SmmCpuFeaturesLib UefiCpuPkg/PiSmmCommunication If you look at INF files inside any given such directory, you'll find that the [Sources] sections between them have non-empty intersections, but also differences. That's the exact same pattern we should use here, IMO. (I intentionally used the core packages in this example.) Thanks Laszlo
|
|
Re: API breakages and their implications. Was: [PATCH 1/1] MdeModulePkg: UART Dynamic clock freq Support
Leif Lindholm
Hi Ray,
toggle quoted messageShow quoted text
I think it's good to start doing it voluntarily, or for changes expected to affect many platforms. Over time, as people become more familiar with the tool, it would make sense to make it first recommended and then mandatory. For Linux, the coccinelle diff is frequently included in the commit message, or (especially when used for changing deprecated interfaces or poor coding practice) they are copmmitted to the repository (under scripts/coccinelle). Regards, Leif
On Tue, Mar 31, 2020 at 12:11:03 +0000, Ni, Ray wrote:
Leif,
|
|
Re: [PATCH v1] ShellPkg: Fix 'ping' command Ip4 receive flow.
Reviewed-by: Siyuan Fu <siyuan.fu@...>
toggle quoted messageShow quoted text
-----Original Message-----
|
|
Re: [PATCH edk2-platforms 1/1] Maintainers: switch to my @arm.com email address
Ard Biesheuvel
On 3/31/20 2:33 PM, Leif Lindholm wrote:
On Tue, Mar 31, 2020 at 13:12:28 +0200, Ard Biesheuvel wrote:ThanksI no longer work for Linaro so switch to my ARM email address.Reviewed-by: Leif Lindholm <leif@...> Pushed as 864987702e01433f6c46c9d974a2233f436b8394
|
|
Re: [PATCH] CryptoPkg/FltUsedLib: Add FltUsedLib for float.
Laszlo Ersek
On 03/30/20 23:41, Ard Biesheuvel wrote:
On Mon, 30 Mar 2020 at 23:29, Matthew Carlson via Groups.IoOK, so this is the part that was not obvious to me. This is basically code that exists on top of edk2 (consumes edk2) *AND* uses floating point *internally*. If you happen to use BaseCryptLib or the intrinsic in a driver that happens to need crypto as well, it can break due to multiple.IMO: if edk2 intends to support out-of-tree modules that themselvesYes, so this either belongs in one of the IntrinsicsLibs we have, or utilize floating point, *with or without* a dependency on OpensslLib, then we should add Ard's suggestion: [Sources] + FloatUsed.c | MSFT to some of the "most core" edk2 library instances, i.e. those that *all* modules of the given module type inevitably depend on. The entry point libs look like a great idea to me. That should link the _fltused external definition exactly once into all modules built with MSVC, regardless of whether each such module uses floating point or not. Thanks Laszlo
|
|
Re: [PATCH edk2-platforms 1/1] Maintainers: switch to my @arm.com email address
Leif Lindholm
On Tue, Mar 31, 2020 at 13:12:28 +0200, Ard Biesheuvel wrote:
I no longer work for Linaro so switch to my ARM email address.Reviewed-by: Leif Lindholm <leif@...> (Not that I can be trusted on the spelling...) ---
|
|
Re: [PATCH] CryptoPkg/FltUsedLib: Add FltUsedLib for float.
Laszlo Ersek
On 03/31/20 09:13, Ard Biesheuvel wrote:
On Tue, 31 Mar 2020 at 03:40, Jiang, Guomin <guomin.jiang@...> wrote:This is *exactly* what I've had in mind!Doesn't the build error go away as well if you simply add FloatUsed.c (With the additional (optional) tweak that IMO "FloatUsed.c" belongs with the openssl INF files, as those are where the floating point usage originates from. The cryptlib instances themselves have no floating point code, AIUI.) Thanks Laszlo
|
|
Re: [PATCH v2 05/28] Silicon/Maxim: Add comments in Ds1307RtcLib
Leif Lindholm
On Fri, Mar 20, 2020 at 20:05:20 +0530, Pankaj Bansal wrote:
From: Pankaj Bansal <pankaj.bansal@...>Reviewed-by: Leif Lindholm <leif@...> ---
|
|
Re: [PATCH v2 04/28] Silicon/Maxim: Fix bug in RtcWrite in Ds1307RtcLib
Leif Lindholm
On Fri, Mar 20, 2020 at 20:05:19 +0530, Pankaj Bansal wrote:
From: Pankaj Bansal <pankaj.bansal@...>So, I'm OK with this patch, but I'll mention that I prefer the design in Silicon/NXP/Library/Pcf8563RealTimeClockLib which I think could also be applied here. I think that might have avoided the confusion that caused the bug. Reviewed-by: Leif Lindholm <leif@...> ---
|
|
Re: [PATCH] .azurepipelines: Enable CI for OvmfPkg and EmulatorPkg
Laszlo Ersek
On 03/30/20 23:29, Kinney, Michael D wrote:
Hi Laszlo,Yes, this should be viable. I have not had good experiences trying to build virtualI must agree. It is slow and somewhat cumbersome with "guestfish" too, on Linux. Guestfish, on the plus side, does not mount the disk with the host kernel, and so it doesn't need root rights. Guestfish launches a separate QEMU instance on top of the virtual disk, booting a dedicated kernel and agent (the "libguestfs appliance") in the guest. The guest appliance communicates with the "guestfish" host side command shell over virtio-serial. So the host kernel never trusts (or even sees) the filesystem structures of the guest disk image; files are exchanged between the "libguestfs appliance" (= guest kernel + agent) and the host-side command shell using a dedicated wire protocol. But, I agree it is somewhat cumbersome and slow, and I have no idea whether it works on Windows hosts. Thanks, Laszlo
|
|
Re: [PATCH v2] NetworkPkg/Ip6Dxe: Improve Neightbor Discovery message validation.
Maciej Rabeda
Hi Laszlo,
toggle quoted messageShow quoted text
Thanks for trying this out! The condition in the ASSERTs is reversed, consequently for the ASSERTs added in this function. I have added them to fire up when Ip6IsNDOptionValid() fails to properly react to invalid packet (return with an error and do not proceed with processing options). In this case, fire assert when current position within the packet (Offset) moved past the size of the option (Option.Length) * 8 (it's in 8-byte units) is outside the packet (further than first byte outside the packet). Offset one byte past the packet == last option ended at the end of the packet (packet size is Head->PayloadLength). Can you try swapping the >= to <= and rerun your test? This should apply to lines 2114, 2167 and 2337. I will submit a patch for that. Thanks, Maciej
On 31-Mar-20 02:35, Laszlo Ersek wrote:
Hi Maciej,
|
|
Re: [PATCH v4 1/1] BaseTools: Enable file dependencies in .inf files
PierreGondois
This patch is following the v3 named "BaseTools: Build ASL files before C files ", available at https://edk2.groups.io/g/devel/message/53735
toggle quoted messageShow quoted text
Sorry for messing with the names. Regards, Pierre
-----Original Message-----
From: PierreGondois <pierre.gondois@...> Sent: Monday, March 30, 2020 5:09 PM To: devel@edk2.groups.io Cc: Pierre Gondois <Pierre.Gondois@...>; bob.c.feng@...; liming.gao@...; Sami Mujawar <Sami.Mujawar@...>; nd <nd@...> Subject: [PATCH v4 1/1] BaseTools: Enable file dependencies in .inf files From: Pierre Gondois <pierre.gondois@...> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2425 The dependencies for C files are satisfied by the build system. However, there are use cases where source files with different languages are inter-dependent. The EDKII build framework currently doesn't have options to specify such dependencies. E.g. It may be necessary to specify the build order between ASL files and C files. The use case being that the AML blob generated by compiling the ASL files is loaded and parsed by some C code. This patch allows to describe dependencies between files listed in the '[Sources]' section of '.inf' files. The list of source files to build prior starts with a colon (':'), e.g.: [Sources] FileName1.X FileName2.Y : FileName1.X FileName3.Z : FileName1.X FileName2.Y In the example above: * FileName1.X will be built prior to FileName2.Y. * FileName1.X and FileName2.Y will be built prior to FileName3.Z. This does not affect the file specific build options, which are pipe separated, e.g.: FileName2.Y | GCC : FileName1.X The list of colon separated files must be part of the module, i.e. they must be present in the [Sources] section. Their file extension must be described in the BaseTools/Conf/build_rule.template file, and generate an output file, i.e. have a non-empty '<OutputFile>' section. Declaring a dependency in the [Sources] sections leads to the creation of makefile rules between these files in the build. The makefile rule is between the generated files. E.g.: FileName1.X generates FileName1.objx FileName2.Y generates FileName2.objy Then FileName2.Y : FileName1.X will create the following makefile rule: FileName2.objy : FileName1.objx INF Specification updates: s3.2.1, "Common Definitions": <SrcDependencySeperator> ::= ":" <DepS> ::= <TS> <SrcDependencySeperator> <TS> s2.5, "[Sources] Section": To describe a build order dependency between source files, specify the source files to build prior by listing them, colon separated. <opt3> ::= <FS> [<FeatureFlagExpress>] [<opt4>] <opt4> ::= <DepS> [FileNameDependency]* Signed-off-by: Pierre Gondois <pierre.gondois@...> --- The changes can be seen at https://github.com/PierreARM/edk2/commits/676_build_asl_first_v4 Notes: v4: - Correct typo in commit message, requested from [Bob] - Create a Bugzilla to update the Inf specification, and submit a patch to update the Inf specification, available at: https://bugzilla.tianocore.org/show_bug.cgi?id=2646 BaseTools/Source/Python/AutoGen/BuildEngine.py | 5 ++++ BaseTools/Source/Python/AutoGen/GenMake.py | 5 ++++ BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 16 ++++++++++ BaseTools/Source/Python/Common/DataType.py | 3 +- BaseTools/Source/Python/Common/Misc.py | 2 ++ BaseTools/Source/Python/Workspace/InfBuildData.py | 31 ++++++++++++++++++-- BaseTools/Source/Python/Workspace/MetaFileParser.py | 17 +++++++++-- 7 files changed, 74 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py index d602414ca41f37155c9c6d00eec54ea3918840c3..59cc0f8a765835ee459880f66453063af5f5779d 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -2,6 +2,7 @@ # The engine for building files # # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2020, ARM Limited. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -53,6 +54,7 @@ class TargetDescBlock(object): self.Outputs = Outputs self.Commands = Commands self.Dependencies = Dependencies + self.SourceFileDependencies = None if self.Outputs: self.Target = self.Outputs[0] else: @@ -277,6 +279,9 @@ class FileBuildRule: TargetDesc.GenListFile = self.GenListFile TargetDesc.GenIncListFile = self.GenIncListFile self.BuildTargets[DstFile[0]] = TargetDesc + + TargetDesc.SourceFileDependencies = + SourceFile.SourceFileDependencies + return TargetDesc def _BuildCommand(self, Macros): diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index bbb3c29446f53fa7f2cb61a216a5b119f72c3fbc..e257fd2c2eefee2782bc52606e537a2147f6857b 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1013,6 +1013,11 @@ cleanlib: Deps = [] CCodeDeps = [] + + if T.SourceFileDependencies: + for File in T.SourceFileDependencies: + Deps.append(self.PlaceMacro(str(File), + self.Macros)) + # Add force-dependencies for Dep in T.Dependencies: Deps.append(self.PlaceMacro(str(Dep), self.Macros)) diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py index aad591de65f086043d55aeea5661f59c53792e7c..f5e25d6f0231a393c838eb66922ee5e769a4bdde 100755 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py @@ -2,6 +2,7 @@ # Create makefile for MS nmake and GNU make # # Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2020, ARM Limited. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # from __future__ import absolute_import @@ -876,6 +877,21 @@ class ModuleAutoGen(AutoGen): if Source != File: CreateDirectory(Source.Dir) + # The Makefile rule created from with source file dependency must + # have an object file as prerequisite. + # This gets the ouput format of sources. + OutPutSourceFileDependencies = [] + if Source.SourceFileDependencies: + for File in Source.SourceFileDependencies: + if File.Type in self.BuildRules: + DepRuleObject = self.BuildRules[File.Type] + DepTarget = DepRuleObject.Apply(File, self.BuildRuleOrder) + # Files not producing outputs like '.h files don't create a target. + if DepTarget: + + OutPutSourceFileDependencies.extend(DepTarget.Outputs) + + Source.SourceFileDependencies = + OutPutSourceFileDependencies + if File.IsBinary and File == Source and File in BinaryFileList: # Skip all files that are not binary libraries if not self.IsLibrary: diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py index 8d80b410892946c8b862e060b0bf5f630b409825..8f21e1060446982f866c653aaea70cd662e307a0 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -2,7 +2,7 @@ # This file is used to define common static strings used by INF/DEC/DSC files # # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> -# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR> +# Portions copyright (c) 2011 - 2020, ARM Ltd. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -19,6 +19,7 @@ TAB_VALUE_SPLIT = '|' TAB_COMMA_SPLIT = ',' TAB_SPACE_SPLIT = ' ' TAB_SEMI_COLON_SPLIT = ';' +TAB_COLON_SPLIT = ':' TAB_SECTION_START = '[' TAB_SECTION_END = ']' TAB_OPTION_START = '<' diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index da5fb380f0354d6e885aa716d2c9b2fead249d63..cb5c73d473954254a1f4cfe794d97b1b8a198185 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -2,6 +2,7 @@ # Common routines used by all tools # # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2020, ARM Limited. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -1438,6 +1439,7 @@ class PathClass(object): Arch='COMMON', ToolChainFamily='', Target='', TagName='', ToolCode=''): self.Arch = Arch self.File = str(File) + self.SourceFileDependencies = [] if os.path.isabs(self.File): self.Root = '' self.AlterRoot = '' diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index 7675b0ea00ebd6a5fc3e823c965e32066f66f650..f5333e01d907f3883f43edd3ba65c2477aaf9b78 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -3,6 +3,7 @@ # # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR> # (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> +# Copyright (c) 2020, ARM Limited. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -536,12 +537,19 @@ class InfBuildData(ModuleBuildClassObject): return [] RetVal = [] + PendingSourceFileDependencies = dict() RecordList = self._RawData[MODEL_EFI_SOURCE_FILE, self._Arch, self._Platform] Macros = self._Macros for Record in RecordList: LineNo = Record[-1] - ToolChainFamily = Record[1] - TagName = Record[2] + + BuildOptions = ['', ''] + SplittedValueList = GetSplitValueList(Record[1], TAB_VALUE_SPLIT, 1) + BuildOptions[0:len(SplittedValueList)] = SplittedValueList + SourceFileDependencies = + list(set(GetSplitValueList(Record[2], TAB_SPACE_SPLIT))) + + ToolChainFamily = BuildOptions[0] + TagName = BuildOptions[1] ToolCode = Record[3] File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '', @@ -552,9 +560,28 @@ class InfBuildData(ModuleBuildClassObject): EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo) RetVal.append(File) + + # If there are source file dependencies, resolve them after all + # the PathClass instances of the source files have been created. + if SourceFileDependencies[0] != '': + PendingSourceFileDependencies[File] = + SourceFileDependencies + # add any previously found dependency files to the source list if self._DependencyFileList: RetVal.extend(self._DependencyFileList) + + # Resolve the dependencies between the PathClass instances. + for SourceFile, SourceFileDepList in PendingSourceFileDependencies.items(): + for SourceFileDepFile in SourceFileDepList: + Found = False + for Val in RetVal: + if SourceFileDepFile == Val.File: + SourceFile.SourceFileDependencies.append(Val) + Found = True + break + if not Found: + EdkLogger.error("build", FILE_NOT_FOUND, + ExtraData=SourceFileDepFile) + return RetVal ## Retrieve library classes employed by this module diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index a3b6edbd15ee5bf79cef0ac1fc5e53db30356c91..9212a7015702d212d6a7e6c57b2c1e5913e546a9 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -3,6 +3,7 @@ # # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR> # (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP<BR> +# Copyright (c) 2020, ARM Limited. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -735,8 +736,20 @@ class InfParser(MetaFileParser): # @ParseMacro def _SourceFileParser(self): - TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) - self._ValueList[0:len(TokenList)] = TokenList + SourceFileDependencySplit = GetSplitValueList(self._CurrentLine, TAB_COLON_SPLIT, 1) + BuildOptionSplit = + GetSplitValueList(SourceFileDependencySplit[0], TAB_VALUE_SPLIT, 1) + + # Get the filename. + self._ValueList[0] = BuildOptionSplit[0] + + # Get the build options. + if len(BuildOptionSplit) > 1: + self._ValueList[1] = BuildOptionSplit[1] + + # Get the dependencies. + if len(SourceFileDependencySplit) > 1: + self._ValueList[2] = SourceFileDependencySplit[1] + Macros = self._Macros # For Acpi tables, remove macro like ' TABLE_NAME=Sata1' if 'COMPONENT_TYPE' in Macros: -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
|
|