public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* regarding build uefipayload in debug mode in linux
@ 2023-02-02 21:39 ritul guru
  2023-02-02 23:16 ` [edk2-devel] " Mike Maslenkin
  0 siblings, 1 reply; 16+ messages in thread
From: ritul guru @ 2023-02-02 21:39 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 3109 bytes --]

Hi,
I was following below link to build UEfiPayload for coreboot to boot from,

https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt

but getting below error,
would appreciate help, thanks.


~/src/opensource/edk2 [master| ]
03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
Build environment:
Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
Build start time: 03:04:57, Feb.03 2023

WORKSPACE        = /home//src/opensource/edk2
EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
CONF_PATH        = /home//src/opensource/edk2/Conf
PYTHON_COMMAND   = /usr/bin/python3.8


build.py...
 : error C0DE: Unknown fatal error when processing
[/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]

(Please send email to devel@edk2.groups.io for help, attaching following
call stack trace!)

(Python 3.8.10 on linux) Traceback (most recent call last):
  File
"/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
line 2692, in Main
    MyBuild = Build(Target, Workspace, Option,LogQ)
  File
"/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
line 815, in __init__
    self.InitPreBuild()
  File
"/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
line 1015, in InitPreBuild
    self.LoadConfiguration()
  File
"/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
line 971, in LoadConfiguration
    self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
  File
"/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
line 905, in GetToolChainAndFamilyFromDsc
    dscobj = self.BuildDatabase[File, BuildArch]
  File
"/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
line 104, in __getitem__
    BuildObject = self.CreateBuildObject(FilePath, Arch, Target, Toolchain)
  File
"/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
line 120, in CreateBuildObject
    MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
  File
"/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
line 426, in __new__
    reval = Class._FILE_TABLE_[FileType](*Args)
  File
"/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
line 303, in __init__
    MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC,
Temporary, FromItem)
  File
"/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
line 39, in __init__
    MetaFile.TimeStamp,
  File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py",
line 1539, in TimeStamp
    return os.stat(self.Path)[8]
  File
"/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py",
line 51, in stat
    return os.stat(LongFilePath(path))
FileNotFoundError: [Errno 2] No such file or directory:
'/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'







*Thanks & RegardsRitul Guru+91-9916513186*

[-- Attachment #2: Type: text/html, Size: 5495 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-02 21:39 regarding build uefipayload in debug mode in linux ritul guru
@ 2023-02-02 23:16 ` Mike Maslenkin
  2023-02-03 15:07   ` ritul guru
  0 siblings, 1 reply; 16+ messages in thread
From: Mike Maslenkin @ 2023-02-02 23:16 UTC (permalink / raw)
  To: devel, ritul.bits

Hi Ritul Guru.

There is a misprint in path to dsc file.
The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
But there is another issue with your command line exists.
The instructions you are referred to [1]  contain a sentence:
"NOTE: Pure 32bit UEFI payload support could be added if required
later.", i.e. it won't build.
So, you need to build either pure X64 or X64 build with IA32 entry.

The command line for the latter is:
"build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"

*[1] https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55

Regards,
Mike.



On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com> wrote:
>
>
> Hi,
> I was following below link to build UEfiPayload for coreboot to boot from,
>
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>
> but getting below error,
> would appreciate help, thanks.
>
>
> ~/src/opensource/edk2 [master| ]
> 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> Build environment: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> Build start time: 03:04:57, Feb.03 2023
>
> WORKSPACE        = /home//src/opensource/edk2
> EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> CONF_PATH        = /home//src/opensource/edk2/Conf
> PYTHON_COMMAND   = /usr/bin/python3.8
>
>
> build.py...
>  : error C0DE: Unknown fatal error when processing [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>
> (Please send email to devel@edk2.groups.io for help, attaching following call stack trace!)
>
> (Python 3.8.10 on linux) Traceback (most recent call last):
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2692, in Main
>     MyBuild = Build(Target, Workspace, Option,LogQ)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 815, in __init__
>     self.InitPreBuild()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1015, in InitPreBuild
>     self.LoadConfiguration()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 971, in LoadConfiguration
>     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 905, in GetToolChainAndFamilyFromDsc
>     dscobj = self.BuildDatabase[File, BuildArch]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 104, in __getitem__
>     BuildObject = self.CreateBuildObject(FilePath, Arch, Target, Toolchain)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 120, in CreateBuildObject
>     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 426, in __new__
>     reval = Class._FILE_TABLE_[FileType](*Args)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 303, in __init__
>     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary, FromItem)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 39, in __init__
>     MetaFile.TimeStamp,
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line 1539, in TimeStamp
>     return os.stat(self.Path)[8]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py", line 51, in stat
>     return os.stat(LongFilePath(path))
> FileNotFoundError: [Errno 2] No such file or directory: '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>
>
>
>
>
> Thanks & Regards
> Ritul Guru
> +91-9916513186
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-02 23:16 ` [edk2-devel] " Mike Maslenkin
@ 2023-02-03 15:07   ` ritul guru
  2023-02-06  0:53     ` Guo, Gua
  0 siblings, 1 reply; 16+ messages in thread
From: ritul guru @ 2023-02-03 15:07 UTC (permalink / raw)
  To: Mike Maslenkin; +Cc: devel

[-- Attachment #1: Type: text/plain, Size: 4551 bytes --]

Thanks,

build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" *-b DEBUG* -t GCC5 -a IA32 -a
X64 -D COREBOOT

I used above cmd, added DEBUG option by seeing NO debug messages coming
from uefipayload.
any idea how to enable debug messages coming from uefipayload built with
above cmd?






*Thanks & RegardsRitul Guru+91-9916513186*


On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com>
wrote:

> Hi Ritul Guru.
>
> There is a misprint in path to dsc file.
> The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
> But there is another issue with your command line exists.
> The instructions you are referred to [1]  contain a sentence:
> "NOTE: Pure 32bit UEFI payload support could be added if required
> later.", i.e. it won't build.
> So, you need to build either pure X64 or X64 build with IA32 entry.
>
> The command line for the latter is:
> "build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"
>
> *[1]
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55
>
> Regards,
> Mike.
>
>
>
> On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com> wrote:
> >
> >
> > Hi,
> > I was following below link to build UEfiPayload for coreboot to boot
> from,
> >
> >
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
> >
> > but getting below error,
> > would appreciate help, thanks.
> >
> >
> > ~/src/opensource/edk2 [master| ]
> > 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> > Build environment:
> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> > Build start time: 03:04:57, Feb.03 2023
> >
> > WORKSPACE        = /home//src/opensource/edk2
> > EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> > CONF_PATH        = /home//src/opensource/edk2/Conf
> > PYTHON_COMMAND   = /usr/bin/python3.8
> >
> >
> > build.py...
> >  : error C0DE: Unknown fatal error when processing
> [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
> >
> > (Please send email to devel@edk2.groups.io for help, attaching
> following call stack trace!)
> >
> > (Python 3.8.10 on linux) Traceback (most recent call last):
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 2692, in Main
> >     MyBuild = Build(Target, Workspace, Option,LogQ)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 815, in __init__
> >     self.InitPreBuild()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 1015, in InitPreBuild
> >     self.LoadConfiguration()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 971, in LoadConfiguration
> >     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 905, in GetToolChainAndFamilyFromDsc
> >     dscobj = self.BuildDatabase[File, BuildArch]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 104, in __getitem__
> >     BuildObject = self.CreateBuildObject(FilePath, Arch, Target,
> Toolchain)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 120, in CreateBuildObject
> >     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 426, in __new__
> >     reval = Class._FILE_TABLE_[FileType](*Args)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 303, in __init__
> >     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC,
> Temporary, FromItem)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 39, in __init__
> >     MetaFile.TimeStamp,
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line
> 1539, in TimeStamp
> >     return os.stat(self.Path)[8]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py",
> line 51, in stat
> >     return os.stat(LongFilePath(path))
> > FileNotFoundError: [Errno 2] No such file or directory:
> '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
> >
> >
> >
> >
> >
> > Thanks & Regards
> > Ritul Guru
> > +91-9916513186
> > 
>

[-- Attachment #2: Type: text/html, Size: 7140 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-03 15:07   ` ritul guru
@ 2023-02-06  0:53     ` Guo, Gua
  2023-02-06 11:37       ` ritul guru
  0 siblings, 1 reply; 16+ messages in thread
From: Guo, Gua @ 2023-02-06  0:53 UTC (permalink / raw)
  To: devel@edk2.groups.io, ritul.bits@gmail.com, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 6247 bytes --]

I just quickly check your command, look like it incorrect UefiPayload

For Uefi Payload

  *   build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D BOOTLOADER=COREBOOT

For Uefi Universal Payload

  *   Coreboot
git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
cd Coreboot
git submodule update --init
make iasl
make crossgcc
make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
make


  *   Edk2
git clone https://github.com/tianocore/edk2.git Edk2
cd Edk2
git submodule update --init
source ./edksetup.sh
make -C ./BaseTools
bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D CPU_TIMER_LIB_ENABLE=FALSE


  *   ShimLayer
git clone https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer  ShimLayer
cd ShimLayer
bash CorebootShimBuild.sh


  *   Test Procedure

  1.  Copy "ShimLayer/Build/ShimLayer.elf" and "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
2.    cd Coreboot/build
3.    Do the following commands.
./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f ShimLayer.elf
./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35

Thanks,
Gua
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of ritul guru
Sent: Friday, February 3, 2023 11:08 PM
To: Mike Maslenkin <mike.maslenkin@gmail.com>
Cc: devel@edk2.groups.io
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

Thanks,

build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D COREBOOT

I used above cmd, added DEBUG option by seeing NO debug messages coming from uefipayload.
any idea how to enable debug messages coming from uefipayload built with above cmd?




Thanks & Regards
Ritul Guru
+91-9916513186


On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>> wrote:
Hi Ritul Guru.

There is a misprint in path to dsc file.
The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
But there is another issue with your command line exists.
The instructions you are referred to [1]  contain a sentence:
"NOTE: Pure 32bit UEFI payload support could be added if required
later.", i.e. it won't build.
So, you need to build either pure X64 or X64 build with IA32 entry.

The command line for the latter is:
"build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"

*[1] https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55

Regards,
Mike.



On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>> wrote:
>
>
> Hi,
> I was following below link to build UEfiPayload for coreboot to boot from,
>
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>
> but getting below error,
> would appreciate help, thanks.
>
>
> ~/src/opensource/edk2 [master| ]
> 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> Build environment: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> Build start time: 03:04:57, Feb.03 2023
>
> WORKSPACE        = /home//src/opensource/edk2
> EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> CONF_PATH        = /home//src/opensource/edk2/Conf
> PYTHON_COMMAND   = /usr/bin/python3.8
>
>
> build.py...
>  : error C0DE: Unknown fatal error when processing [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>
> (Please send email to devel@edk2.groups.io<mailto:devel@edk2.groups.io> for help, attaching following call stack trace!)
>
> (Python 3.8.10 on linux) Traceback (most recent call last):
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2692, in Main
>     MyBuild = Build(Target, Workspace, Option,LogQ)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 815, in __init__
>     self.InitPreBuild()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1015, in InitPreBuild
>     self.LoadConfiguration()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 971, in LoadConfiguration
>     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 905, in GetToolChainAndFamilyFromDsc
>     dscobj = self.BuildDatabase[File, BuildArch]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 104, in __getitem__
>     BuildObject = self.CreateBuildObject(FilePath, Arch, Target, Toolchain)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 120, in CreateBuildObject
>     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 426, in __new__
>     reval = Class._FILE_TABLE_[FileType](*Args)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 303, in __init__
>     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary, FromItem)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 39, in __init__
>     MetaFile.TimeStamp,
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line 1539, in TimeStamp
>     return os.stat(self.Path)[8]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py", line 51, in stat
>     return os.stat(LongFilePath(path))
> FileNotFoundError: [Errno 2] No such file or directory: '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>
>
>
>
>
> Thanks & Regards
> Ritul Guru
> +91-9916513186


[-- Attachment #2: Type: text/html, Size: 21138 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06  0:53     ` Guo, Gua
@ 2023-02-06 11:37       ` ritul guru
  2023-02-06 11:47         ` Guo, Gua
  0 siblings, 1 reply; 16+ messages in thread
From: ritul guru @ 2023-02-06 11:37 UTC (permalink / raw)
  To: Guo, Gua; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 7385 bytes --]

Thanks,

17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D
CPU_TIMER_LIB_ENABLE=FALSE
python_exe=/usr/bin/python3.8
"llvm-objcopy" --version
/bin/sh: 1: llvm-objcopy: not found
- Failed - error happened when run command: "llvm-objcopy" --version
- Failed - Please check if LLVM is installed or if CLANG_BIN is set
correctly
✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]


I am seeing above errors, is clang required for UniversalPayloadBuild.sh
compilation?





*Thanks & RegardsRitul Guru+91-9916513186*


On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com> wrote:

