public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm via groups.io" <leif.lindholm=oss.qualcomm.com@groups.io>
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: [edk2-devel] Expansion of ARCH in .dsc files
Date: Tue, 7 Jan 2025 19:04:44 +0000	[thread overview]
Message-ID: <CAD=n3R2V1_KGrZzDKqXSukiinmyqEJAL6TNSGGoEK48_RVm7dA@mail.gmail.com> (raw)

So... I originally tripped over my misunderstanding of <subject> when writing
https://github.com/tianocore/edk2/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/edk2/pull/6545 based on feedback I among
others 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-separated 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
specification at all. And it is
frequently used as a shorthand in there 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 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
architected.
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
output images is to hardcode
the output image name in arch-specific Defines 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 @@
 # Defines Section - statements that will be processed to create a Makefile.
 #
 ################################################################################
+[Defines.ARM]
+  OUTPUT_DIRECTORY               = Build/ArmVirtQemu-ARM
+
+[Defines.AARCH64]
+  OUTPUT_DIRECTORY               = Build/ArmVirtQemu-AARCH64
+
 [Defines]
   PLATFORM_NAME                  = ArmVirtQemu
   PLATFORM_GUID                  = 37d7e986-f7e9-45c2-8067-e371421a626c
   PLATFORM_VERSION               = 0.1
   DSC_SPECIFICATION              = 0x00010005
-  OUTPUT_DIRECTORY               = Build/ArmVirtQemu-$(ARCH)
   SUPPORTED_ARCHITECTURES        = AARCH64|ARM
   BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER               = DEFAULT


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120967): https://edk2.groups.io/g/devel/message/120967
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]
-=-=-=-=-=-=-=-=-=-=-=-



             reply	other threads:[~2025-01-07 19:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 19:04 Leif Lindholm via groups.io [this message]
2025-01-07 19:43 ` [edk2-devel] Expansion of ARCH in .dsc files Joey Vagedes via groups.io
2025-01-07 20:14   ` Leif Lindholm via groups.io
2025-01-08 15:01 ` Gerd Hoffmann via groups.io
2025-01-08 16:01   ` Leif Lindholm via groups.io

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD=n3R2V1_KGrZzDKqXSukiinmyqEJAL6TNSGGoEK48_RVm7dA@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox