[edk2-devel] UefiPayloadPkg build error

King Sumo posted 1 patch 2 years, 7 months ago
Failed in applying to current master (apply log)
[edk2-devel] UefiPayloadPkg build error
Posted by King Sumo 2 years, 7 months ago
Hi,

The following commit broke the UefiPayloadPkg build:

commit d63595c3c91624f258f291adee329724edeac12e (HEAD)
Author: Zhiguang Liu <zhiguang.liu@intel.com>
Date:   Sun Apr 25 15:50:46 2021 +0800


    UefiPayloadPkg: Update the function definition of HobConstructor


Environment: GCC5 / openSUSE 15.x
 build -a IA32 -a X64 -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -t GCC5
-D BOOTLOADER=COREBOOT

Build log:
/home/lxuser/edk2/edk2-orig/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c:80:30:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
   Hob->EfiMemoryTop        = (EFI_PHYSICAL_ADDRESS) EfiMemoryTop;
                              ^
/home/lxuser/edk2/edk2-orig/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c:81:30:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
   Hob->EfiMemoryBottom     = (EFI_PHYSICAL_ADDRESS) EfiMemoryBottom;
                              ^
/home/lxuser/edk2/edk2-orig/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c:82:30:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
   Hob->EfiFreeMemoryTop    = (EFI_PHYSICAL_ADDRESS) EfiFreeMemoryTop;
                              ^



The below patch fixes the build, however I'm not sure if this is the best
way to solve the issue - or if there are any side effects:

diff --git a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
index 768c3db770..53ee1440f5 100644
--- a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
+++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
@@ -77,9 +77,9 @@ HobConstructor (
   Hob->Version             = EFI_HOB_HANDOFF_TABLE_VERSION;
   Hob->BootMode            = BOOT_WITH_FULL_CONFIGURATION;

-  Hob->EfiMemoryTop        = (EFI_PHYSICAL_ADDRESS) EfiMemoryTop;
-  Hob->EfiMemoryBottom     = (EFI_PHYSICAL_ADDRESS) EfiMemoryBottom;
-  Hob->EfiFreeMemoryTop    = (EFI_PHYSICAL_ADDRESS) EfiFreeMemoryTop;
+  Hob->EfiMemoryTop        = (EFI_PHYSICAL_ADDRESS) (UINTN)EfiMemoryTop;
+  Hob->EfiMemoryBottom     = (EFI_PHYSICAL_ADDRESS) (UINTN)EfiMemoryBottom;
+  Hob->EfiFreeMemoryTop    = (EFI_PHYSICAL_ADDRESS)
(UINTN)EfiFreeMemoryTop;
   Hob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) (HobEnd+1);
   Hob->EfiEndOfHobList     = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;

Thanks,
Sumo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79728): https://edk2.groups.io/g/devel/message/79728
Mute This Topic: https://groups.io/mt/85088671/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] UefiPayloadPkg build error
Posted by King Sumo 2 years, 7 months ago
I have filed a bug report:
https://bugzilla.tianocore.org/show_bug.cgi?id=3586


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79775): https://edk2.groups.io/g/devel/message/79775
Mute This Topic: https://groups.io/mt/85088671/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] UefiPayloadPkg build error
Posted by Guo Dong 2 years, 7 months ago

Reviewed-by: Guo Dong <guo.dong@intel.com<mailto:guo.dong@intel.com>>


From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of King Sumo
Sent: Monday, August 23, 2021 8:54 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] UefiPayloadPkg build error

Hi,

The following commit broke the UefiPayloadPkg build:
commit d63595c3c91624f258f291adee329724edeac12e (HEAD)
Author: Zhiguang Liu <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>
Date:   Sun Apr 25 15:50:46 2021 +0800

    UefiPayloadPkg: Update the function definition of HobConstructor

Environment: GCC5 / openSUSE 15.x
 build -a IA32 -a X64 -p UefiPayloadPkg/UefiPayloadPkg.dsc -b DEBUG -t GCC5 -D BOOTLOADER=COREBOOT
Build log:
/home/lxuser/edk2/edk2-orig/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c:80:30: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
   Hob->EfiMemoryTop        = (EFI_PHYSICAL_ADDRESS) EfiMemoryTop;
                              ^
/home/lxuser/edk2/edk2-orig/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c:81:30: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
   Hob->EfiMemoryBottom     = (EFI_PHYSICAL_ADDRESS) EfiMemoryBottom;
                              ^
/home/lxuser/edk2/edk2-orig/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c:82:30: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
   Hob->EfiFreeMemoryTop    = (EFI_PHYSICAL_ADDRESS) EfiFreeMemoryTop;
                              ^


The below patch fixes the build, however I'm not sure if this is the best way to solve the issue - or if there are any side effects:

diff --git a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
index 768c3db770..53ee1440f5 100644
--- a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
+++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
@@ -77,9 +77,9 @@ HobConstructor (
   Hob->Version             = EFI_HOB_HANDOFF_TABLE_VERSION;
   Hob->BootMode            = BOOT_WITH_FULL_CONFIGURATION;

-  Hob->EfiMemoryTop        = (EFI_PHYSICAL_ADDRESS) EfiMemoryTop;
-  Hob->EfiMemoryBottom     = (EFI_PHYSICAL_ADDRESS) EfiMemoryBottom;
-  Hob->EfiFreeMemoryTop    = (EFI_PHYSICAL_ADDRESS) EfiFreeMemoryTop;
+  Hob->EfiMemoryTop        = (EFI_PHYSICAL_ADDRESS) (UINTN)EfiMemoryTop;
+  Hob->EfiMemoryBottom     = (EFI_PHYSICAL_ADDRESS) (UINTN)EfiMemoryBottom;
+  Hob->EfiFreeMemoryTop    = (EFI_PHYSICAL_ADDRESS) (UINTN)EfiFreeMemoryTop;
   Hob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) (HobEnd+1);
   Hob->EfiEndOfHobList     = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;

Thanks,
Sumo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79814): https://edk2.groups.io/g/devel/message/79814
Mute This Topic: https://groups.io/mt/85088671/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-