> I just quickly check your command, look like it incorrect UefiPayload
>
>
>
> For Uefi Payload
>
>    - build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a
>    IA32 -a X64 -D BOOTLOADER=COREBOOT
>
>
>
> For Uefi Universal Payload
>
>    - *Coreboot *
>
> git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
>
> cd Coreboot
>
> git submodule update --init
>
> make iasl
>
> make crossgcc
>
> make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
>
> make
>
>
>
>    - *Edk2*
>
> git clone https://github.com/tianocore/edk2.git Edk2
>
> cd Edk2
>
> git submodule update --init
>
> source ./edksetup.sh
>
> make -C ./BaseTools
>
> bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D
> CPU_TIMER_LIB_ENABLE=FALSE
>
>
>
>    - *ShimLayer*
>
> git clone
> https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer
> ShimLayer
>
> cd ShimLayer
>
> bash CorebootShimBuild.sh
>
>
>
>    - *Test Procedure*
>
>
>    1. Copy "ShimLayer/Build/ShimLayer.elf" and
>    "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
>
> 2.    cd Coreboot/build
>
> 3.    Do the following commands.
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>
> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
> ShimLayer.elf
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>
> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>
> qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35
>
>
>
> Thanks,
>
> Gua
>
> *From:* devel@edk2.groups.io <devel@edk2.groups.io> * On Behalf Of *ritul
> guru
> *Sent:* Friday, February 3, 2023 11:08 PM
> *To:* Mike Maslenkin <mike.maslenkin@gmail.com>
> *Cc:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> Thanks,
>
>
>
> build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" *-b DEBUG* -t GCC5 -a IA32
> -a X64 -D COREBOOT
>
>
>
> I used above cmd, added DEBUG option by seeing NO debug messages coming
> from uefipayload.
>
> any idea how to enable debug messages coming from uefipayload built with
> above cmd?
>
>
>
>
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com>
> wrote:
>
> Hi Ritul Guru.
>
> There is a misprint in path to dsc file.
> The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
> But there is another issue with your command line exists.
> The instructions you are referred to [1]  contain a sentence:
> "NOTE: Pure 32bit UEFI payload support could be added if required
> later.", i.e. it won't build.
> So, you need to build either pure X64 or X64 build with IA32 entry.
>
> The command line for the latter is:
> "build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"
>
> *[1]
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55
>
> Regards,
> Mike.
>
>
>
> On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com> wrote:
> >
> >
> > Hi,
> > I was following below link to build UEfiPayload for coreboot to boot
> from,
> >
> >
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
> >
> > but getting below error,
> > would appreciate help, thanks.
> >
> >
> > ~/src/opensource/edk2 [master| ]
> > 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> > Build environment:
> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> > Build start time: 03:04:57, Feb.03 2023
> >
> > WORKSPACE        = /home//src/opensource/edk2
> > EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> > CONF_PATH        = /home//src/opensource/edk2/Conf
> > PYTHON_COMMAND   = /usr/bin/python3.8
> >
> >
> > build.py...
> >  : error C0DE: Unknown fatal error when processing
> [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
> >
> > (Please send email to devel@edk2.groups.io for help, attaching
> following call stack trace!)
> >
> > (Python 3.8.10 on linux) Traceback (most recent call last):
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 2692, in Main
> >     MyBuild = Build(Target, Workspace, Option,LogQ)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 815, in __init__
> >     self.InitPreBuild()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 1015, in InitPreBuild
> >     self.LoadConfiguration()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 971, in LoadConfiguration
> >     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 905, in GetToolChainAndFamilyFromDsc
> >     dscobj = self.BuildDatabase[File, BuildArch]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 104, in __getitem__
> >     BuildObject = self.CreateBuildObject(FilePath, Arch, Target,
> Toolchain)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 120, in CreateBuildObject
> >     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 426, in __new__
> >     reval = Class._FILE_TABLE_[FileType](*Args)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 303, in __init__
> >     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC,
> Temporary, FromItem)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 39, in __init__
> >     MetaFile.TimeStamp,
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line
> 1539, in TimeStamp
> >     return os.stat(self.Path)[8]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py",
> line 51, in stat
> >     return os.stat(LongFilePath(path))
> > FileNotFoundError: [Errno 2] No such file or directory:
> '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
> >
> >
> >
> >
> >
> > Thanks & Regards
> > Ritul Guru
> > +91-9916513186
>
> 
>

[-- Attachment #2: Type: text/html, Size: 15466 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 11:37       ` ritul guru
@ 2023-02-06 11:47         ` Guo, Gua
  2023-02-06 14:21           ` ritul guru
  0 siblings, 1 reply; 16+ messages in thread
From: Guo, Gua @ 2023-02-06 11:47 UTC (permalink / raw)
  To: ritul guru; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 7614 bytes --]

UniversalPayload.sh have Clang tool chain dependency.

I assume your machine is ubuntu-20.10, please download it. And set use export PATH=$PATH:<Clang bin path> to prevent the issue.

https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz

Thanks,
Gua

From: ritul guru <ritul.bits@gmail.com>
Sent: Monday, February 6, 2023 7:37 PM
To: Guo, Gua <gua.guo@intel.com>
Cc: devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

Thanks,

17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D CPU_TIMER_LIB_ENABLE=FALSE
python_exe=/usr/bin/python3.8
"llvm-objcopy" --version
/bin/sh: 1: llvm-objcopy: not found
- Failed - error happened when run command: "llvm-objcopy" --version
- Failed - Please check if LLVM is installed or if CLANG_BIN is set correctly
✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]


I am seeing above errors, is clang required for UniversalPayloadBuild.sh compilation?



Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:
I just quickly check your command, look like it incorrect UefiPayload

For Uefi Payload

  *   build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D BOOTLOADER=COREBOOT

For Uefi Universal Payload

  *   Coreboot
git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
cd Coreboot
git submodule update --init
make iasl
make crossgcc
make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
make


  *   Edk2
git clone https://github.com/tianocore/edk2.git Edk2
cd Edk2
git submodule update --init
source ./edksetup.sh
make -C ./BaseTools
bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D CPU_TIMER_LIB_ENABLE=FALSE


  *   ShimLayer
git clone https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer  ShimLayer
cd ShimLayer
bash CorebootShimBuild.sh


  *   Test Procedure

  1.  Copy "ShimLayer/Build/ShimLayer.elf" and "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
2.    cd Coreboot/build
3.    Do the following commands.
./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f ShimLayer.elf
./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35

Thanks,
Gua
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of ritul guru
Sent: Friday, February 3, 2023 11:08 PM
To: Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

Thanks,

build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D COREBOOT

I used above cmd, added DEBUG option by seeing NO debug messages coming from uefipayload.
any idea how to enable debug messages coming from uefipayload built with above cmd?




Thanks & Regards
Ritul Guru
+91-9916513186


On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>> wrote:
Hi Ritul Guru.

There is a misprint in path to dsc file.
The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
But there is another issue with your command line exists.
The instructions you are referred to [1]  contain a sentence:
"NOTE: Pure 32bit UEFI payload support could be added if required
later.", i.e. it won't build.
So, you need to build either pure X64 or X64 build with IA32 entry.

The command line for the latter is:
"build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"

*[1] https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55

Regards,
Mike.



On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>> wrote:
>
>
> Hi,
> I was following below link to build UEfiPayload for coreboot to boot from,
>
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>
> but getting below error,
> would appreciate help, thanks.
>
>
> ~/src/opensource/edk2 [master| ]
> 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> Build environment: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> Build start time: 03:04:57, Feb.03 2023
>
> WORKSPACE        = /home//src/opensource/edk2
> EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> CONF_PATH        = /home//src/opensource/edk2/Conf
> PYTHON_COMMAND   = /usr/bin/python3.8
>
>
> build.py...
>  : error C0DE: Unknown fatal error when processing [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>
> (Please send email to devel@edk2.groups.io<mailto:devel@edk2.groups.io> for help, attaching following call stack trace!)
>
> (Python 3.8.10 on linux) Traceback (most recent call last):
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2692, in Main
>     MyBuild = Build(Target, Workspace, Option,LogQ)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 815, in __init__
>     self.InitPreBuild()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1015, in InitPreBuild
>     self.LoadConfiguration()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 971, in LoadConfiguration
>     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 905, in GetToolChainAndFamilyFromDsc
>     dscobj = self.BuildDatabase[File, BuildArch]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 104, in __getitem__
>     BuildObject = self.CreateBuildObject(FilePath, Arch, Target, Toolchain)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 120, in CreateBuildObject
>     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 426, in __new__
>     reval = Class._FILE_TABLE_[FileType](*Args)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 303, in __init__
>     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary, FromItem)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 39, in __init__
>     MetaFile.TimeStamp,
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line 1539, in TimeStamp
>     return os.stat(self.Path)[8]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py", line 51, in stat
>     return os.stat(LongFilePath(path))
> FileNotFoundError: [Errno 2] No such file or directory: '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>
>
>
>
>
> Thanks & Regards
> Ritul Guru
> +91-9916513186


[-- Attachment #2: Type: text/html, Size: 33607 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 11:47         ` Guo, Gua
@ 2023-02-06 14:21           ` ritul guru
  2023-02-06 14:26             ` Guo, Gua
  0 siblings, 1 reply; 16+ messages in thread
From: ritul guru @ 2023-02-06 14:21 UTC (permalink / raw)
  To: Guo, Gua; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 8966 bytes --]

workspace needs to be set to any value?

0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D
CPU_TIMER_LIB_ENABLE=FALSE
python_exe=
Traceback (most recent call last):
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
    main()
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
    BuildUniversalPayload(args, MacroList)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in
BuildUniversalPayload
    BuildDir     = os.path.join(os.environ['WORKSPACE'],
os.path.normpath("Build/UefiPayloadPkgX64"))
  File "/usr/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'WORKSPACE'




*Thanks & RegardsRitul Guru+91-9916513186*


On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com> wrote:

