From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2E017D801B4 for ; Wed, 15 Jan 2025 18:52:56 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=1me4S4rHjuQPLszhcwCAbc9DovlHRxQSZwQ1806M67I=; c=relaxed/simple; d=groups.io; h=References:In-Reply-To:Date:Message-Id:From:Mime-Version:To:Cc:Subject:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240830; t=1736967175; v=1; x=1737226374; b=X0FXdJb7cQYQ/Ia2qCwtD/gRy44FzGsVydWYmkyeHObjGUYb93++A+g8r7Xdwi4hkl2c3waX uZzIGevzBlpk1S+8tcvQoAiFJxlqXlcXlo4g9Lzvq0zsQJ9m+Mf4RQVYrsT6PUQp+QFAyjliq43 nvBi22WP3SlpFpBdzFkXVmuq76f0qmGqEfG1VuF/UkB1jbsF5504S/lPZa4D3W7YZGZmtQ/sGOP i9pXfP5KkQlAyxAlglhfytz0qMaoJYkHbRbTk8Xjs/0Cmyf+u9vFXK87YGbRJGokFhMIdyg8u4J 7uZEBpp/BBsQ+568de9MaKFczIU6aXbMIZORIpAwSQGtw== X-Received: by 127.0.0.2 with SMTP id NomuYY7687511xNlHeVMwVZ9; Wed, 15 Jan 2025 10:52:54 -0800 X-Received: from va-2-36.ptr.blmpb.com (va-2-36.ptr.blmpb.com [209.127.231.36]) by mx.groups.io with SMTP id smtpd.web10.13495.1736321370426696723 for ; Tue, 07 Jan 2025 23:29:31 -0800 References: In-Reply-To: Date: Wed, 08 Jan 2025 15:29:17 +0800 Message-Id: <94ba23fe064f2d82b913d4850e73e1d7918b1915.e524b174.0181.4a50.a951.515098c6ec72@feishu.cn> From: "Ajan Zhong" Mime-Version: 1.0 X-Lms-Return-Path: To: "Leif Lindholm" Cc: "Joey Vagedes" , "devel@edk2.groups.io" , "Ard Biesheuvel" , "Kinney, Michael D" Subject: Re: [edk2-devel] Expansion of ARCH in .dsc files Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 15 Jan 2025 10:52:51 -0800 Resent-From: ajan.zhong@newfw.com Reply-To: devel@edk2.groups.io,ajan.zhong@newfw.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: qkqmuTm5Cnw1R3yCuxQoAjPWx7686176AA= Content-Type: multipart/alternative; boundary=b0587e49f923a9c40013943e564987cfd2eaa632270be203efbbbb336b17 X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b=X0FXdJb7; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none --b0587e49f923a9c40013943e564987cfd2eaa632270be203efbbbb336b17 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Thanks Leif and Joey. :) As suggested, I used the following content in the DSC file to pass all the = builds: [Defines.IA32] OUTPUT_DIRECTORY =3D Build/UefiPayloadPkgIA32 FLASH_DEFINITION =3D UefiPayloadPkg/UefiPayloadPkg.fdf [Defines.X64] OUTPUT_DIRECTORY =3D Build/UefiPayloadPkgX64 FLASH_DEFINITION =3D UefiPayloadPkg/UefiPayloadPkg.fdf [Defines.AARCH64] OUTPUT_DIRECTORY =3D Build/UefiPayloadPkgAARCH64 FLASH_DEFINITION =3D UefiPayloadPkg/UefiPayloadPkg.fdf I have tried following build commands, they all succeed to build correspond= ing binaries: 1. build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -a AA= RCH64 -t GCC5 2. python UefiPayloadPkg/UniversalPayloadBuild.py=C2=A0-t GCC5 -b DEBUG --FIT 3. python UefiPayloadPkg/UniversalPayloadBuild.py=C2=A0-t GCC5 -a IA32 -b DEBUG --FIT 4. python UefiPayloadPkg/UniversalPayloadBuild.py=C2=A0-t GCC5 -a AARCH -b DEBUG --FIT Now I am creating a new draft PR to fix all github CI failures which are no= t generated in my local. Thanks again for your help. > From: "Leif Lindholm" > Date: Wed, Jan 8, 2025, 4:14 AM > Subject: Re: [EXTERNAL] [edk2-devel] Expansion of ARCH in .dsc files > To: "Joey Vagedes" > Cc: "devel@edk2.groups.io", "Ajan Zhong", "Ard Biesheuvel", "Kinney, Michael = D" > Hi Joey, >=20 > I appreciate the pointer. > However, that's the .inf spec. >=20 > The same language is not in the corresponding section of > https://tianocore-docs.github.io/edk2-DscSpecification/release-1.28/3_edk= _ii_dsc_file_format/35_[defines]_section.html#35-defines-section >=20 > Regards, >=20 > Leif >=20 > On Tue, 7 Jan 2025 at 19:43, Joey Vagedes wro= te: > > > > Leif, > > > > For your awareness, Section 3.4 of the INF specification states that ar= chitectural modifiers for the [Defines] section tag are not permitted. > > > > So that you can Ctrl+F and to find the exact language, here is a quote: > > > > "architectural modifiers for the [Defines] section tag are not permitte= d" > > > > https://tianocore-docs.github.io/edk2-InfSpecification/release-1.27/3_e= dk_ii_inf_file_format/34_[defines]_section.html#34-defines-section > > > > Thanks, > > Joey > > > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Leif Lin= dholm via groups.io > > Sent: Tuesday, January 7, 2025 11:05 AM > > To: devel@edk2.groups.io > > Cc: Ajan Zhong ; Ard Biesheuvel ; Kinney, Michael D > > Subject: [EXTERNAL] [edk2-devel] Expansion of ARCH in .dsc files > > > > So... I originally tripped over my misunderstanding of when w= riting > > https://github.com/tianocore/edk2/pull/6262 to get around something I w= anted to test in UefiPayloadPkg. > > > > Now Ajan has run into at least an adjacent problem when trying to rewor= k > > https://github.com/tianocore/edk2/pull/6545 based on feedback I among o= thers provided. > > > > Now, the thing I had misunderstood before is that when build is called = with multiple -a options, the ARCH variable will expand to a space-separate= d list of *all* the specified architectures. > > A lot of Arm/AArch64 modules assume this variable only ever contains a = single architecture. > > > > The thing is, I don't think this is clearly documented in the .dsc spec= ification at all. And it is frequently used as a shorthand in there in a fo= rm that would only work if build was called with a single -a. > > Now, this also means that there are nearly no correct users of ARCH in > > edk2 or edk2-platforms. > > Because "the list of all architectures being built simultaneously" > > simply isn't very useful information > > build-time. There are two correct uses in edk2, in EmulatorPkg.dsc and = in UefiPayloadPkg.dsc, using '!if "IA32" in "$ARCH"', which as far as I can= tell is the only possible way to use the variable correctly. > > Slightly amusingly, EmulatorPkg.dsc also contains an incorrect use. > > > > I guess the behaviour is a direct result of how the build command is ar= chitected. > > I guess the one question I have is - is this the intended behaviour? > > > > Ard: I think we need to update some of our .dsc files... > > > > Ajan: one somewhat hacky workaround I can think of to separate the outp= ut images is to hardcode the output image name in arch-specific Defines sec= tions, like so: > > > > diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc in= dex 0bd8d85cab03..f07f2b91764e 100644 > > --- a/ArmVirtPkg/ArmVirtQemu.dsc > > +++ b/ArmVirtPkg/ArmVirtQemu.dsc > > @@ -12,12 +12,17 @@ > > =C2=A0# Defines Section - statements that will be processed to create a= Makefile. > > =C2=A0# > > =C2=A0#################################################################= ############### > > +[Defines.ARM] > > + =C2=A0OUTPUT_DIRECTORY =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =3D Build/ArmVirtQemu-ARM > > + > > +[Defines.AARCH64] > > + =C2=A0OUTPUT_DIRECTORY =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =3D Build/ArmVirtQemu-AARCH64 > > + > > =C2=A0[Defines] > > =C2=A0 =C2=A0PLATFORM_NAME =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0=3D ArmVirtQemu > > =C2=A0 =C2=A0PLATFORM_GUID =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0=3D 37d7e986-f7e9-45c2-8067-e371421a626c > > =C2=A0 =C2=A0PLATFORM_VERSION =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =3D 0.1 > > =C2=A0 =C2=A0DSC_SPECIFICATION =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0=3D 0x00010005 > > - =C2=A0OUTPUT_DIRECTORY =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =3D Build/ArmVirtQemu-$(ARCH) > > =C2=A0 =C2=A0SUPPORTED_ARCHITECTURES =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D AAR= CH64|ARM > > =C2=A0 =C2=A0BUILD_TARGETS =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0=3D DEBUG|RELEASE|NOOPT > > =C2=A0 =C2=A0SKUID_IDENTIFIER =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =3D DEFAULT > > > > > >=20 > > > > >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#120997): https://edk2.groups.io/g/devel/message/120997 Mute This Topic: https://groups.io/mt/110483263/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --b0587e49f923a9c40013943e564987cfd2eaa632270be203efbbbb336b17 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8
Thanks Leif and Joey. = :)

