riscvarchive / riscv-edk2-platforms

Port of EDK2 implementation of UEFI to RISC-V. See documentation at:
https://github.com/riscv/riscv-uefi-edk2-docs
Other
18 stars 7 forks source link

U540 Platform UEFI building failed #10

Closed McKnight22 closed 3 years ago

McKnight22 commented 3 years ago

Hi,

When building U540 UEFI binary, I got the error as below. It seems the UiApp.offset file not created automatically in the building process, and it causes the building error. Could someone please help me on it? Thanks in advance!

Error log:

[root@fedora-riscv uefi]# file /usr/bin/riscv64-redhat-linux-gcc-9
/usr/bin/riscv64-redhat-linux-gcc-9: ELF 64-bit LSB executable, UCB RISC-V, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-riscv64-lp64d.so.1, BuildID[sha1]=c0c5533c1800f6fd3cc5bbe42d389ebe881e823b, for GNU/Linux 4.15.0, stripped
[root@fedora-riscv uefi]# 
[root@fedora-riscv uefi]# 
[root@fedora-riscv uefi]# /usr/bin/riscv64-redhat-linux-gcc-9 --version
riscv64-redhat-linux-gcc-9 (GCC) 9.2.1 20191120 (Red Hat 9.2.1-2)
[root@fedora-riscv uefi]# 
[root@fedora-riscv uefi]# build -a RISCV64 -t GCC5 -p Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
Build environment: Linux-5.5.0-0.rc5.git0.1.1.riscv64.fc32.riscv64-riscv64-with-glibc2.27
Build start time: 09:53:25, Oct.15 2020

WORKSPACE        = /root/uefi
PACKAGES_PATH    = /root/uefi/edk2:/root/uefi/edk2-platforms:/root/uefi/edk2-non-osi
EDK_TOOLS_PATH   = /root/uefi/edk2/BaseTools
CONF_PATH        = /root/uefi/edk2/Conf
PYTHON_COMMAND   = /usr/bin/python3.8

Processing meta-data .
Architecture(s)  = RISCV64
Build target     = DEBUG
Toolchain        = GCC5

Active Platform          = /root/uefi/edk2-platforms/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
...................................................................... done!
Building ... /root/uefi/edk2/NetworkPkg/Library/DxeDpcLib/DxeDpcLib.inf [RISCV64]
......
test -e /root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/UiApp.offset && GenSec -s EFI_SECTION_RAW -o /root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/UiAppOffset.raw /root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/UiApp.offset
Building ... /root/uefi/edk2-platforms/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Universal/Pei/PlatformPei/PlatformPei.inf [RISCV64]
make: [GNUmakefile:429:/root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/UiAppOffset.raw] Error 1 (Ignored)
GenFfs -t EFI_FV_FILETYPE_APPLICATION -g 462CAA21-7614-4503-836E-8AB6F4662331 -o /root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/462CAA21-7614-4503-836E-8AB6F4662331.ffs -oi /root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/462CAA21-7614-4503-836E-8AB6F4662331SEC1.1.pe32 -n 4K -oi /root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/UiAppOffset.raw -n 4K -oi /root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/462CAA21-7614-4503-836E-8AB6F4662331SEC2.ui -oi /root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/462CAA21-7614-4503-836E-8AB6F4662331SEC3.ver
......

Best Regards

McKnight22 commented 3 years ago

Further info: The UiApp.offset not created is due to the below command which should create UiApp.offset but not. Why?

Trim --Vfr-Uni-Offset -o /root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/UiApp.offset --ModuleName=UiApp --DebugDir=/root/uefi/Build/FreedomU540HiFiveUnleashed/DEBUG_GCC5/RISCV64/MdeModulePkg/Application/UiApp/UiApp/DEBUG

And one more thing: Before building, PcdSet64 and PcdSet32 in /root/uefi/edk2-platforms/Platform/SiFive/U5SeriesPkg/Universal/Dxe/RamFvbServicesRuntimeDxe/FwBlockService.c should be replaced with PcdSet64S and PcdSet32S since PcdSet64 and PcdSet32 are deprecated.

McKnight22 commented 3 years ago

The root cause is found! The UiApp.offset not created is due to cannot get variable offset via parsing UiApp.map. But why cannot get variable offset via parsing UiApp.map? It depends on whether the content in UiApp.map is correct or not. The logic can be found in the function GetVariableOffset of edk2/BaseTools/Source/Python/Common/Misc.py. For my case, the words "Archive member included" does not appears in the head of UiApp.map. Those words are writen in non-English in my UiApp.map file. So the offset variable can not be fetched. Why are those words writen in non-English? Please check your env variable $LANG via the command "echo $LANG".

The issue can be closed. It's my environment problem.

JohnAZoidberg commented 3 years ago

Hmm, that sounds like a general EDK2 problem. In what language are those words written? How did you fix it? The people on the official EDK2 development mailing list would probably be interested to hear about your case: devel@edk2.groups.io