> UniversalPayload.sh have Clang tool chain dependency.
>
>
>
> I assume your machine is ubuntu-20.10, please download it. And set use
> export PATH=$PATH:<Clang bin path> to prevent the issue.
>
>
>
>
> https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz
>
>
>
> Thanks,
>
> Gua
>
>
>
> *From:* ritul guru <ritul.bits@gmail.com>
> *Sent:* Monday, February 6, 2023 7:37 PM
> *To:* Guo, Gua <gua.guo@intel.com>
> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> Thanks,
>
>
>
> 17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64
> -D CPU_TIMER_LIB_ENABLE=FALSE
> python_exe=/usr/bin/python3.8
> "llvm-objcopy" --version
> /bin/sh: 1: llvm-objcopy: not found
> - Failed - error happened when run command: "llvm-objcopy" --version
> - Failed - Please check if LLVM is installed or if CLANG_BIN is set
> correctly
> ✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]
>
>
>
>
>
> I am seeing above errors, is clang required for UniversalPayloadBuild.sh
> compilation?
>
>
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com> wrote:
>
> I just quickly check your command, look like it incorrect UefiPayload
>
>
>
> For Uefi Payload
>
>    - build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a
>    IA32 -a X64 -D BOOTLOADER=COREBOOT
>
>
>
> For Uefi Universal Payload
>
>    - *Coreboot *
>
> git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
>
> cd Coreboot
>
> git submodule update --init
>
> make iasl
>
> make crossgcc
>
> make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
>
> make
>
>
>
>    - *Edk2*
>
> git clone https://github.com/tianocore/edk2.git Edk2
>
> cd Edk2
>
> git submodule update --init
>
> source ./edksetup.sh
>
> make -C ./BaseTools
>
> bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D
> CPU_TIMER_LIB_ENABLE=FALSE
>
>
>
>    - *ShimLayer*
>
> git clone
> https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer
> ShimLayer
>
> cd ShimLayer
>
> bash CorebootShimBuild.sh
>
>
>
>    - *Test Procedure*
>
>
>    1. Copy "ShimLayer/Build/ShimLayer.elf" and
>    "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
>
> 2.    cd Coreboot/build
>
> 3.    Do the following commands.
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>
> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
> ShimLayer.elf
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>
> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>
> qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35
>
>
>
> Thanks,
>
> Gua
>
> *From:* devel@edk2.groups.io <devel@edk2.groups.io> *On Behalf Of *ritul
> guru
> *Sent:* Friday, February 3, 2023 11:08 PM
> *To:* Mike Maslenkin <mike.maslenkin@gmail.com>
> *Cc:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> Thanks,
>
>
>
> build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" *-b DEBUG* -t GCC5 -a IA32
> -a X64 -D COREBOOT
>
>
>
> I used above cmd, added DEBUG option by seeing NO debug messages coming
> from uefipayload.
>
> any idea how to enable debug messages coming from uefipayload built with
> above cmd?
>
>
>
>
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com>
> wrote:
>
> Hi Ritul Guru.
>
> There is a misprint in path to dsc file.
> The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
> But there is another issue with your command line exists.
> The instructions you are referred to [1]  contain a sentence:
> "NOTE: Pure 32bit UEFI payload support could be added if required
> later.", i.e. it won't build.
> So, you need to build either pure X64 or X64 build with IA32 entry.
>
> The command line for the latter is:
> "build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"
>
> *[1]
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55
>
> Regards,
> Mike.
>
>
>
> On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com> wrote:
> >
> >
> > Hi,
> > I was following below link to build UEfiPayload for coreboot to boot
> from,
> >
> >
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
> >
> > but getting below error,
> > would appreciate help, thanks.
> >
> >
> > ~/src/opensource/edk2 [master| ]
> > 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> > Build environment:
> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> > Build start time: 03:04:57, Feb.03 2023
> >
> > WORKSPACE        = /home//src/opensource/edk2
> > EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> > CONF_PATH        = /home//src/opensource/edk2/Conf
> > PYTHON_COMMAND   = /usr/bin/python3.8
> >
> >
> > build.py...
> >  : error C0DE: Unknown fatal error when processing
> [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
> >
> > (Please send email to devel@edk2.groups.io for help, attaching
> following call stack trace!)
> >
> > (Python 3.8.10 on linux) Traceback (most recent call last):
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 2692, in Main
> >     MyBuild = Build(Target, Workspace, Option,LogQ)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 815, in __init__
> >     self.InitPreBuild()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 1015, in InitPreBuild
> >     self.LoadConfiguration()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 971, in LoadConfiguration
> >     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 905, in GetToolChainAndFamilyFromDsc
> >     dscobj = self.BuildDatabase[File, BuildArch]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 104, in __getitem__
> >     BuildObject = self.CreateBuildObject(FilePath, Arch, Target,
> Toolchain)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 120, in CreateBuildObject
> >     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 426, in __new__
> >     reval = Class._FILE_TABLE_[FileType](*Args)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 303, in __init__
> >     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC,
> Temporary, FromItem)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 39, in __init__
> >     MetaFile.TimeStamp,
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line
> 1539, in TimeStamp
> >     return os.stat(self.Path)[8]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py",
> line 51, in stat
> >     return os.stat(LongFilePath(path))
> > FileNotFoundError: [Errno 2] No such file or directory:
> '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
> >
> >
> >
> >
> >
> > Thanks & Regards
> > Ritul Guru
> > +91-9916513186
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 20179 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 14:21           ` ritul guru
@ 2023-02-06 14:26             ` Guo, Gua
  2023-02-06 14:53               ` ritul guru
  0 siblings, 1 reply; 16+ messages in thread
From: Guo, Gua @ 2023-02-06 14:26 UTC (permalink / raw)
  To: ritul guru; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 8944 bytes --]

I think you can run “. edksetup.sh” in your local and WORKSPACE will be setup automatically.

From: ritul guru <ritul.bits@gmail.com>
Sent: Monday, February 6, 2023 10:22 PM
To: Guo, Gua <gua.guo@intel.com>
Cc: devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

workspace needs to be set to any value?

0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D CPU_TIMER_LIB_ENABLE=FALSE
python_exe=
Traceback (most recent call last):
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
    main()
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
    BuildUniversalPayload(args, MacroList)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in BuildUniversalPayload
    BuildDir     = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
  File "/usr/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'WORKSPACE'


Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:
UniversalPayload.sh have Clang tool chain dependency.

I assume your machine is ubuntu-20.10, please download it. And set use export PATH=$PATH:<Clang bin path> to prevent the issue.

https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz

Thanks,
Gua

From: ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>>
Sent: Monday, February 6, 2023 7:37 PM
To: Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

Thanks,

17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D CPU_TIMER_LIB_ENABLE=FALSE
python_exe=/usr/bin/python3.8
"llvm-objcopy" --version
/bin/sh: 1: llvm-objcopy: not found
- Failed - error happened when run command: "llvm-objcopy" --version
- Failed - Please check if LLVM is installed or if CLANG_BIN is set correctly
✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]


I am seeing above errors, is clang required for UniversalPayloadBuild.sh compilation?



Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:
I just quickly check your command, look like it incorrect UefiPayload

For Uefi Payload

  *   build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D BOOTLOADER=COREBOOT

For Uefi Universal Payload

  *   Coreboot
git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
cd Coreboot
git submodule update --init
make iasl
make crossgcc
make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
make


  *   Edk2
git clone https://github.com/tianocore/edk2.git Edk2
cd Edk2
git submodule update --init
source ./edksetup.sh
make -C ./BaseTools
bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D CPU_TIMER_LIB_ENABLE=FALSE


  *   ShimLayer
git clone https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer  ShimLayer
cd ShimLayer
bash CorebootShimBuild.sh


  *   Test Procedure

  1.  Copy "ShimLayer/Build/ShimLayer.elf" and "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
2.    cd Coreboot/build
3.    Do the following commands.
./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f ShimLayer.elf
./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35

Thanks,
Gua
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of ritul guru
Sent: Friday, February 3, 2023 11:08 PM
To: Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

Thanks,

build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D COREBOOT

I used above cmd, added DEBUG option by seeing NO debug messages coming from uefipayload.
any idea how to enable debug messages coming from uefipayload built with above cmd?




Thanks & Regards
Ritul Guru
+91-9916513186


On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>> wrote:
Hi Ritul Guru.

There is a misprint in path to dsc file.
The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
But there is another issue with your command line exists.
The instructions you are referred to [1]  contain a sentence:
"NOTE: Pure 32bit UEFI payload support could be added if required
later.", i.e. it won't build.
So, you need to build either pure X64 or X64 build with IA32 entry.

The command line for the latter is:
"build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"

*[1] https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55

Regards,
Mike.



On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>> wrote:
>
>
> Hi,
> I was following below link to build UEfiPayload for coreboot to boot from,
>
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>
> but getting below error,
> would appreciate help, thanks.
>
>
> ~/src/opensource/edk2 [master| ]
> 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> Build environment: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> Build start time: 03:04:57, Feb.03 2023
>
> WORKSPACE        = /home//src/opensource/edk2
> EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> CONF_PATH        = /home//src/opensource/edk2/Conf
> PYTHON_COMMAND   = /usr/bin/python3.8
>
>
> build.py...
>  : error C0DE: Unknown fatal error when processing [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>
> (Please send email to devel@edk2.groups.io<mailto:devel@edk2.groups.io> for help, attaching following call stack trace!)
>
> (Python 3.8.10 on linux) Traceback (most recent call last):
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2692, in Main
>     MyBuild = Build(Target, Workspace, Option,LogQ)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 815, in __init__
>     self.InitPreBuild()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1015, in InitPreBuild
>     self.LoadConfiguration()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 971, in LoadConfiguration
>     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 905, in GetToolChainAndFamilyFromDsc
>     dscobj = self.BuildDatabase[File, BuildArch]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 104, in __getitem__
>     BuildObject = self.CreateBuildObject(FilePath, Arch, Target, Toolchain)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 120, in CreateBuildObject
>     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 426, in __new__
>     reval = Class._FILE_TABLE_[FileType](*Args)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 303, in __init__
>     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary, FromItem)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 39, in __init__
>     MetaFile.TimeStamp,
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line 1539, in TimeStamp
>     return os.stat(self.Path)[8]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py", line 51, in stat
>     return os.stat(LongFilePath(path))
> FileNotFoundError: [Errno 2] No such file or directory: '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>
>
>
>
>
> Thanks & Regards
> Ritul Guru
> +91-9916513186


[-- Attachment #2: Type: text/html, Size: 38118 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 14:26             ` Guo, Gua
@ 2023-02-06 14:53               ` ritul guru
  2023-02-06 14:55                 ` Guo, Gua
  2023-02-06 15:12                 ` ritul guru
  0 siblings, 2 replies; 16+ messages in thread
From: ritul guru @ 2023-02-06 14:53 UTC (permalink / raw)
  To: Guo, Gua; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 10071 bytes --]

thanks,

./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload

./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
ShimLayer.elf

./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload

./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload
-f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma


with above commands, we can inject shim.elf and uefipayload.elf into
coreboot image, and should be able to boot from this payload?



*Thanks & RegardsRitul Guru+91-9916513186*


On Mon, Feb 6, 2023 at 7:56 PM Guo, Gua <gua.guo@intel.com> wrote:

> I think you can run “. edksetup.sh” in your local and WORKSPACE will be
> setup automatically.
>
>
>
> *From:* ritul guru <ritul.bits@gmail.com>
> *Sent:* Monday, February 6, 2023 10:22 PM
> *To:* Guo, Gua <gua.guo@intel.com>
> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> workspace needs to be set to any value?
>
>
>
> 0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D
> CPU_TIMER_LIB_ENABLE=FALSE
> python_exe=
> Traceback (most recent call last):
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
>     main()
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
>     BuildUniversalPayload(args, MacroList)
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in
> BuildUniversalPayload
>     BuildDir     = os.path.join(os.environ['WORKSPACE'],
> os.path.normpath("Build/UefiPayloadPkgX64"))
>   File "/usr/lib/python3.8/os.py", line 675, in __getitem__
>     raise KeyError(key) from None
> KeyError: 'WORKSPACE'
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com> wrote:
>
> UniversalPayload.sh have Clang tool chain dependency.
>
>
>
> I assume your machine is ubuntu-20.10, please download it. And set use
> export PATH=$PATH:<Clang bin path> to prevent the issue.
>
>
>
>
> https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz
>
>
>
> Thanks,
>
> Gua
>
>
>
> *From:* ritul guru <ritul.bits@gmail.com>
> *Sent:* Monday, February 6, 2023 7:37 PM
> *To:* Guo, Gua <gua.guo@intel.com>
> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> Thanks,
>
>
>
> 17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64
> -D CPU_TIMER_LIB_ENABLE=FALSE
> python_exe=/usr/bin/python3.8
> "llvm-objcopy" --version
> /bin/sh: 1: llvm-objcopy: not found
> - Failed - error happened when run command: "llvm-objcopy" --version
> - Failed - Please check if LLVM is installed or if CLANG_BIN is set
> correctly
> ✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]
>
>
>
>
>
> I am seeing above errors, is clang required for UniversalPayloadBuild.sh
> compilation?
>
>
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com> wrote:
>
> I just quickly check your command, look like it incorrect UefiPayload
>
>
>
> For Uefi Payload
>
>    - build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a
>    IA32 -a X64 -D BOOTLOADER=COREBOOT
>
>
>
> For Uefi Universal Payload
>
>    - *Coreboot *
>
> git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
>
> cd Coreboot
>
> git submodule update --init
>
> make iasl
>
> make crossgcc
>
> make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
>
> make
>
>
>
>    - *Edk2*
>
> git clone https://github.com/tianocore/edk2.git Edk2
>
> cd Edk2
>
> git submodule update --init
>
> source ./edksetup.sh
>
> make -C ./BaseTools
>
> bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D
> CPU_TIMER_LIB_ENABLE=FALSE
>
>
>
>    - *ShimLayer*
>
> git clone
> https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer
> ShimLayer
>
> cd ShimLayer
>
> bash CorebootShimBuild.sh
>
>
>
>    - *Test Procedure*
>
>
>    1. Copy "ShimLayer/Build/ShimLayer.elf" and
>    "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
>
> 2.    cd Coreboot/build
>
> 3.    Do the following commands.
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>
> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
> ShimLayer.elf
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>
> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>
> qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35
>
>
>
> Thanks,
>
> Gua
>
> *From:* devel@edk2.groups.io <devel@edk2.groups.io> *On Behalf Of *ritul
> guru
> *Sent:* Friday, February 3, 2023 11:08 PM
> *To:* Mike Maslenkin <mike.maslenkin@gmail.com>
> *Cc:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> Thanks,
>
>
>
> build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" *-b DEBUG* -t GCC5 -a IA32
> -a X64 -D COREBOOT
>
>
>
> I used above cmd, added DEBUG option by seeing NO debug messages coming
> from uefipayload.
>
> any idea how to enable debug messages coming from uefipayload built with
> above cmd?
>
>
>
>
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com>
> wrote:
>
> Hi Ritul Guru.
>
> There is a misprint in path to dsc file.
> The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
> But there is another issue with your command line exists.
> The instructions you are referred to [1]  contain a sentence:
> "NOTE: Pure 32bit UEFI payload support could be added if required
> later.", i.e. it won't build.
> So, you need to build either pure X64 or X64 build with IA32 entry.
>
> The command line for the latter is:
> "build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"
>
> *[1]
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55
>
> Regards,
> Mike.
>
>
>
> On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com> wrote:
> >
> >
> > Hi,
> > I was following below link to build UEfiPayload for coreboot to boot
> from,
> >
> >
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
> >
> > but getting below error,
> > would appreciate help, thanks.
> >
> >
> > ~/src/opensource/edk2 [master| ]
> > 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> > Build environment:
> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> > Build start time: 03:04:57, Feb.03 2023
> >
> > WORKSPACE        = /home//src/opensource/edk2
> > EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> > CONF_PATH        = /home//src/opensource/edk2/Conf
> > PYTHON_COMMAND   = /usr/bin/python3.8
> >
> >
> > build.py...
> >  : error C0DE: Unknown fatal error when processing
> [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
> >
> > (Please send email to devel@edk2.groups.io for help, attaching
> following call stack trace!)
> >
> > (Python 3.8.10 on linux) Traceback (most recent call last):
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 2692, in Main
> >     MyBuild = Build(Target, Workspace, Option,LogQ)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 815, in __init__
> >     self.InitPreBuild()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 1015, in InitPreBuild
> >     self.LoadConfiguration()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 971, in LoadConfiguration
> >     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 905, in GetToolChainAndFamilyFromDsc
> >     dscobj = self.BuildDatabase[File, BuildArch]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 104, in __getitem__
> >     BuildObject = self.CreateBuildObject(FilePath, Arch, Target,
> Toolchain)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 120, in CreateBuildObject
> >     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 426, in __new__
> >     reval = Class._FILE_TABLE_[FileType](*Args)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 303, in __init__
> >     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC,
> Temporary, FromItem)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 39, in __init__
> >     MetaFile.TimeStamp,
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line
> 1539, in TimeStamp
> >     return os.stat(self.Path)[8]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py",
> line 51, in stat
> >     return os.stat(LongFilePath(path))
> > FileNotFoundError: [Errno 2] No such file or directory:
> '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
> >
> >
> >
> >
> >
> > Thanks & Regards
> > Ritul Guru
> > +91-9916513186
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 23656 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 14:53               ` ritul guru
@ 2023-02-06 14:55                 ` Guo, Gua
  2023-02-06 15:12                 ` ritul guru
  1 sibling, 0 replies; 16+ messages in thread
From: Guo, Gua @ 2023-02-06 14:55 UTC (permalink / raw)
  To: ritul guru; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 10043 bytes --]

Yes, I think it should be able to boot to uefi shell based on the command.

From: ritul guru <ritul.bits@gmail.com>
Sent: Monday, February 6, 2023 10:53 PM
To: Guo, Gua <gua.guo@intel.com>
Cc: devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

thanks,

./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f ShimLayer.elf
./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma

with above commands, we can inject shim.elf and uefipayload.elf into coreboot image, and should be able to boot from this payload?

Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 7:56 PM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:
I think you can run “. edksetup.sh” in your local and WORKSPACE will be setup automatically.

From: ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>>
Sent: Monday, February 6, 2023 10:22 PM
To: Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

workspace needs to be set to any value?

0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D CPU_TIMER_LIB_ENABLE=FALSE
python_exe=
Traceback (most recent call last):
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
    main()
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
    BuildUniversalPayload(args, MacroList)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in BuildUniversalPayload
    BuildDir     = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
  File "/usr/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'WORKSPACE'


Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:
UniversalPayload.sh have Clang tool chain dependency.

I assume your machine is ubuntu-20.10, please download it. And set use export PATH=$PATH:<Clang bin path> to prevent the issue.

https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz

Thanks,
Gua

From: ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>>
Sent: Monday, February 6, 2023 7:37 PM
To: Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

Thanks,

17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D CPU_TIMER_LIB_ENABLE=FALSE
python_exe=/usr/bin/python3.8
"llvm-objcopy" --version
/bin/sh: 1: llvm-objcopy: not found
- Failed - error happened when run command: "llvm-objcopy" --version
- Failed - Please check if LLVM is installed or if CLANG_BIN is set correctly
✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]


I am seeing above errors, is clang required for UniversalPayloadBuild.sh compilation?



Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:
I just quickly check your command, look like it incorrect UefiPayload

For Uefi Payload

  *   build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D BOOTLOADER=COREBOOT

For Uefi Universal Payload

  *   Coreboot
git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
cd Coreboot
git submodule update --init
make iasl
make crossgcc
make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
make


  *   Edk2
git clone https://github.com/tianocore/edk2.git Edk2
cd Edk2
git submodule update --init
source ./edksetup.sh
make -C ./BaseTools
bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D CPU_TIMER_LIB_ENABLE=FALSE


  *   ShimLayer
git clone https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer  ShimLayer
cd ShimLayer
bash CorebootShimBuild.sh


  *   Test Procedure

  1.  Copy "ShimLayer/Build/ShimLayer.elf" and "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
2.    cd Coreboot/build
3.    Do the following commands.
./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f ShimLayer.elf
./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35

Thanks,
Gua
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of ritul guru
Sent: Friday, February 3, 2023 11:08 PM
To: Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

Thanks,

build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D COREBOOT

I used above cmd, added DEBUG option by seeing NO debug messages coming from uefipayload.
any idea how to enable debug messages coming from uefipayload built with above cmd?




Thanks & Regards
Ritul Guru
+91-9916513186


On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>> wrote:
Hi Ritul Guru.

There is a misprint in path to dsc file.
The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
But there is another issue with your command line exists.
The instructions you are referred to [1]  contain a sentence:
"NOTE: Pure 32bit UEFI payload support could be added if required
later.", i.e. it won't build.
So, you need to build either pure X64 or X64 build with IA32 entry.

The command line for the latter is:
"build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"

*[1] https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55

Regards,
Mike.