As suggested, I = used the following content in the DSC file to pass all the builds:

[= Defines.IA32]
= OUTPUT_DIRECTORY =3D = Build/UefiPayloadPkgIA32
FLASH_DEFI= NITION =3D UefiPayloadPkg/UefiPayloadPkg.fdf
[Defines.X64]
OUTPUT_DIRE= CTORY =3D Build/UefiPayloadPkgX64
F= LASH_DEFINITION =3D UefiPayloadPkg/UefiPayloadPkg.fdf<= /span>
=
[Defines.AARCH64]
OUTPUT_DIRECTORY =3D Build/UefiPayloadPkgAARCH64
FLASH_DEFINITION =3D UefiPayloadPkg/UefiPayloadPkg.f= df

I have tried following build commands, they all succeed to bui= ld corresponding binaries:
  1. build -p= UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -a AARCH64 -t GC= C5
  2. python UefiPayloadPkg/<= /span>UniversalPayloadBuild.py= =C2=A0-t GCC5 -b = DEBUG --FIT
  3. python UefiPayloadPkg/UniversalPayloadBuild.py=C2=A0-t= GCC5 -a IA32 -b DEBUG --FIT
  4. python UefiPayload= Pkg/UniversalPayload= Build.py=C2=A0-t GCC5 -a AARCH -b DEBUG --FIT<= /li>

