edk2 icon indicating copy to clipboard operation
edk2 copied to clipboard

Bad variable interpolation in UefiPayloadPkg.dsc

Open matdibu opened this issue 1 year ago • 7 comments

https://github.com/tianocore/edk2/blob/bb248a95091ab542440053d9c289a97e80eb6630/UefiPayloadPkg/UefiPayloadPkg.dsc#L25

does that actually evaluate as intended? on my local machine I get this:

$ ls Build/
'UefiPayloadPkg$(BUILD_ARCH)'

which in turn breaks the build

matdibu avatar Aug 29 '24 10:08 matdibu

https://github.com/tianocore/edk2/blob/bb248a95091ab542440053d9c289a97e80eb6630/UefiPayloadPkg/UefiPayloadPkg.dsc#L25

does that actually evaluate as intended? on my local machine I get this:

$ ls Build/
'UefiPayloadPkg$(BUILD_ARCH)'

which in turn breaks the build

Seems like your local machine is garbage.

ghost avatar Aug 29 '24 19:08 ghost

:))) I didn't expect that

but seriously now, could it be because of the shell using during the build?

it was from within a nix derivation, so the shell definitely isn't the same as a user-interactive bash session started on ubuntu

that being said, the build worked after I replaced that with Build/UefiPayloadPkgX64, and I successfully flashed and booted on real hardware

matdibu avatar Aug 30 '24 13:08 matdibu

The line should be the below

 OUTPUT_DIRECTORY                    = Build/UefiPayloadPkg$(ARCH) 

Not sure what's up with @ProfessorLongBeard s system. Likely some leftover environment vars.

No other dsc uses BUILD_ARCH

grep -r OUTPUT_DIRECTORY | grep ARCH

iangoegebuer avatar Nov 27 '24 07:11 iangoegebuer

@dhaval-rivos could you chime in?

matdibu avatar Nov 27 '24 08:11 matdibu

@iangoegebuer if I use Build/UefiPayloadPkg$(ARCH) then I'm back to this problem

build.py...
/build/source/payloads/external/edk2/workspace/MrChromebox/UefiPayloadPkg/UefiPayloadPkg.dsc(25): error 3001: No space is allowed in OUTPUT_DIRECTORY
     Build/UefiPayloadPkgIA32 X64

this is during a coreboot build, more specifically this https://codeberg.org/mateidibu/coreboot-flake

matdibu avatar Nov 27 '24 08:11 matdibu

So in your case $(ARCH) is resulting into UefiPayloadPkgIA32 X64 with a space and that is the problem? It is supposed to come from [ input build arg -a: parser.add_argument('-a', '--Arch'] and used in BuildUniversalPayload(). I am sure it works in X86 environment as @ChaselChiu and teams have been using it.

dhaval-rivos avatar Nov 27 '24 08:11 dhaval-rivos

yeah, coreboot builds UefiPayloadPkgX64 via build -a IA32 -a X64 is that how it's supposed to be used?

source: https://github.com/coreboot/coreboot/blob/7c0da94aebfe5d5f1af622ecc3daa9e43da4d91c/payloads/external/edk2/Makefile#L297

matdibu avatar Nov 27 '24 08:11 matdibu