On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>> wrote:
>
>
> Hi,
> I was following below link to build UEfiPayload for coreboot to boot from,
>
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>
> but getting below error,
> would appreciate help, thanks.
>
>
> ~/src/opensource/edk2 [master| ]
> 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> Build environment: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> Build start time: 03:04:57, Feb.03 2023
>
> WORKSPACE        = /home//src/opensource/edk2
> EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> CONF_PATH        = /home//src/opensource/edk2/Conf
> PYTHON_COMMAND   = /usr/bin/python3.8
>
>
> build.py...
>  : error C0DE: Unknown fatal error when processing [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>
> (Please send email to devel@edk2.groups.io<mailto:devel@edk2.groups.io> for help, attaching following call stack trace!)
>
> (Python 3.8.10 on linux) Traceback (most recent call last):
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2692, in Main
>     MyBuild = Build(Target, Workspace, Option,LogQ)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 815, in __init__
>     self.InitPreBuild()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1015, in InitPreBuild
>     self.LoadConfiguration()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 971, in LoadConfiguration
>     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 905, in GetToolChainAndFamilyFromDsc
>     dscobj = self.BuildDatabase[File, BuildArch]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 104, in __getitem__
>     BuildObject = self.CreateBuildObject(FilePath, Arch, Target, Toolchain)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 120, in CreateBuildObject
>     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 426, in __new__
>     reval = Class._FILE_TABLE_[FileType](*Args)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 303, in __init__
>     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary, FromItem)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 39, in __init__
>     MetaFile.TimeStamp,
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line 1539, in TimeStamp
>     return os.stat(self.Path)[8]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py", line 51, in stat
>     return os.stat(LongFilePath(path))
> FileNotFoundError: [Errno 2] No such file or directory: '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>
>
>
>
>
> Thanks & Regards
> Ritul Guru
> +91-9916513186


[-- Attachment #2: Type: text/html, Size: 42898 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 14:53               ` ritul guru
  2023-02-06 14:55                 ` Guo, Gua
@ 2023-02-06 15:12                 ` ritul guru
  2023-02-06 15:13                   ` Guo, Gua
  2023-02-06 23:08                   ` Guo, Gua
  1 sibling, 2 replies; 16+ messages in thread
From: ritul guru @ 2023-02-06 15:12 UTC (permalink / raw)
  To: Guo, Gua; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 15684 bytes --]

getting below error:

build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
 -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
Build environment:
Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
Build start time: 20:37:47, Feb.06 2023

WORKSPACE        = /home/a/src/opensource/edk2
EDK_TOOLS_PATH   = /home/a/src/opensource/edk2/BaseTools
CONF_PATH        = /home/a/src/opensource/edk2/Conf
PYTHON_COMMAND   = /usr/bin/python3.8


Processing meta-data .
Architecture(s)  = IA32 X64
Build target     = DEBUG
Toolchain        = CLANGDWARF

Active Platform          =
/home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadPkg.dsc
Active Module            =
/home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
.build: : warning: The PCD was not specified by any INF module in the
platform for the given architecture.
PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
Platform: [UefiPayloadPkg.dsc]
Arch: ['IA32']
build: : warning: The PCD was not specified by any INF module in the
platform for the given architecture.
PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
Platform: [UefiPayloadPkg.dsc]
Arch: ['IA32']
done!
Generating code . done!
Generating makefile . done!
Building ...
/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
[IA32]
"clang"  -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall
-Werror -Wno-array-bounds -include AutoGen.h -fno-common
-ffunction-sections -fdata-sections
-DSTRING_ARRAY_NAME=BaseUefiCpuLibStrings -Wno-parentheses-equality
-Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare
-Wno-empty-body -Wno-unused-const-variable -Wno-varargs
-Wno-unknown-warning-option -Wno-unused-but-set-variable
-Wno-unused-const-variable -Wno-unaligned-access -fno-stack-protector
-mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas
-Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables
-mno-sse -mno-mmx -msoft-float -mno-implicit-float
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang
-funsigned-char -fno-ms-extensions -Wno-null-dereference -m32 -Oz -flto
-march=i586 -target i686-pc-linux-gnu -g -malign-double -D
DISABLE_NEW_DEPRECATED_INTERFACES -c -o
/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/./BaseUefiCpuLib.obj
-I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32
-I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib
-I/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/DEBUG
-I/home/a/src/opensource/edk2/MdePkg
-I/home/a/src/opensource/edk2/MdePkg/Include
-I/home/a/src/opensource/edk2/MdePkg/Test/UnitTest/Include
-I/home/a/src/opensource/edk2/MdePkg/Include/Ia32
-I/home/a/src/opensource/edk2/UefiCpuPkg
-I/home/a/src/opensource/edk2/UefiCpuPkg/Include
/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
/bin/sh: 1: clang: not found
make: *** [GNUmakefile:344:
/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/BaseUefiCpuLib.obj]
Error 127


build.py...
: error 7000: Failed to execute command
make tbuild
[/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib]


build.py...
: error F002: Failed to build module
/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
[IA32, CLANGDWARF, DEBUG]

- Failed -
Build end time: 20:37:54, Feb.06 2023
Build total time: 00:00:07

- Failed - error happened when run command: build -p
UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
 -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
Traceback (most recent call last):
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
    main()
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
    BuildUniversalPayload(args, MacroList)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 108, in
BuildUniversalPayload
    RunCommand(BuildModule)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 51, in RunCommand
    raise Exception("ERROR: when run command: %s"%cmd)
Exception: ERROR: when run command: build -p
UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
 -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE




*Thanks & RegardsRitul Guru+91-9916513186*


On Mon, Feb 6, 2023 at 8:23 PM ritul guru <ritul.bits@gmail.com> wrote:

> thanks,
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>
> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
> ShimLayer.elf
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>
> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>
>
> with above commands, we can inject shim.elf and uefipayload.elf into
> coreboot image, and should be able to boot from this payload?
>
>
>
> *Thanks & RegardsRitul Guru+91-9916513186*
>
>
> On Mon, Feb 6, 2023 at 7:56 PM Guo, Gua <gua.guo@intel.com> wrote:
>
>> I think you can run “. edksetup.sh” in your local and WORKSPACE will be
>> setup automatically.
>>
>>
>>
>> *From:* ritul guru <ritul.bits@gmail.com>
>> *Sent:* Monday, February 6, 2023 10:22 PM
>> *To:* Guo, Gua <gua.guo@intel.com>
>> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
>> linux
>>
>>
>>
>> workspace needs to be set to any value?
>>
>>
>>
>> 0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64
>> -D CPU_TIMER_LIB_ENABLE=FALSE
>> python_exe=
>> Traceback (most recent call last):
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
>>     main()
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
>>     BuildUniversalPayload(args, MacroList)
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in
>> BuildUniversalPayload
>>     BuildDir     = os.path.join(os.environ['WORKSPACE'],
>> os.path.normpath("Build/UefiPayloadPkgX64"))
>>   File "/usr/lib/python3.8/os.py", line 675, in __getitem__
>>     raise KeyError(key) from None
>> KeyError: 'WORKSPACE'
>>
>>
>>
>>
>>
>>
>>
>> *Thanks & Regards Ritul Guru +91-9916513186*
>>
>>
>>
>>
>>
>> On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com> wrote:
>>
>> UniversalPayload.sh have Clang tool chain dependency.
>>
>>
>>
>> I assume your machine is ubuntu-20.10, please download it. And set use
>> export PATH=$PATH:<Clang bin path> to prevent the issue.
>>
>>
>>
>>
>> https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz
>>
>>
>>
>> Thanks,
>>
>> Gua
>>
>>
>>
>> *From:* ritul guru <ritul.bits@gmail.com>
>> *Sent:* Monday, February 6, 2023 7:37 PM
>> *To:* Guo, Gua <gua.guo@intel.com>
>> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
>> linux
>>
>>
>>
>> Thanks,
>>
>>
>>
>> 17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64
>> -D CPU_TIMER_LIB_ENABLE=FALSE
>> python_exe=/usr/bin/python3.8
>> "llvm-objcopy" --version
>> /bin/sh: 1: llvm-objcopy: not found
>> - Failed - error happened when run command: "llvm-objcopy" --version
>> - Failed - Please check if LLVM is installed or if CLANG_BIN is set
>> correctly
>> ✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]
>>
>>
>>
>>
>>
>> I am seeing above errors, is clang required for UniversalPayloadBuild.sh
>> compilation?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *Thanks & Regards Ritul Guru +91-9916513186*
>>
>>
>>
>>
>>
>> On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com> wrote:
>>
>> I just quickly check your command, look like it incorrect UefiPayload
>>
>>
>>
>> For Uefi Payload
>>
>>    - build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a
>>    IA32 -a X64 -D BOOTLOADER=COREBOOT
>>
>>
>>
>> For Uefi Universal Payload
>>
>>    - *Coreboot *
>>
>> git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
>>
>> cd Coreboot
>>
>> git submodule update --init
>>
>> make iasl
>>
>> make crossgcc
>>
>> make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
>>
>> make
>>
>>
>>
>>    - *Edk2*
>>
>> git clone https://github.com/tianocore/edk2.git Edk2
>>
>> cd Edk2
>>
>> git submodule update --init
>>
>> source ./edksetup.sh
>>
>> make -C ./BaseTools
>>
>> bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D
>> CPU_TIMER_LIB_ENABLE=FALSE
>>
>>
>>
>>    - *ShimLayer*
>>
>> git clone
>> https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer
>> ShimLayer
>>
>> cd ShimLayer
>>
>> bash CorebootShimBuild.sh
>>
>>
>>
>>    - *Test Procedure*
>>
>>
>>    1. Copy "ShimLayer/Build/ShimLayer.elf" and
>>    "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
>>
>> 2.    cd Coreboot/build
>>
>> 3.    Do the following commands.
>>
>> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>>
>> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
>> ShimLayer.elf
>>
>> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>>
>> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
>> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>>
>> qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35
>>
>>
>>
>> Thanks,
>>
>> Gua
>>
>> *From:* devel@edk2.groups.io <devel@edk2.groups.io> *On Behalf Of *ritul
>> guru
>> *Sent:* Friday, February 3, 2023 11:08 PM
>> *To:* Mike Maslenkin <mike.maslenkin@gmail.com>
>> *Cc:* devel@edk2.groups.io
>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
>> linux
>>
>>
>>
>> Thanks,
>>
>>
>>
>> build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" *-b DEBUG* -t GCC5 -a IA32
>> -a X64 -D COREBOOT
>>
>>
>>
>> I used above cmd, added DEBUG option by seeing NO debug messages coming
>> from uefipayload.
>>
>> any idea how to enable debug messages coming from uefipayload built with
>> above cmd?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *Thanks & Regards Ritul Guru +91-9916513186*
>>
>>
>>
>>
>>
>> On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com>
>> wrote:
>>
>> Hi Ritul Guru.
>>
>> There is a misprint in path to dsc file.
>> The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
>> But there is another issue with your command line exists.
>> The instructions you are referred to [1]  contain a sentence:
>> "NOTE: Pure 32bit UEFI payload support could be added if required
>> later.", i.e. it won't build.
>> So, you need to build either pure X64 or X64 build with IA32 entry.
>>
>> The command line for the latter is:
>> "build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"
>>
>> *[1]
>> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55
>>
>> Regards,
>> Mike.
>>
>>
>>
>> On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com> wrote:
>> >
>> >
>> > Hi,
>> > I was following below link to build UEfiPayload for coreboot to boot
>> from,
>> >
>> >
>> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>> >
>> > but getting below error,
>> > would appreciate help, thanks.
>> >
>> >
>> > ~/src/opensource/edk2 [master| ]
>> > 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
>> > Build environment:
>> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
>> > Build start time: 03:04:57, Feb.03 2023
>> >
>> > WORKSPACE        = /home//src/opensource/edk2
>> > EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
>> > CONF_PATH        = /home//src/opensource/edk2/Conf
>> > PYTHON_COMMAND   = /usr/bin/python3.8
>> >
>> >
>> > build.py...
>> >  : error C0DE: Unknown fatal error when processing
>> [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>> >
>> > (Please send email to devel@edk2.groups.io for help, attaching
>> following call stack trace!)
>> >
>> > (Python 3.8.10 on linux) Traceback (most recent call last):
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 2692, in Main
>> >     MyBuild = Build(Target, Workspace, Option,LogQ)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 815, in __init__
>> >     self.InitPreBuild()
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 1015, in InitPreBuild
>> >     self.LoadConfiguration()
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 971, in LoadConfiguration
>> >     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 905, in GetToolChainAndFamilyFromDsc
>> >     dscobj = self.BuildDatabase[File, BuildArch]
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
>> line 104, in __getitem__
>> >     BuildObject = self.CreateBuildObject(FilePath, Arch, Target,
>> Toolchain)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
>> line 120, in CreateBuildObject
>> >     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
>> line 426, in __new__
>> >     reval = Class._FILE_TABLE_[FileType](*Args)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
>> line 303, in __init__
>> >     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC,
>> Temporary, FromItem)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
>> line 39, in __init__
>> >     MetaFile.TimeStamp,
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line
>> 1539, in TimeStamp
>> >     return os.stat(self.Path)[8]
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py",
>> line 51, in stat
>> >     return os.stat(LongFilePath(path))
>> > FileNotFoundError: [Errno 2] No such file or directory:
>> '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>> >
>> >
>> >
>> >
>> >
>> > Thanks & Regards
>> > Ritul Guru
>> > +91-9916513186
>>
>> 
>>
>>