Now I am creating a new draft PR to fix all github CI failures which a= re not generated in my local.

Thanks again for your help.
From: "Leif Lindhol= m"<leif.lindholm@oss.qualcomm.com>
Date: Wed,= Jan 8, 2025, 4:14 AM
Subject: Re: [EXTERNAL] [edk2-devel] = Expansion of ARCH in .dsc files
To: "Joey Vagedes"<joeyvagedes@microsoft.com>
<= /div>
Hi Joey,

I appreciate the pointer.
However, that's the .inf spec.

The same language is not in the corresponding section of
https://tianocore-docs.github.io/edk2-DscSpecification/rele= ase-1.28/3_edk_ii_dsc_file_format/35_[defines]_section.html#35-defines-= section

Regards,

Leif

On Tue, 7 Jan 2025 at 19:43, Joey Vagedes <jo= eyvagedes@microsoft.com> wrote:
>
> Leif,
>
> For your awareness, Section 3.4 of the INF specification states t= hat architectural modifiers for the [Defines] section tag are not permitted= .
>
> So that you can Ctrl+F and to find the exact language, here is a = quote:
>
> "architectural modifiers for the [Defines] section tag are no= t permitted"
>
> https://tianocore-docs.github.io/edk2-InfSpecification= /release-1.27/3_edk_ii_inf_file_format/34_[defines]_section.html#34-def= ines-section
>
> Thanks,
> Joey
>
> -----Original Message-----
> From: devel@edk2.groups.io <de= vel@edk2.groups.io> On Behalf Of Leif Lindholm via groups.io
> Sent: Tuesday, January 7, 2025 11:05 AM
> To: devel@edk2.groups.io
> Cc: Ajan Zhong <ajan.zhong@newfw.com>; Ard Biesheuvel <ardb+tianocore@kernel.org>= ;; Kinney, Michael D <michael.d.kinney@intel.com>= ;
> Subject: [EXTERNAL] [edk2-devel] Expansion of ARCH in .dsc= files
>
> So... I originally tripped over my misunderstanding of <subjec= t> when writing
> https://github.com/tianocore/edk= 2/pull/6262 to get around something I wanted to test in UefiPayloadPkg.
>
> Now Ajan has run into at least an adjacent problem when trying to= rework
> https://github.com/tianocore/edk= 2/pull/6545 based on feedback I among others provided.
>
> Now, the thing I had misunderstood before is that when build is c= alled with multiple -a options, the ARCH variable will expand to a space-se= parated list of *all* the specified architectures.
> A lot of Arm/AArch64 modules assume this variable only ever conta= ins a single architecture.
>
> The thing is, I don't think this is clearly documented in the= .dsc specification at all. And it is frequently used as a shorthand in the= re in a form that would only work if build was called with a single -a.
> Now, this also means that there are nearly no correct users of AR= CH in
> edk2 or edk2-platforms.
> Because "the list of all architectures being built simultaneo= usly"
> simply isn't very useful information
> build-time. There are two correct uses in edk2, in EmulatorPkg.ds= c and in UefiPayloadPkg.dsc, using '!if "IA32" in "$ARCH= 4;', which as far as I can tell is the only possible way to use the var= iable correctly.
> Slightly amusingly, EmulatorPkg.dsc also contains an incorrect us= e.
>
> I guess the behaviour is a direct result of how the build command= is architected.
> I guess the one question I have is - is this the intended behavio= ur?
>
> Ard: I think we need to update some of our .dsc files...
>
> Ajan: one somewhat hacky workaround I can think of to separate th= e output images is to hardcode the output image name in arch-specific Defin= es sections, like so:
>
> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.= dsc index 0bd8d85cab03..f07f2b91764e 100644
> --- a/ArmVirtPkg/ArmVirtQemu.dsc
> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
> @@ -12,12 +12,17 @@
> =C2=A0# Defines Section - statements that will be processed to cr= eate a Makefile.
> =C2=A0#
> =C2=A0###########################################################= #####################
> +[Defines.ARM]
> + =C2=A0OUTPUT_DIRECTORY =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D Build/ArmVirtQemu-ARM
> +
> +[Defines.AARCH64]
> + =C2=A0OUTPUT_DIRECTORY =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D Build/ArmVirtQemu-AARCH64
> +
> =C2=A0[Defines]
> =C2=A0 =C2=A0PLATFORM_NAME =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0=3D ArmVirtQemu
> =C2=A0 =C2=A0PLATFORM_GUID =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0=3D 37d7e986-f7e9-45c2-8067-e371421a626c
> =C2=A0 =C2=A0PLATFORM_VERSION =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D 0.1
> =C2=A0 =C2=A0DSC_SPECIFICATION =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0=3D 0x00010005
> - =C2=A0OUTPUT_DIRECTORY =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D Build/ArmVirtQemu-$(ARCH)
> =C2=A0 =C2=A0SUPPORTED_ARCHITECTURES =C2=A0 =C2=A0 =C2=A0 =C2=A0= =3D AARCH64|ARM
> =C2=A0 =C2=A0BUILD_TARGETS =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0=3D DEBUG|RELEASE|NOOPT
> =C2=A0 =C2=A0SKUID_IDENTIFIER =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D DEFAULT
>
>
>=20
>
>
_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#120997) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--b0587e49f923a9c40013943e564987cfd2eaa632270be203efbbbb336b17--