[-- Attachment #2: Type: text/html, Size: 29442 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 15:12                 ` ritul guru
@ 2023-02-06 15:13                   ` Guo, Gua
  2023-02-06 16:51                     ` ritul guru
  2023-02-06 23:08                   ` Guo, Gua
  1 sibling, 1 reply; 16+ messages in thread
From: Guo, Gua @ 2023-02-06 15:13 UTC (permalink / raw)
  To: ritul guru; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 15187 bytes --]

Do you set clang bin path ?

From: ritul guru <ritul.bits@gmail.com>
Sent: Monday, February 6, 2023 11:12 PM
To: Guo, Gua <gua.guo@intel.com>
Cc: devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

getting below error:

build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
Build environment: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
Build start time: 20:37:47, Feb.06 2023

WORKSPACE        = /home/a/src/opensource/edk2
EDK_TOOLS_PATH   = /home/a/src/opensource/edk2/BaseTools
CONF_PATH        = /home/a/src/opensource/edk2/Conf
PYTHON_COMMAND   = /usr/bin/python3.8


Processing meta-data .
Architecture(s)  = IA32 X64
Build target     = DEBUG
Toolchain        = CLANGDWARF

Active Platform          = /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadPkg.dsc
Active Module            = /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
.build: : warning: The PCD was not specified by any INF module in the platform for the given architecture.
PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
Platform: [UefiPayloadPkg.dsc]
Arch: ['IA32']
build: : warning: The PCD was not specified by any INF module in the platform for the given architecture.
PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
Platform: [UefiPayloadPkg.dsc]
Arch: ['IA32']
done!
Generating code . done!
Generating makefile . done!
Building ... /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf [IA32]
"clang"  -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=BaseUefiCpuLibStrings -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-unaligned-access -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -m32 -Oz -flto -march=i586 -target i686-pc-linux-gnu -g -malign-double -D DISABLE_NEW_DEPRECATED_INTERFACES -c -o /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/./BaseUefiCpuLib.obj -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32 -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib -I/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/DEBUG -I/home/a/src/opensource/edk2/MdePkg -I/home/a/src/opensource/edk2/MdePkg/Include -I/home/a/src/opensource/edk2/MdePkg/Test/UnitTest/Include -I/home/a/src/opensource/edk2/MdePkg/Include/Ia32 -I/home/a/src/opensource/edk2/UefiCpuPkg -I/home/a/src/opensource/edk2/UefiCpuPkg/Include /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
/bin/sh: 1: clang: not found
make: *** [GNUmakefile:344: /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/BaseUefiCpuLib.obj] Error 127


build.py...
: error 7000: Failed to execute command
make tbuild [/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib]


build.py...
: error F002: Failed to build module
/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf [IA32, CLANGDWARF, DEBUG]

- Failed -
Build end time: 20:37:54, Feb.06 2023
Build total time: 00:00:07

- Failed - error happened when run command: build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
Traceback (most recent call last):
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
    main()
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
    BuildUniversalPayload(args, MacroList)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 108, in BuildUniversalPayload
    RunCommand(BuildModule)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 51, in RunCommand
    raise Exception("ERROR: when run command: %s"%cmd)
Exception: ERROR: when run command: build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE


Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 8:23 PM ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>> wrote:
thanks,

./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f ShimLayer.elf
./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma

with above commands, we can inject shim.elf and uefipayload.elf into coreboot image, and should be able to boot from this payload?

Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 7:56 PM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:
I think you can run “. edksetup.sh” in your local and WORKSPACE will be setup automatically.

From: ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>>
Sent: Monday, February 6, 2023 10:22 PM
To: Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

workspace needs to be set to any value?

0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D CPU_TIMER_LIB_ENABLE=FALSE
python_exe=
Traceback (most recent call last):
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
    main()
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
    BuildUniversalPayload(args, MacroList)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in BuildUniversalPayload
    BuildDir     = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
  File "/usr/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'WORKSPACE'


Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:
UniversalPayload.sh have Clang tool chain dependency.

I assume your machine is ubuntu-20.10, please download it. And set use export PATH=$PATH:<Clang bin path> to prevent the issue.

https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz

Thanks,
Gua

From: ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>>
Sent: Monday, February 6, 2023 7:37 PM
To: Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

Thanks,

17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D CPU_TIMER_LIB_ENABLE=FALSE
python_exe=/usr/bin/python3.8
"llvm-objcopy" --version
/bin/sh: 1: llvm-objcopy: not found
- Failed - error happened when run command: "llvm-objcopy" --version
- Failed - Please check if LLVM is installed or if CLANG_BIN is set correctly
✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]


I am seeing above errors, is clang required for UniversalPayloadBuild.sh compilation?



Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:
I just quickly check your command, look like it incorrect UefiPayload

For Uefi Payload

  *   build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D BOOTLOADER=COREBOOT

For Uefi Universal Payload

  *   Coreboot
git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
cd Coreboot
git submodule update --init
make iasl
make crossgcc
make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
make


  *   Edk2
git clone https://github.com/tianocore/edk2.git Edk2
cd Edk2
git submodule update --init
source ./edksetup.sh
make -C ./BaseTools
bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D CPU_TIMER_LIB_ENABLE=FALSE


  *   ShimLayer
git clone https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer  ShimLayer
cd ShimLayer
bash CorebootShimBuild.sh


  *   Test Procedure

  1.  Copy "ShimLayer/Build/ShimLayer.elf" and "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
2.    cd Coreboot/build
3.    Do the following commands.
./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f ShimLayer.elf
./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35

Thanks,
Gua
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of ritul guru
Sent: Friday, February 3, 2023 11:08 PM
To: Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

Thanks,

build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D COREBOOT

I used above cmd, added DEBUG option by seeing NO debug messages coming from uefipayload.
any idea how to enable debug messages coming from uefipayload built with above cmd?




Thanks & Regards
Ritul Guru
+91-9916513186


On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>> wrote:
Hi Ritul Guru.

There is a misprint in path to dsc file.
The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
But there is another issue with your command line exists.
The instructions you are referred to [1]  contain a sentence:
"NOTE: Pure 32bit UEFI payload support could be added if required
later.", i.e. it won't build.
So, you need to build either pure X64 or X64 build with IA32 entry.

The command line for the latter is:
"build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"

*[1] https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55

Regards,
Mike.



On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>> wrote:
>
>
> Hi,
> I was following below link to build UEfiPayload for coreboot to boot from,
>
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>
> but getting below error,
> would appreciate help, thanks.
>
>
> ~/src/opensource/edk2 [master| ]
> 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> Build environment: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> Build start time: 03:04:57, Feb.03 2023
>
> WORKSPACE        = /home//src/opensource/edk2
> EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> CONF_PATH        = /home//src/opensource/edk2/Conf
> PYTHON_COMMAND   = /usr/bin/python3.8
>
>
> build.py...
>  : error C0DE: Unknown fatal error when processing [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>
> (Please send email to devel@edk2.groups.io<mailto:devel@edk2.groups.io> for help, attaching following call stack trace!)
>
> (Python 3.8.10 on linux) Traceback (most recent call last):
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2692, in Main
>     MyBuild = Build(Target, Workspace, Option,LogQ)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 815, in __init__
>     self.InitPreBuild()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1015, in InitPreBuild
>     self.LoadConfiguration()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 971, in LoadConfiguration
>     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 905, in GetToolChainAndFamilyFromDsc
>     dscobj = self.BuildDatabase[File, BuildArch]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 104, in __getitem__
>     BuildObject = self.CreateBuildObject(FilePath, Arch, Target, Toolchain)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 120, in CreateBuildObject
>     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 426, in __new__
>     reval = Class._FILE_TABLE_[FileType](*Args)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 303, in __init__
>     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary, FromItem)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 39, in __init__
>     MetaFile.TimeStamp,
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line 1539, in TimeStamp
>     return os.stat(self.Path)[8]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py", line 51, in stat
>     return os.stat(LongFilePath(path))
> FileNotFoundError: [Errno 2] No such file or directory: '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>
>
>
>
>
> Thanks & Regards
> Ritul Guru
> +91-9916513186


[-- Attachment #2: Type: text/html, Size: 49262 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 15:13                   ` Guo, Gua
@ 2023-02-06 16:51                     ` ritul guru
  2023-02-06 17:52                       ` ritul guru
  0 siblings, 1 reply; 16+ messages in thread
From: ritul guru @ 2023-02-06 16:51 UTC (permalink / raw)
  To: Guo, Gua; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 16098 bytes --]

PATH=$PATH:/usr/bin/clang

yes, set it as above.



*Thanks & RegardsRitul Guru+91-9916513186*


On Mon, Feb 6, 2023 at 8:43 PM Guo, Gua <gua.guo@intel.com> wrote:

> Do you set clang bin path ?
>
>
>
> *From:* ritul guru <ritul.bits@gmail.com>
> *Sent:* Monday, February 6, 2023 11:12 PM
> *To:* Guo, Gua <gua.guo@intel.com>
> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> getting below error:
>
>
>
> build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
> UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
>  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
> Build environment:
> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> Build start time: 20:37:47, Feb.06 2023
>
> WORKSPACE        = /home/a/src/opensource/edk2
> EDK_TOOLS_PATH   = /home/a/src/opensource/edk2/BaseTools
> CONF_PATH        = /home/a/src/opensource/edk2/Conf
> PYTHON_COMMAND   = /usr/bin/python3.8
>
>
> Processing meta-data .
> Architecture(s)  = IA32 X64
> Build target     = DEBUG
> Toolchain        = CLANGDWARF
>
> Active Platform          =
> /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadPkg.dsc
> Active Module            =
> /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
> .build: : warning: The PCD was not specified by any INF module in the
> platform for the given architecture.
> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
> Platform: [UefiPayloadPkg.dsc]
> Arch: ['IA32']
> build: : warning: The PCD was not specified by any INF module in the
> platform for the given architecture.
> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
> Platform: [UefiPayloadPkg.dsc]
> Arch: ['IA32']
> done!
> Generating code . done!
> Generating makefile . done!
> Building ...
> /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
> [IA32]
> "clang"  -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall
> -Werror -Wno-array-bounds -include AutoGen.h -fno-common
> -ffunction-sections -fdata-sections
> -DSTRING_ARRAY_NAME=BaseUefiCpuLibStrings -Wno-parentheses-equality
> -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare
> -Wno-empty-body -Wno-unused-const-variable -Wno-varargs
> -Wno-unknown-warning-option -Wno-unused-but-set-variable
> -Wno-unused-const-variable -Wno-unaligned-access -fno-stack-protector
> -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas
> -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables
> -mno-sse -mno-mmx -msoft-float -mno-implicit-float
> -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang
> -funsigned-char -fno-ms-extensions -Wno-null-dereference -m32 -Oz -flto
> -march=i586 -target i686-pc-linux-gnu -g -malign-double -D
> DISABLE_NEW_DEPRECATED_INTERFACES -c -o
> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/./BaseUefiCpuLib.obj
> -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32
> -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib
> -I/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/DEBUG
> -I/home/a/src/opensource/edk2/MdePkg
> -I/home/a/src/opensource/edk2/MdePkg/Include
> -I/home/a/src/opensource/edk2/MdePkg/Test/UnitTest/Include
> -I/home/a/src/opensource/edk2/MdePkg/Include/Ia32
> -I/home/a/src/opensource/edk2/UefiCpuPkg
> -I/home/a/src/opensource/edk2/UefiCpuPkg/Include
> /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
> /bin/sh: 1: clang: not found
> make: *** [GNUmakefile:344:
> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/BaseUefiCpuLib.obj]
> Error 127
>
>
> build.py...
> : error 7000: Failed to execute command
> make tbuild
> [/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib]
>
>
> build.py...
> : error F002: Failed to build module
> /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
> [IA32, CLANGDWARF, DEBUG]
>
> - Failed -
> Build end time: 20:37:54, Feb.06 2023
> Build total time: 00:00:07
>
> - Failed - error happened when run command: build -p
> UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
> UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
>  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
> Traceback (most recent call last):
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
>     main()
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
>     BuildUniversalPayload(args, MacroList)
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 108, in
> BuildUniversalPayload
>     RunCommand(BuildModule)
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 51, in RunCommand
>     raise Exception("ERROR: when run command: %s"%cmd)
> Exception: ERROR: when run command: build -p
> UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
> UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
>  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Mon, Feb 6, 2023 at 8:23 PM ritul guru <ritul.bits@gmail.com> wrote:
>
> thanks,
>
>
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>
> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
> ShimLayer.elf
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>
> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>
>
>
> with above commands, we can inject shim.elf and uefipayload.elf into
> coreboot image, and should be able to boot from this payload?
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Mon, Feb 6, 2023 at 7:56 PM Guo, Gua <gua.guo@intel.com> wrote:
>
> I think you can run “. edksetup.sh” in your local and WORKSPACE will be
> setup automatically.
>
>
>
> *From:* ritul guru <ritul.bits@gmail.com>
> *Sent:* Monday, February 6, 2023 10:22 PM
> *To:* Guo, Gua <gua.guo@intel.com>
> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> workspace needs to be set to any value?
>
>
>
> 0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D
> CPU_TIMER_LIB_ENABLE=FALSE
> python_exe=
> Traceback (most recent call last):
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
>     main()
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
>     BuildUniversalPayload(args, MacroList)
>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in
> BuildUniversalPayload
>     BuildDir     = os.path.join(os.environ['WORKSPACE'],
> os.path.normpath("Build/UefiPayloadPkgX64"))
>   File "/usr/lib/python3.8/os.py", line 675, in __getitem__
>     raise KeyError(key) from None
> KeyError: 'WORKSPACE'
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com> wrote:
>
> UniversalPayload.sh have Clang tool chain dependency.
>
>
>
> I assume your machine is ubuntu-20.10, please download it. And set use
> export PATH=$PATH:<Clang bin path> to prevent the issue.
>
>
>
>
> https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz
>
>
>
> Thanks,
>
> Gua
>
>
>
> *From:* ritul guru <ritul.bits@gmail.com>
> *Sent:* Monday, February 6, 2023 7:37 PM
> *To:* Guo, Gua <gua.guo@intel.com>
> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> Thanks,
>
>
>
> 17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64
> -D CPU_TIMER_LIB_ENABLE=FALSE
> python_exe=/usr/bin/python3.8
> "llvm-objcopy" --version
> /bin/sh: 1: llvm-objcopy: not found
> - Failed - error happened when run command: "llvm-objcopy" --version
> - Failed - Please check if LLVM is installed or if CLANG_BIN is set
> correctly
> ✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]
>
>
>
>
>
> I am seeing above errors, is clang required for UniversalPayloadBuild.sh
> compilation?
>
>
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com> wrote:
>
> I just quickly check your command, look like it incorrect UefiPayload
>
>
>
> For Uefi Payload
>
>    - build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a
>    IA32 -a X64 -D BOOTLOADER=COREBOOT
>
>
>
> For Uefi Universal Payload
>
>    - *Coreboot *
>
> git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
>
> cd Coreboot
>
> git submodule update --init
>
> make iasl
>
> make crossgcc
>
> make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
>
> make
>
>
>
>    - *Edk2*
>
> git clone https://github.com/tianocore/edk2.git Edk2
>
> cd Edk2
>
> git submodule update --init
>
> source ./edksetup.sh
>
> make -C ./BaseTools
>
> bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D
> CPU_TIMER_LIB_ENABLE=FALSE
>
>
>
>    - *ShimLayer*
>
> git clone
> https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer
> ShimLayer
>
> cd ShimLayer
>
> bash CorebootShimBuild.sh
>
>
>
>    - *Test Procedure*
>
>
>    1. Copy "ShimLayer/Build/ShimLayer.elf" and
>    "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
>
> 2.    cd Coreboot/build
>
> 3.    Do the following commands.
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>
> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
> ShimLayer.elf
>
> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>
> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>
> qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35
>
>
>
> Thanks,
>
> Gua
>
> *From:* devel@edk2.groups.io <devel@edk2.groups.io> *On Behalf Of *ritul
> guru
> *Sent:* Friday, February 3, 2023 11:08 PM
> *To:* Mike Maslenkin <mike.maslenkin@gmail.com>
> *Cc:* devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
> linux
>
>
>
> Thanks,
>
>
>
> build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" *-b DEBUG* -t GCC5 -a IA32
> -a X64 -D COREBOOT
>
>
>
> I used above cmd, added DEBUG option by seeing NO debug messages coming
> from uefipayload.
>
> any idea how to enable debug messages coming from uefipayload built with
> above cmd?
>
>
>
>
>
>
>
>
>
>
>
> *Thanks & Regards Ritul Guru +91-9916513186*
>
>
>
>
>
> On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com>
> wrote:
>
> Hi Ritul Guru.
>
> There is a misprint in path to dsc file.
> The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
> But there is another issue with your command line exists.
> The instructions you are referred to [1]  contain a sentence:
> "NOTE: Pure 32bit UEFI payload support could be added if required
> later.", i.e. it won't build.
> So, you need to build either pure X64 or X64 build with IA32 entry.
>
> The command line for the latter is:
> "build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"
>
> *[1]
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55
>
> Regards,
> Mike.
>
>
>
> On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com> wrote:
> >
> >
> > Hi,
> > I was following below link to build UEfiPayload for coreboot to boot
> from,
> >
> >
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
> >
> > but getting below error,
> > would appreciate help, thanks.
> >
> >
> > ~/src/opensource/edk2 [master| ]
> > 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> > Build environment:
> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> > Build start time: 03:04:57, Feb.03 2023
> >
> > WORKSPACE        = /home//src/opensource/edk2
> > EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> > CONF_PATH        = /home//src/opensource/edk2/Conf
> > PYTHON_COMMAND   = /usr/bin/python3.8
> >
> >
> > build.py...
> >  : error C0DE: Unknown fatal error when processing
> [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
> >
> > (Please send email to devel@edk2.groups.io for help, attaching
> following call stack trace!)
> >
> > (Python 3.8.10 on linux) Traceback (most recent call last):
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 2692, in Main
> >     MyBuild = Build(Target, Workspace, Option,LogQ)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 815, in __init__
> >     self.InitPreBuild()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 1015, in InitPreBuild
> >     self.LoadConfiguration()
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 971, in LoadConfiguration
> >     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
> >   File
> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
> line 905, in GetToolChainAndFamilyFromDsc
> >     dscobj = self.BuildDatabase[File, BuildArch]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 104, in __getitem__
> >     BuildObject = self.CreateBuildObject(FilePath, Arch, Target,
> Toolchain)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
> line 120, in CreateBuildObject
> >     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 426, in __new__
> >     reval = Class._FILE_TABLE_[FileType](*Args)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 303, in __init__
> >     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC,
> Temporary, FromItem)
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
> line 39, in __init__
> >     MetaFile.TimeStamp,
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line
> 1539, in TimeStamp
> >     return os.stat(self.Path)[8]
> >   File
> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py",
> line 51, in stat
> >     return os.stat(LongFilePath(path))
> > FileNotFoundError: [Errno 2] No such file or directory:
> '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
> >
> >
> >
> >
> >
> > Thanks & Regards
> > Ritul Guru
> > +91-9916513186
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 32450 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 16:51                     ` ritul guru
@ 2023-02-06 17:52                       ` ritul guru
  2023-02-06 18:02                         ` ritul guru
  0 siblings, 1 reply; 16+ messages in thread
From: ritul guru @ 2023-02-06 17:52 UTC (permalink / raw)
  To: Guo, Gua; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 16819 bytes --]

is it right? llvm path also need to set?



*Thanks & RegardsRitul Guru+91-9916513186*


On Mon, Feb 6, 2023 at 10:21 PM ritul guru <ritul.bits@gmail.com> wrote:

> PATH=$PATH:/usr/bin/clang
>
> yes, set it as above.
>
>
>
> *Thanks & RegardsRitul Guru+91-9916513186*
>
>
> On Mon, Feb 6, 2023 at 8:43 PM Guo, Gua <gua.guo@intel.com> wrote:
>
>> Do you set clang bin path ?
>>
>>
>>
>> *From:* ritul guru <ritul.bits@gmail.com>
>> *Sent:* Monday, February 6, 2023 11:12 PM
>> *To:* Guo, Gua <gua.guo@intel.com>
>> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
>> linux
>>
>>
>>
>> getting below error:
>>
>>
>>
>> build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
>> UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
>>  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
>> Build environment:
>> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
>> Build start time: 20:37:47, Feb.06 2023
>>
>> WORKSPACE        = /home/a/src/opensource/edk2
>> EDK_TOOLS_PATH   = /home/a/src/opensource/edk2/BaseTools
>> CONF_PATH        = /home/a/src/opensource/edk2/Conf
>> PYTHON_COMMAND   = /usr/bin/python3.8
>>
>>
>> Processing meta-data .
>> Architecture(s)  = IA32 X64
>> Build target     = DEBUG
>> Toolchain        = CLANGDWARF
>>
>> Active Platform          =
>> /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadPkg.dsc
>> Active Module            =
>> /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
>> .build: : warning: The PCD was not specified by any INF module in the
>> platform for the given architecture.
>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
>> Platform: [UefiPayloadPkg.dsc]
>> Arch: ['IA32']
>> build: : warning: The PCD was not specified by any INF module in the
>> platform for the given architecture.
>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
>> Platform: [UefiPayloadPkg.dsc]
>> Arch: ['IA32']
>> done!
>> Generating code . done!
>> Generating makefile . done!
>> Building ...
>> /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>> [IA32]
>> "clang"  -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall
>> -Werror -Wno-array-bounds -include AutoGen.h -fno-common
>> -ffunction-sections -fdata-sections
>> -DSTRING_ARRAY_NAME=BaseUefiCpuLibStrings -Wno-parentheses-equality
>> -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare
>> -Wno-empty-body -Wno-unused-const-variable -Wno-varargs
>> -Wno-unknown-warning-option -Wno-unused-but-set-variable
>> -Wno-unused-const-variable -Wno-unaligned-access -fno-stack-protector
>> -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas
>> -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables
>> -mno-sse -mno-mmx -msoft-float -mno-implicit-float
>> -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang
>> -funsigned-char -fno-ms-extensions -Wno-null-dereference -m32 -Oz -flto
>> -march=i586 -target i686-pc-linux-gnu -g -malign-double -D
>> DISABLE_NEW_DEPRECATED_INTERFACES -c -o
>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/./BaseUefiCpuLib.obj
>> -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32
>> -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib
>> -I/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/DEBUG
>> -I/home/a/src/opensource/edk2/MdePkg
>> -I/home/a/src/opensource/edk2/MdePkg/Include
>> -I/home/a/src/opensource/edk2/MdePkg/Test/UnitTest/Include
>> -I/home/a/src/opensource/edk2/MdePkg/Include/Ia32
>> -I/home/a/src/opensource/edk2/UefiCpuPkg
>> -I/home/a/src/opensource/edk2/UefiCpuPkg/Include
>> /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
>> /bin/sh: 1: clang: not found
>> make: *** [GNUmakefile:344:
>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/BaseUefiCpuLib.obj]
>> Error 127
>>
>>
>> build.py...
>> : error 7000: Failed to execute command
>> make tbuild
>> [/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib]
>>
>>
>> build.py...
>> : error F002: Failed to build module
>> /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>> [IA32, CLANGDWARF, DEBUG]
>>
>> - Failed -
>> Build end time: 20:37:54, Feb.06 2023
>> Build total time: 00:00:07
>>
>> - Failed - error happened when run command: build -p
>> UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
>> UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
>>  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
>> Traceback (most recent call last):
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
>>     main()
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
>>     BuildUniversalPayload(args, MacroList)
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 108, in
>> BuildUniversalPayload
>>     RunCommand(BuildModule)
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 51, in RunCommand
>>     raise Exception("ERROR: when run command: %s"%cmd)
>> Exception: ERROR: when run command: build -p
>> UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
>> UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
>>  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
>>
>>
>>
>>
>>
>>
>>
>> *Thanks & Regards Ritul Guru +91-9916513186*
>>
>>
>>
>>
>>
>> On Mon, Feb 6, 2023 at 8:23 PM ritul guru <ritul.bits@gmail.com> wrote:
>>
>> thanks,
>>
>>
>>
>> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>>
>> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
>> ShimLayer.elf
>>
>> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>>
>> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
>> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>>
>>
>>
>> with above commands, we can inject shim.elf and uefipayload.elf into
>> coreboot image, and should be able to boot from this payload?
>>
>>
>>
>>
>>
>> *Thanks & Regards Ritul Guru +91-9916513186*
>>
>>
>>
>>
>>
>> On Mon, Feb 6, 2023 at 7:56 PM Guo, Gua <gua.guo@intel.com> wrote:
>>
>> I think you can run “. edksetup.sh” in your local and WORKSPACE will be
>> setup automatically.
>>
>>
>>
>> *From:* ritul guru <ritul.bits@gmail.com>
>> *Sent:* Monday, February 6, 2023 10:22 PM
>> *To:* Guo, Gua <gua.guo@intel.com>
>> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
>> linux
>>
>>
>>
>> workspace needs to be set to any value?
>>
>>
>>
>> 0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64
>> -D CPU_TIMER_LIB_ENABLE=FALSE
>> python_exe=
>> Traceback (most recent call last):
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
>>     main()
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
>>     BuildUniversalPayload(args, MacroList)
>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in
>> BuildUniversalPayload
>>     BuildDir     = os.path.join(os.environ['WORKSPACE'],
>> os.path.normpath("Build/UefiPayloadPkgX64"))
>>   File "/usr/lib/python3.8/os.py", line 675, in __getitem__
>>     raise KeyError(key) from None
>> KeyError: 'WORKSPACE'
>>
>>
>>
>>
>>
>>
>>
>> *Thanks & Regards Ritul Guru +91-9916513186*
>>
>>
>>
>>
>>
>> On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com> wrote:
>>
>> UniversalPayload.sh have Clang tool chain dependency.
>>
>>
>>
>> I assume your machine is ubuntu-20.10, please download it. And set use
>> export PATH=$PATH:<Clang bin path> to prevent the issue.
>>
>>
>>
>>
>> https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz
>>
>>
>>
>> Thanks,
>>
>> Gua
>>
>>
>>
>> *From:* ritul guru <ritul.bits@gmail.com>
>> *Sent:* Monday, February 6, 2023 7:37 PM
>> *To:* Guo, Gua <gua.guo@intel.com>
>> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
>> linux
>>
>>
>>
>> Thanks,
>>
>>
>>
>> 17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64
>> -D CPU_TIMER_LIB_ENABLE=FALSE
>> python_exe=/usr/bin/python3.8
>> "llvm-objcopy" --version
>> /bin/sh: 1: llvm-objcopy: not found
>> - Failed - error happened when run command: "llvm-objcopy" --version
>> - Failed - Please check if LLVM is installed or if CLANG_BIN is set
>> correctly
>> ✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]
>>
>>
>>
>>
>>
>> I am seeing above errors, is clang required for UniversalPayloadBuild.sh
>> compilation?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *Thanks & Regards Ritul Guru +91-9916513186*
>>
>>
>>
>>
>>
>> On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com> wrote:
>>
>> I just quickly check your command, look like it incorrect UefiPayload
>>
>>
>>
>> For Uefi Payload
>>
>>    - build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a
>>    IA32 -a X64 -D BOOTLOADER=COREBOOT
>>
>>
>>
>> For Uefi Universal Payload
>>
>>    - *Coreboot *
>>
>> git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
>>
>> cd Coreboot
>>
>> git submodule update --init
>>
>> make iasl
>>
>> make crossgcc
>>
>> make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
>>
>> make
>>
>>
>>
>>    - *Edk2*
>>
>> git clone https://github.com/tianocore/edk2.git Edk2
>>
>> cd Edk2
>>
>> git submodule update --init
>>
>> source ./edksetup.sh
>>
>> make -C ./BaseTools
>>
>> bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D
>> CPU_TIMER_LIB_ENABLE=FALSE
>>
>>
>>
>>    - *ShimLayer*
>>
>> git clone
>> https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer
>> ShimLayer
>>
>> cd ShimLayer
>>
>> bash CorebootShimBuild.sh
>>
>>
>>
>>    - *Test Procedure*
>>
>>
>>    1. Copy "ShimLayer/Build/ShimLayer.elf" and
>>    "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
>>
>> 2.    cd Coreboot/build
>>
>> 3.    Do the following commands.
>>
>> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>>
>> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
>> ShimLayer.elf
>>
>> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>>
>> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
>> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>>
>> qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35
>>
>>
>>
>> Thanks,
>>
>> Gua
>>
>> *From:* devel@edk2.groups.io <devel@edk2.groups.io> *On Behalf Of *ritul
>> guru
>> *Sent:* Friday, February 3, 2023 11:08 PM
>> *To:* Mike Maslenkin <mike.maslenkin@gmail.com>
>> *Cc:* devel@edk2.groups.io
>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode in
>> linux
>>
>>
>>
>> Thanks,
>>
>>
>>
>> build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" *-b DEBUG* -t GCC5 -a IA32
>> -a X64 -D COREBOOT
>>
>>
>>
>> I used above cmd, added DEBUG option by seeing NO debug messages coming
>> from uefipayload.
>>
>> any idea how to enable debug messages coming from uefipayload built with
>> above cmd?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *Thanks & Regards Ritul Guru +91-9916513186*
>>
>>
>>
>>
>>
>> On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com>
>> wrote:
>>
>> Hi Ritul Guru.
>>
>> There is a misprint in path to dsc file.
>> The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
>> But there is another issue with your command line exists.
>> The instructions you are referred to [1]  contain a sentence:
>> "NOTE: Pure 32bit UEFI payload support could be added if required
>> later.", i.e. it won't build.
>> So, you need to build either pure X64 or X64 build with IA32 entry.
>>
>> The command line for the latter is:
>> "build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"
>>
>> *[1]
>> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55
>>
>> Regards,
>> Mike.
>>
>>
>>
>> On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com> wrote:
>> >
>> >
>> > Hi,
>> > I was following below link to build UEfiPayload for coreboot to boot
>> from,
>> >
>> >
>> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>> >
>> > but getting below error,
>> > would appreciate help, thanks.
>> >
>> >
>> > ~/src/opensource/edk2 [master| ]
>> > 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
>> > Build environment:
>> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
>> > Build start time: 03:04:57, Feb.03 2023
>> >
>> > WORKSPACE        = /home//src/opensource/edk2
>> > EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
>> > CONF_PATH        = /home//src/opensource/edk2/Conf
>> > PYTHON_COMMAND   = /usr/bin/python3.8
>> >
>> >
>> > build.py...
>> >  : error C0DE: Unknown fatal error when processing
>> [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>> >
>> > (Please send email to devel@edk2.groups.io for help, attaching
>> following call stack trace!)
>> >
>> > (Python 3.8.10 on linux) Traceback (most recent call last):
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 2692, in Main
>> >     MyBuild = Build(Target, Workspace, Option,LogQ)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 815, in __init__
>> >     self.InitPreBuild()
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 1015, in InitPreBuild
>> >     self.LoadConfiguration()
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 971, in LoadConfiguration
>> >     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>> line 905, in GetToolChainAndFamilyFromDsc
>> >     dscobj = self.BuildDatabase[File, BuildArch]
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
>> line 104, in __getitem__
>> >     BuildObject = self.CreateBuildObject(FilePath, Arch, Target,
>> Toolchain)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
>> line 120, in CreateBuildObject
>> >     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
>> line 426, in __new__
>> >     reval = Class._FILE_TABLE_[FileType](*Args)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
>> line 303, in __init__
>> >     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC,
>> Temporary, FromItem)
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
>> line 39, in __init__
>> >     MetaFile.TimeStamp,
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line
>> 1539, in TimeStamp
>> >     return os.stat(self.Path)[8]
>> >   File
>> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py",
>> line 51, in stat
>> >     return os.stat(LongFilePath(path))
>> > FileNotFoundError: [Errno 2] No such file or directory:
>> '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>> >
>> >
>> >
>> >
>> >
>> > Thanks & Regards
>> > Ritul Guru
>> > +91-9916513186
>>
>> 
>>
>>

[-- Attachment #2: Type: text/html, Size: 33209 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 17:52                       ` ritul guru
@ 2023-02-06 18:02                         ` ritul guru
  0 siblings, 0 replies; 16+ messages in thread
From: ritul guru @ 2023-02-06 18:02 UTC (permalink / raw)
  To: Guo, Gua; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 21256 bytes --]

"clang" -o
/home/amd/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll
-nostdlib -Wl,-q,--gc-sections -z max-page-size=0x40
-Wl,--entry,_ModuleEntryPoint -u _ModuleEntryPoint
-Wl,-Map,/home/amd/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.map,--whole-archive
-flto -Wl,-O3 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie
-mcmodel=small -Wl,--apply-dynamic-relocs
-Wl,--start-group,@/home/amd/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/OUTPUT/static_library_files.lst,--end-group
-g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror
-Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections
-fdata-sections -DSTRING_ARRAY_NAME=UniversalPayloadEntryStrings
-Wno-parentheses-equality -Wno-tautological-compare
-Wno-tautological-constant-out-of-range-compare -Wno-empty-body
-Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option
-Wno-unused-but-set-variable -Wno-unused-const-variable
-Wno-unaligned-access -fno-stack-protector -mms-bitfields -Wno-address
-Wno-shift-negative-value -Wno-unknown-pragmas
-Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables
-mno-sse -mno-mmx -msoft-float -mno-implicit-float
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang
-funsigned-char -fno-ms-extensions -Wno-null-dereference -m64
"-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz
-flto -target x86_64-pc-linux-gnu -g -D DISABLE_NEW_DEPRECATED_INTERFACES
-Wl,--defsym=PECOFF_HEADER_SIZE=0x228
-Wl,--script=/home/amd/src/opensource/edk2/BaseTools/Scripts/ClangBase.lds
-O3 -fuse-ld=lld
clang: error: invalid linker name in argument '-fuse-ld=lld'
make: *** [GNUmakefile:368:
/home/amd/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry/DEBUG/UniversalPayloadEntry.dll]
Error 1


build.py...
: error 7000: Failed to execute command
make tbuild
[/home/amd/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry]


build.py...
: error F002: Failed to build module
/home/amd/src/opensource/edk2/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
[X64, CLANGDWARF, DEBUG]

- Failed -
Build end time: 22:16:30, Feb.06 2023
Build total time: 00:00:21

- Failed - error happened when run command: build -p
UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a X64 -m
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
/home/amd/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
 -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
Traceback (most recent call last):
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
    main()
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
    BuildUniversalPayload(args, MacroList)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 108, in
BuildUniversalPayload
    RunCommand(BuildModule)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 51, in RunCommand
    raise Exception("ERROR: when run command: %s"%cmd)
Exception: ERROR: when run command: build -p
UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a X64 -m
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
/home/amd/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
 -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE

getting above error.



*Thanks & RegardsRitul Guru+91-9916513186*


On Mon, Feb 6, 2023 at 11:22 PM ritul guru <ritul.bits@gmail.com> wrote:

> is it right? llvm path also need to set?
>
>
>
> *Thanks & RegardsRitul Guru+91-9916513186*
>
>
> On Mon, Feb 6, 2023 at 10:21 PM ritul guru <ritul.bits@gmail.com> wrote:
>
>> PATH=$PATH:/usr/bin/clang
>>
>> yes, set it as above.
>>
>>
>>
>> *Thanks & RegardsRitul Guru+91-9916513186*
>>
>>
>> On Mon, Feb 6, 2023 at 8:43 PM Guo, Gua <gua.guo@intel.com> wrote:
>>
>>> Do you set clang bin path ?
>>>
>>>
>>>
>>> *From:* ritul guru <ritul.bits@gmail.com>
>>> *Sent:* Monday, February 6, 2023 11:12 PM
>>> *To:* Guo, Gua <gua.guo@intel.com>
>>> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
>>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode
>>> in linux
>>>
>>>
>>>
>>> getting below error:
>>>
>>>
>>>
>>> build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
>>> UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
>>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
>>>  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
>>> Build environment:
>>> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
>>> Build start time: 20:37:47, Feb.06 2023
>>>
>>> WORKSPACE        = /home/a/src/opensource/edk2
>>> EDK_TOOLS_PATH   = /home/a/src/opensource/edk2/BaseTools
>>> CONF_PATH        = /home/a/src/opensource/edk2/Conf
>>> PYTHON_COMMAND   = /usr/bin/python3.8
>>>
>>>
>>> Processing meta-data .
>>> Architecture(s)  = IA32 X64
>>> Build target     = DEBUG
>>> Toolchain        = CLANGDWARF
>>>
>>> Active Platform          =
>>> /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadPkg.dsc
>>> Active Module            =
>>> /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
>>> .build: : warning: The PCD was not specified by any INF module in the
>>> platform for the given architecture.
>>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
>>> Platform: [UefiPayloadPkg.dsc]
>>> Arch: ['IA32']
>>> build: : warning: The PCD was not specified by any INF module in the
>>> platform for the given architecture.
>>> PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
>>> Platform: [UefiPayloadPkg.dsc]
>>> Arch: ['IA32']
>>> done!
>>> Generating code . done!
>>> Generating makefile . done!
>>> Building ...
>>> /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>>> [IA32]
>>> "clang"  -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall
>>> -Werror -Wno-array-bounds -include AutoGen.h -fno-common
>>> -ffunction-sections -fdata-sections
>>> -DSTRING_ARRAY_NAME=BaseUefiCpuLibStrings -Wno-parentheses-equality
>>> -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare
>>> -Wno-empty-body -Wno-unused-const-variable -Wno-varargs
>>> -Wno-unknown-warning-option -Wno-unused-but-set-variable
>>> -Wno-unused-const-variable -Wno-unaligned-access -fno-stack-protector
>>> -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas
>>> -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables
>>> -mno-sse -mno-mmx -msoft-float -mno-implicit-float
>>> -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang
>>> -funsigned-char -fno-ms-extensions -Wno-null-dereference -m32 -Oz -flto
>>> -march=i586 -target i686-pc-linux-gnu -g -malign-double -D
>>> DISABLE_NEW_DEPRECATED_INTERFACES -c -o
>>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/./BaseUefiCpuLib.obj
>>> -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32
>>> -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib
>>> -I/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/DEBUG
>>> -I/home/a/src/opensource/edk2/MdePkg
>>> -I/home/a/src/opensource/edk2/MdePkg/Include
>>> -I/home/a/src/opensource/edk2/MdePkg/Test/UnitTest/Include
>>> -I/home/a/src/opensource/edk2/MdePkg/Include/Ia32
>>> -I/home/a/src/opensource/edk2/UefiCpuPkg
>>> -I/home/a/src/opensource/edk2/UefiCpuPkg/Include
>>> /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
>>> /bin/sh: 1: clang: not found
>>> make: *** [GNUmakefile:344:
>>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/BaseUefiCpuLib.obj]
>>> Error 127
>>>
>>>
>>> build.py...
>>> : error 7000: Failed to execute command
>>> make tbuild
>>> [/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib]
>>>
>>>
>>> build.py...
>>> : error F002: Failed to build module
>>> /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>>> [IA32, CLANGDWARF, DEBUG]
>>>
>>> - Failed -
>>> Build end time: 20:37:54, Feb.06 2023
>>> Build total time: 00:00:07
>>>
>>> - Failed - error happened when run command: build -p
>>> UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
>>> UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
>>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
>>>  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
>>> Traceback (most recent call last):
>>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
>>>     main()
>>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
>>>     BuildUniversalPayload(args, MacroList)
>>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 108, in
>>> BuildUniversalPayload
>>>     RunCommand(BuildModule)
>>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 51, in RunCommand
>>>     raise Exception("ERROR: when run command: %s"%cmd)
>>> Exception: ERROR: when run command: build -p
>>> UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m
>>> UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y
>>> /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt
>>>  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *Thanks & Regards Ritul Guru +91-9916513186*
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Feb 6, 2023 at 8:23 PM ritul guru <ritul.bits@gmail.com> wrote:
>>>
>>> thanks,
>>>
>>>
>>>
>>> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>>>
>>> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
>>> ShimLayer.elf
>>>
>>> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>>>
>>> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
>>> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>>>
>>>
>>>
>>> with above commands, we can inject shim.elf and uefipayload.elf into
>>> coreboot image, and should be able to boot from this payload?
>>>
>>>
>>>
>>>
>>>
>>> *Thanks & Regards Ritul Guru +91-9916513186*
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Feb 6, 2023 at 7:56 PM Guo, Gua <gua.guo@intel.com> wrote:
>>>
>>> I think you can run “. edksetup.sh” in your local and WORKSPACE will be
>>> setup automatically.
>>>
>>>
>>>
>>> *From:* ritul guru <ritul.bits@gmail.com>
>>> *Sent:* Monday, February 6, 2023 10:22 PM
>>> *To:* Guo, Gua <gua.guo@intel.com>
>>> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
>>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode
>>> in linux
>>>
>>>
>>>
>>> workspace needs to be set to any value?
>>>
>>>
>>>
>>> 0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64
>>> -D CPU_TIMER_LIB_ENABLE=FALSE
>>> python_exe=
>>> Traceback (most recent call last):
>>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
>>>     main()
>>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
>>>     BuildUniversalPayload(args, MacroList)
>>>   File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in
>>> BuildUniversalPayload
>>>     BuildDir     = os.path.join(os.environ['WORKSPACE'],
>>> os.path.normpath("Build/UefiPayloadPkgX64"))
>>>   File "/usr/lib/python3.8/os.py", line 675, in __getitem__
>>>     raise KeyError(key) from None
>>> KeyError: 'WORKSPACE'
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *Thanks & Regards Ritul Guru +91-9916513186*
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com> wrote:
>>>
>>> UniversalPayload.sh have Clang tool chain dependency.
>>>
>>>
>>>
>>> I assume your machine is ubuntu-20.10, please download it. And set use
>>> export PATH=$PATH:<Clang bin path> to prevent the issue.
>>>
>>>
>>>
>>>
>>> https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Gua
>>>
>>>
>>>
>>> *From:* ritul guru <ritul.bits@gmail.com>
>>> *Sent:* Monday, February 6, 2023 7:37 PM
>>> *To:* Guo, Gua <gua.guo@intel.com>
>>> *Cc:* devel@edk2.groups.io; Mike Maslenkin <mike.maslenkin@gmail.com>
>>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode
>>> in linux
>>>
>>>
>>>
>>> Thanks,
>>>
>>>
>>>
>>> 17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64
>>> -D CPU_TIMER_LIB_ENABLE=FALSE
>>> python_exe=/usr/bin/python3.8
>>> "llvm-objcopy" --version
>>> /bin/sh: 1: llvm-objcopy: not found
>>> - Failed - error happened when run command: "llvm-objcopy" --version
>>> - Failed - Please check if LLVM is installed or if CLANG_BIN is set
>>> correctly
>>> ✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]
>>>
>>>
>>>
>>>
>>>
>>> I am seeing above errors, is clang required for UniversalPayloadBuild.sh
>>> compilation?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *Thanks & Regards Ritul Guru +91-9916513186*
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com> wrote:
>>>
>>> I just quickly check your command, look like it incorrect UefiPayload
>>>
>>>
>>>
>>> For Uefi Payload
>>>
>>>    - build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a
>>>    IA32 -a X64 -D BOOTLOADER=COREBOOT
>>>
>>>
>>>
>>> For Uefi Universal Payload
>>>
>>>    - *Coreboot *
>>>
>>> git clone https://github.com/StarLabsLtd/coreboot.git Coreboot
>>>
>>> cd Coreboot
>>>
>>> git submodule update --init
>>>
>>> make iasl
>>>
>>> make crossgcc
>>>
>>> make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu
>>>
>>> make
>>>
>>>
>>>
>>>    - *Edk2*
>>>
>>> git clone https://github.com/tianocore/edk2.git Edk2
>>>
>>> cd Edk2
>>>
>>> git submodule update --init
>>>
>>> source ./edksetup.sh
>>>
>>> make -C ./BaseTools
>>>
>>> bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D
>>> CPU_TIMER_LIB_ENABLE=FALSE
>>>
>>>
>>>
>>>    - *ShimLayer*
>>>
>>> git clone
>>> https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer
>>> ShimLayer
>>>
>>> cd ShimLayer
>>>
>>> bash CorebootShimBuild.sh
>>>
>>>
>>>
>>>    - *Test Procedure*
>>>
>>>
>>>    1. Copy "ShimLayer/Build/ShimLayer.elf" and
>>>    "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.
>>>
>>> 2.    cd Coreboot/build
>>>
>>> 3.    Do the following commands.
>>>
>>> ./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload
>>>
>>> ./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f
>>> ShimLayer.elf
>>>
>>> ./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload
>>>
>>> ./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n
>>> img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma
>>>
>>> qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Gua
>>>
>>> *From:* devel@edk2.groups.io <devel@edk2.groups.io> *On Behalf Of *ritul
>>> guru
>>> *Sent:* Friday, February 3, 2023 11:08 PM
>>> *To:* Mike Maslenkin <mike.maslenkin@gmail.com>
>>> *Cc:* devel@edk2.groups.io
>>> *Subject:* Re: [edk2-devel] regarding build uefipayload in debug mode
>>> in linux
>>>
>>>
>>>
>>> Thanks,
>>>
>>>
>>>
>>> build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" *-b DEBUG* -t GCC5 -a IA32
>>> -a X64 -D COREBOOT
>>>
>>>
>>>
>>> I used above cmd, added DEBUG option by seeing NO debug messages coming
>>> from uefipayload.
>>>
>>> any idea how to enable debug messages coming from uefipayload built with
>>> above cmd?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *Thanks & Regards Ritul Guru +91-9916513186*
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com>
>>> wrote:
>>>
>>> Hi Ritul Guru.
>>>
>>> There is a misprint in path to dsc file.
>>> The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
>>> But there is another issue with your command line exists.
>>> The instructions you are referred to [1]  contain a sentence:
>>> "NOTE: Pure 32bit UEFI payload support could be added if required
>>> later.", i.e. it won't build.
>>> So, you need to build either pure X64 or X64 build with IA32 entry.
>>>
>>> The command line for the latter is:
>>> "build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"
>>>
>>> *[1]
>>> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55
>>>
>>> Regards,
>>> Mike.
>>>
>>>
>>>
>>> On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com> wrote:
>>> >
>>> >
>>> > Hi,
>>> > I was following below link to build UEfiPayload for coreboot to boot
>>> from,
>>> >
>>> >
>>> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>>> >
>>> > but getting below error,
>>> > would appreciate help, thanks.
>>> >
>>> >
>>> > ~/src/opensource/edk2 [master| ]
>>> > 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
>>> > Build environment:
>>> Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
>>> > Build start time: 03:04:57, Feb.03 2023
>>> >
>>> > WORKSPACE        = /home//src/opensource/edk2
>>> > EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
>>> > CONF_PATH        = /home//src/opensource/edk2/Conf
>>> > PYTHON_COMMAND   = /usr/bin/python3.8
>>> >
>>> >
>>> > build.py...
>>> >  : error C0DE: Unknown fatal error when processing
>>> [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>>> >
>>> > (Please send email to devel@edk2.groups.io for help, attaching
>>> following call stack trace!)
>>> >
>>> > (Python 3.8.10 on linux) Traceback (most recent call last):
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>>> line 2692, in Main
>>> >     MyBuild = Build(Target, Workspace, Option,LogQ)
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>>> line 815, in __init__
>>> >     self.InitPreBuild()
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>>> line 1015, in InitPreBuild
>>> >     self.LoadConfiguration()
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>>> line 971, in LoadConfiguration
>>> >     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
>>> line 905, in GetToolChainAndFamilyFromDsc
>>> >     dscobj = self.BuildDatabase[File, BuildArch]
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
>>> line 104, in __getitem__
>>> >     BuildObject = self.CreateBuildObject(FilePath, Arch, Target,
>>> Toolchain)
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py",
>>> line 120, in CreateBuildObject
>>> >     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
>>> line 426, in __new__
>>> >     reval = Class._FILE_TABLE_[FileType](*Args)
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
>>> line 303, in __init__
>>> >     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC,
>>> Temporary, FromItem)
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py",
>>> line 39, in __init__
>>> >     MetaFile.TimeStamp,
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line
>>> 1539, in TimeStamp
>>> >     return os.stat(self.Path)[8]
>>> >   File
>>> "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py",
>>> line 51, in stat
>>> >     return os.stat(LongFilePath(path))
>>> > FileNotFoundError: [Errno 2] No such file or directory:
>>> '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > Thanks & Regards
>>> > Ritul Guru
>>> > +91-9916513186
>>>
>>> 
>>>
>>>

[-- Attachment #2: Type: text/html, Size: 38098 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] regarding build uefipayload in debug mode in linux
  2023-02-06 15:12                 ` ritul guru
  2023-02-06 15:13                   ` Guo, Gua
@ 2023-02-06 23:08                   ` Guo, Gua
  1 sibling, 0 replies; 16+ messages in thread
From: Guo, Gua @ 2023-02-06 23:08 UTC (permalink / raw)
  To: ritul guru; +Cc: devel@edk2.groups.io, Mike Maslenkin

[-- Attachment #1: Type: text/plain, Size: 15488 bytes --]

Try to install lld in your machine.
https://www.howtoinstall.me/ubuntu/18-04/lld/
________________________________
From: ritul guru <ritul.bits@gmail.com>
Sent: Monday, February 6, 2023 11:12:08 PM
To: Guo, Gua <gua.guo@intel.com>
Cc: devel@edk2.groups.io <devel@edk2.groups.io>; Mike Maslenkin <mike.maslenkin@gmail.com>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux

getting below error:

build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
Build environment: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
Build start time: 20:37:47, Feb.06 2023

WORKSPACE        = /home/a/src/opensource/edk2
EDK_TOOLS_PATH   = /home/a/src/opensource/edk2/BaseTools
CONF_PATH        = /home/a/src/opensource/edk2/Conf
PYTHON_COMMAND   = /usr/bin/python3.8


Processing meta-data .
Architecture(s)  = IA32 X64
Build target     = DEBUG
Toolchain        = CLANGDWARF

Active Platform          = /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadPkg.dsc
Active Module            = /home/a/src/opensource/edk2/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
.build: : warning: The PCD was not specified by any INF module in the platform for the given architecture.
PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister]
Platform: [UefiPayloadPkg.dsc]
Arch: ['IA32']
build: : warning: The PCD was not specified by any INF module in the platform for the given architecture.
PCD: [gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister]
Platform: [UefiPayloadPkg.dsc]
Arch: ['IA32']
done!
Generating code . done!
Generating makefile . done!
Building ... /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf [IA32]
"clang"  -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=BaseUefiCpuLibStrings -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-unaligned-access -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -m32 -Oz -flto -march=i586 -target i686-pc-linux-gnu -g -malign-double -D DISABLE_NEW_DEPRECATED_INTERFACES -c -o /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/./BaseUefiCpuLib.obj -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32 -I/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib -I/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/DEBUG -I/home/a/src/opensource/edk2/MdePkg -I/home/a/src/opensource/edk2/MdePkg/Include -I/home/a/src/opensource/edk2/MdePkg/Test/UnitTest/Include -I/home/a/src/opensource/edk2/MdePkg/Include/Ia32 -I/home/a/src/opensource/edk2/UefiCpuPkg -I/home/a/src/opensource/edk2/UefiCpuPkg/Include /home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
/bin/sh: 1: clang: not found
make: *** [GNUmakefile:344: /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib/OUTPUT/BaseUefiCpuLib.obj] Error 127


build.py...
: error 7000: Failed to execute command
make tbuild [/home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/DEBUG_CLANGDWARF/IA32/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib]


build.py...
: error F002: Failed to build module
/home/a/src/opensource/edk2/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf [IA32, CLANGDWARF, DEBUG]

- Failed -
Build end time: 20:37:54, Feb.06 2023
Build total time: 00:00:07

- Failed - error happened when run command: build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE
Traceback (most recent call last):
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
    main()
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
    BuildUniversalPayload(args, MacroList)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 108, in BuildUniversalPayload
    RunCommand(BuildModule)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 51, in RunCommand
    raise Exception("ERROR: when run command: %s"%cmd)
Exception: ERROR: when run command: build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -a IA32 -a X64 -m UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf -t CLANGDWARF -y /home/a/src/opensource/edk2/Build/UefiPayloadPkgX64/UefiUniversalPayloadEntry.txt  -D UNIVERSAL_PAYLOAD=TRUE -D CPU_TIMER_LIB_ENABLE=FALSE


Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 8:23 PM ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>> wrote:
thanks,


./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload

./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f ShimLayer.elf

./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload

./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma


with above commands, we can inject shim.elf and uefipayload.elf into coreboot image, and should be able to boot from this payload?

Thanks & Regards
Ritul Guru
+91-9916513186


On Mon, Feb 6, 2023 at 7:56 PM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:

I think you can run “. edksetup.sh” in your local and WORKSPACE will be setup automatically.



From: ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>>
Sent: Monday, February 6, 2023 10:22 PM
To: Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux



workspace needs to be set to any value?



0 $ bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D CPU_TIMER_LIB_ENABLE=FALSE
python_exe=
Traceback (most recent call last):
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 172, in <module>
    main()
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 168, in main
    BuildUniversalPayload(args, MacroList)
  File "UefiPayloadPkg/UniversalPayloadBuild.py", line 58, in BuildUniversalPayload
    BuildDir     = os.path.join(os.environ['WORKSPACE'], os.path.normpath("Build/UefiPayloadPkgX64"))
  File "/usr/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'WORKSPACE'





Thanks & Regards
Ritul Guru
+91-9916513186





On Mon, Feb 6, 2023 at 5:17 PM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:

UniversalPayload.sh have Clang tool chain dependency.



I assume your machine is ubuntu-20.10, please download it. And set use export PATH=$PATH:<Clang bin path> to prevent the issue.



https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz



Thanks,

Gua



From: ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>>
Sent: Monday, February 6, 2023 7:37 PM
To: Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux



Thanks,



17:05 $ ./UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -a X64 -D CPU_TIMER_LIB_ENABLE=FALSE
python_exe=/usr/bin/python3.8
"llvm-objcopy" --version
/bin/sh: 1: llvm-objcopy: not found
- Failed - error happened when run command: "llvm-objcopy" --version
- Failed - Please check if LLVM is installed or if CLANG_BIN is set correctly
✘-1 ~/src/opensource/edk2 [master ↓·22|✚ 1]





I am seeing above errors, is clang required for UniversalPayloadBuild.sh compilation?







Thanks & Regards
Ritul Guru
+91-9916513186





On Mon, Feb 6, 2023 at 6:23 AM Guo, Gua <gua.guo@intel.com<mailto:gua.guo@intel.com>> wrote:

I just quickly check your command, look like it incorrect UefiPayload



For Uefi Payload

  *   build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D BOOTLOADER=COREBOOT



For Uefi Universal Payload

  *   Coreboot

git clone https://github.com/StarLabsLtd/coreboot.git Coreboot

cd Coreboot

git submodule update --init

make iasl

make crossgcc

make defconfig KBUILD_DEFCONFIG=config.starlabs_qemu

make



  *   Edk2

git clone https://github.com/tianocore/edk2.git Edk2

cd Edk2

git submodule update --init

source ./edksetup.sh

make -C ./BaseTools

bash UefiPayloadPkg/UniversalPayloadBuild.sh -t GCC5 -a IA32 -D CPU_TIMER_LIB_ENABLE=FALSE



  *   ShimLayer

git clone https://github.com/UniversalScalableFirmware/upl.coreboot.shimlayer  ShimLayer

cd ShimLayer

bash CorebootShimBuild.sh



  *   Test Procedure

  1.  Copy "ShimLayer/Build/ShimLayer.elf" and "Edk2/Build/UefiPayloadPkgX64/UniversalPayload.elf" to “Coreboot/build”.

2.    cd Coreboot/build

3.    Do the following commands.

./cbfstool coreboot.rom remove -r COREBOOT -n fallback/payload

./cbfstool coreboot.rom add-payload -r COREBOOT -n fallback/payload -f ShimLayer.elf

./cbfstool coreboot.rom remove -r COREBOOT -n img/UniversalPayload

./cbfstool coreboot.rom add-flat-binary -r COREBOOT -n img/UniversalPayload -f UniversalPayload.elf -l 0x200000 -e 0x100 -c lzma

qemu-system-x86_64 -bios coreboot.rom -serial stdio -M q35



Thanks,

Gua

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of ritul guru
Sent: Friday, February 3, 2023 11:08 PM
To: Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] regarding build uefipayload in debug mode in linux



Thanks,



build -p "UefiPayloadPkg/UefiPayloadPkg.dsc" -b DEBUG -t GCC5 -a IA32 -a X64 -D COREBOOT



I used above cmd, added DEBUG option by seeing NO debug messages coming from uefipayload.

any idea how to enable debug messages coming from uefipayload built with above cmd?









Thanks & Regards
Ritul Guru
+91-9916513186





On Fri, Feb 3, 2023 at 4:46 AM Mike Maslenkin <mike.maslenkin@gmail.com<mailto:mike.maslenkin@gmail.com>> wrote:

Hi Ritul Guru.

There is a misprint in path to dsc file.
The path should be "UefiPayloadPkg/UefiPayloadPkg.dsc"
But there is another issue with your command line exists.
The instructions you are referred to [1]  contain a sentence:
"NOTE: Pure 32bit UEFI payload support could be added if required
later.", i.e. it won't build.
So, you need to build either pure X64 or X64 build with IA32 entry.

The command line for the latter is:
"build -p UefiPayloadPkg/UefiPayloadPkg.dsc -t GCC5 -a IA32 -a X64"

*[1] https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt#L55

Regards,
Mike.



On Fri, Feb 3, 2023 at 1:37 AM ritul guru <ritul.bits@gmail.com<mailto:ritul.bits@gmail.com>> wrote:
>
>
> Hi,
> I was following below link to build UEfiPayload for coreboot to boot from,
>
> https://github.com/tianocore/edk2/blob/master/UefiPayloadPkg/BuildAndIntegrationInstructions.txt
>
> but getting below error,
> would appreciate help, thanks.
>
>
> ~/src/opensource/edk2 [master| ]
> 03:04 $ build -p UefiPayloadPkg\UefiPayloadPkg.dsc -t GCC5 -a IA32
> Build environment: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.29
> Build start time: 03:04:57, Feb.03 2023
>
> WORKSPACE        = /home//src/opensource/edk2
> EDK_TOOLS_PATH   = /home//src/opensource/edk2/BaseTools
> CONF_PATH        = /home//src/opensource/edk2/Conf
> PYTHON_COMMAND   = /usr/bin/python3.8
>
>
> build.py...
>  : error C0DE: Unknown fatal error when processing [/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc]
>
> (Please send email to devel@edk2.groups.io<mailto:devel@edk2.groups.io> for help, attaching following call stack trace!)
>
> (Python 3.8.10 on linux) Traceback (most recent call last):
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2692, in Main
>     MyBuild = Build(Target, Workspace, Option,LogQ)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 815, in __init__
>     self.InitPreBuild()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1015, in InitPreBuild
>     self.LoadConfiguration()
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 971, in LoadConfiguration
>     self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
>   File "/home//src/opensource/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 905, in GetToolChainAndFamilyFromDsc
>     dscobj = self.BuildDatabase[File, BuildArch]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 104, in __getitem__
>     BuildObject = self.CreateBuildObject(FilePath, Arch, Target, Toolchain)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py", line 120, in CreateBuildObject
>     MetaFileStorage(self.WorkspaceDb, FilePath, FileType)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 426, in __new__
>     reval = Class._FILE_TABLE_[FileType](*Args)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 303, in __init__
>     MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary, FromItem)
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Workspace/MetaFileTable.py", line 39, in __init__
>     MetaFile.TimeStamp,
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/Misc.py", line 1539, in TimeStamp
>     return os.stat(self.Path)[8]
>   File "/home//src/opensource/edk2/BaseTools/Source/Python/Common/LongFilePathOs.py", line 51, in stat
>     return os.stat(LongFilePath(path))
> FileNotFoundError: [Errno 2] No such file or directory: '/home//src/opensource/edk2/UefiPayloadPkgUefiPayloadPkg.dsc'
>
>
>
>
>
> Thanks & Regards
> Ritul Guru
> +91-9916513186



[-- Attachment #2: Type: text/html, Size: 31482 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-02-06 23:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-02 21:39 regarding build uefipayload in debug mode in linux ritul guru
2023-02-02 23:16 ` [edk2-devel] " Mike Maslenkin
2023-02-03 15:07   ` ritul guru
2023-02-06  0:53     ` Guo, Gua
2023-02-06 11:37       ` ritul guru
2023-02-06 11:47         ` Guo, Gua
2023-02-06 14:21           ` ritul guru
2023-02-06 14:26             ` Guo, Gua
2023-02-06 14:53               ` ritul guru
2023-02-06 14:55                 ` Guo, Gua
2023-02-06 15:12                 ` ritul guru
2023-02-06 15:13                   ` Guo, Gua
2023-02-06 16:51                     ` ritul guru
2023-02-06 17:52                       ` ritul guru
2023-02-06 18:02                         ` ritul guru
2023-02-06 23:08                   ` Guo, Gua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox