From: Semen Protsenko <semen.protsenko(a)linaro.org>
"efi" global data structure contains "runtime_version" field which must
be assigned in order to use it later in Runtime Services virtual calls
(virt_efi_* functions).
Before this patch "runtime_version" was unassigned (0), so each
Runtime Service virtual call that checks revision would fail.
Signed-off-by: Semen Protsenko <semen.protsenko(a)linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel(a)linaro.org>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Matt Fleming <matt.fleming(a)intel.com>
---
arch/arm64/kernel/efi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 865fdf5c7344..219a59f2ae97 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -455,6 +455,8 @@ static int __init arm64_enter_virtual_mode(void)
efi_native_runtime_setup();
set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
+ efi.runtime_version = efi.systab->hdr.revision;
+
return 0;
err_unmap:
--
1.8.3.2
Hi Olivier,
Not sure.
What is your build environment?
And what did you do to be able to build BaseTools?
/
Leif
---------- Forwarded message ----------
From: Olivier Brunel <Olivier.Brunel(a)synopsys.com>
Date: 17 October 2014 17:11
Subject: RE: Building UEFI (14.09)
To: Leif Lindholm <leif.lindholm(a)linaro.org>
Hi,
Well OK now I manage to build using this command:
make -C BaseTools
Now the problem I have is that it cannot compile Tests. This directory
is added to SUBDIRS in GNUmakefile under BaseTools and I can't compile
it.
I am using the tag 'linaro-edk2-2014.09'.
I have traces like:
FAIL: test_build_build (CheckPythonSyntax.Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/uefi-image-linaro-edk2-2014.09/BaseTools/Tests/CheckPythonSyntax.py",
line 55, in <lambda>
newmethod = lambda self: self.SingleFileTest(filename)
File "/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/uefi-image-linaro-edk2-2014.09/BaseTools/Tests/CheckPythonSyntax.py",
line 33, in SingleFileTest
self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
AssertionError: syntax error:
/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/uefi-image-linaro-edk2-2014.09/BaseTools/Source/Python/build/build.py,
Error is File
"/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/uefi-image-linaro-edk2-2014.09/BaseTools/Source/Python/build/build.py",
line 677
class PeImageInfo():
^
SyntaxError: invalid syntax
----------------------------------------------------------------------
Ran 247 tests in 0.950s
FAILED (failures=37)
make[1]: Leaving directory
`/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/uefi-image-linaro-edk2-2014.09/BaseTools/Tests'
make: Leaving directory
`/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/uefi-image-linaro-edk2-2014.09/BaseTools'
-build/uefi-image> build -a ARM -b DEBUG -t GCC48 -p
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA5s.dsc -D
EDK2_ARMVE_STANDALONE=1
File "/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/uefi-image-linaro-edk2-2014.09/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py",
line 677
class PeImageInfo():
^
SyntaxError: invalid syntax
Any idea where this could come from? I have made some research on the
internet but nothing maybe I miss something...
Thanks,
Olivier
-----Original Message-----
From: Leif Lindholm [mailto:leif.lindholm@linaro.org]
Sent: Thursday, October 16, 2014 5:11 PM
To: Olivier Brunel
Subject: Re: Building UEFI (14.09)
Hi Olivier,
Adding linaro-uefi list to cc. Comments inline.
On 16 October 2014 16:03, Olivier Brunel <Olivier.Brunel(a)synopsys.com> wrote:
> Hi there,
>
> I have been on this page:
>
> https://wiki.linaro.org/LEG/Engineering/Kernel/UEFI/build
>
> and tried to build the hard way UEFI:
>
> # Get Linaro UEFI sources from git.
>
> $ git clone git://git.linaro.org/uefi/linaro-edk2.git
>
> $ cd linaro-edk2
>
> $ git checkout master
>
> # Set up UEFI build environment.
>
> $. edksetup.sh
>
> $ make -C BaseTools
>
>
>
> When I try the last line of this $ make -C BaseTools I have the
> following
> trace:
>
> sh-3.2$ make -C BaseTools/
>
> make: Entering directory
> `/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/linaro-edk2/edk2-linaro-edk2-0.1+git26+20140926+9e6f69e/BaseTools'
>
> make -C Source/C
>
> Attempting to detect ARCH from 'uname -m': x86_64
>
> Detected ARCH of X64 using uname.
>
> make[1]: Entering directory
> `/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/linaro-edk2/edk2-linaro-edk2-0.1+git26+20140926+9e6f69e/BaseTools/Source/C'
>
> mkdir -p .
>
> make -C Common
>
> make[2]: Entering directory
> `/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/linaro-edk2/edk2-linaro-edk2-0.1+git26+20140926+9e6f69e/BaseTools/Source/C/Common'
>
> mkdir ../libs
>
> gcc -c -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror
> -Wno-deprecated-declarations -nostdlib -c -g -I .. -I
> ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I
> ../Common/ -I .. -I . -I ../Include/X64/ BasePeCoff.c -o BasePeCoff.o
>
> BasePeCoff.c: In function 'PeCoffLoaderGetPeHeader':
>
> BasePeCoff.c:149:49: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:149:12: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c: In function 'PeCoffLoaderImageAddress':
>
> BasePeCoff.c:581:10: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c: In function 'PeCoffLoaderRelocateImage':
>
> BasePeCoff.c:647:13: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:700:25: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:709:17: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:715:51: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:715:20: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:729:19: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:736:30: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:737:30: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:775:35: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:775:35: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:775:35: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c: In function 'PeCoffLoaderLoadImage':
>
> BasePeCoff.c:942:29: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:945:13: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:950:20: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:963:29: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:966:25: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:968:20: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1006:26: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1006:15: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1007:26: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1007:15: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1063:51: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1121:20: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1144:36: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c: In function 'PeCoffLoaderGetPdbPointer':
>
> BasePeCoff.c:1264:43: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1264:16: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1285:60: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1285:24: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1355:24: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1354:24: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1385:37: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1384:36: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c: In function 'PeCoffLoaderGetEntryPoint':
>
> BasePeCoff.c:1433:43: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1433:16: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1446:20: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1447:28: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1447:19: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1450:19: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1452:22: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1454:22: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> BasePeCoff.c:1456:35: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1456:56: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>
> BasePeCoff.c:1456:19: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>
> cc1: all warnings being treated as errors
>
> make[2]: *** [BasePeCoff.o] Error 1
>
> make[2]: Leaving directory
> `/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/linaro-edk2/edk2-linaro-edk2-0.1+git26+20140926+9e6f69e/BaseTools/Source/C/Common'
>
> make[1]: *** [Common] Error 2
>
> make[1]: Leaving directory
> `/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/linaro-edk2/edk2-linaro-edk2-0.1+git26+20140926+9e6f69e/BaseTools/Source/C'
>
> make: *** [Source/C] Error 2
>
> make: Leaving directory
> `/localdev/obrunel/obrunel_armvdk_stormcs315/j-liv-arm-base/software/Vanilla-Cortex-Test/linaro-edk2/edk2-linaro-edk2-0.1+git26+20140926+9e6f69e/BaseTools'
>
>
>
> I have noticed that you have edited the document last, can you tell me
> if you have had this kind of error as well?
So, I think I might have seen this at some point, but I'm not getting it now.
Could your gcc be defaulting to 32-bit or something?
/
Leif
This multiboot support will be built in linux module for aarch64,
and can not be used alone.
- the implementation for Xen is following <Multiboot on ARM Specification>:
http://wiki.xen.org/wiki/Xen_ARM_with_Virtualization_Extensions/Multiboot
and xen/docs/misc/arm/device-tree/booting.txt in Xen source code.
- Add multiboot command for loading multiboot kernel image.
Usage: multiboot <the path of kernel image file> [cmdline]
- Add module command for loading multiboot module.
Usage: module [option] <the path of module file> [cmdline]
The [option] for Xen is [--type <compatible stream in FDT>].
For now, the <compatible stream in FDT> could be :
"multiboot,kernel", "multiboot,ramdisk", "multiboot,module",
"xen,xsm-policy" or the custom compatible stream
- Only support stub-kernel for arm64:
support stub-kernel detection and alignment info detection
- The reason of adding this functionality to the existing "linux" module
rather than "multiboot(2)"
(1)multiboot is x86 only
(2)Multiboot is added to "linux" module because it reuses existing code.
- Some changes in original linux module code
Move some #define from grub-core/loader/arm64/linux.c to include/grub/arm64/linux.h
Reason: (1)make code more orderly
(2)these #define can be used by other files which includs include/grub/arm64/linux.h
Export some accessor functions of dtb and the "loaded" flag for sharing code to multiboot.c
Signed-off-by: Fu Wei <fu.wei(a)linaro.org>
Hi Leif,
I have made a new multiboot support patch V3.7, because Roy has updated the stub-xen support.
Compared with V3.6, I added the stub-kernel boot support:
provide device_handle data in loaded_image
provide file_path data in loaded_image(Do we need to provide it?)
*Please review this patch and provide some advice or suggestion. If it is fine for you, I will make a serial patch for upstream.*
Some pending changes:
(1)delete "grub_arm64_disable_caches_mmu" and the relevant code(misc.c and misc_irq.S)(If we don't want to support raw kernel anymore)
(2)grub coding style (I have checked the patch, but maybe I need to improve it in somewhere)
(3)integrate multiboot_fdt.c back to multiboot.c (will make a new patch/branch for it, but I think multiboot_fdt.c make multiboot.c more generic)
Notice: This patch bases on master branch of upstream grub
This patch can works with:
(1)Roy's repo(https://git.linaro.org/people/roy.franz/xen.git) tag: rfranz/efi-stub-v3 or his prebuild binary(http://people.linaro.org/~roy.franz/lava/xen/xen)
(2)master branch of upstream xen.(non-stub)
--
Best regards,
Fu Wei
Enterprise Server Engineer From Red Hat
LEG Team
Linaro.org | Open source software for ARM SoCs
Ph: +86 186 2020 4684 (mobile)
IRC: fuwei
Skype: tekkamanninja
Room 1512, Regus One Corporate Avenue,Level 15,
One Corporate Avenue,222 Hubin Road,Huangpu District,
Shanghai,China 200021
This patch series adds EFI boot support for arm64. A PE/COFF header is created
in head.S, as there is no toolchain support for PE/COFF on arm64. This also
has the advantage that the file is both an "Image" file and a PE/COFF
executable - the same binary can be loaded and run either way. The EFI 'stub'
code is a shim layer that serves as the loader for the XEN kernel in the EFI
environment. The stub loads the dom0 kernel and initrd if required, and adds
entries for them as well as for the EFI data structures into the device tree
passed to XEN. Once the device tree is constructed, EFI boot services are
exited, and the stub transfers control to the normal XEN entry point. The only
indication XEN has that it was loaded via the stub is that the device tree
contains EFI properties. This is all very similar to the arm/arm64 Linux
kernel EFI stubs.
I'm not really that happy with how the x86 build works, in particular the rule
I added to arch/x86/Makefile to build boot.init.o to fix parallel builds. Due
to the way the EFI build is done - building 2 executables at the same time with
different EFI code included in each, the normal common build infrastructure
doesn't work.
Changes since v2:
* Major refactor to use common EFI entry point and factor out arch specific
code, rather than factoring out the common code.
* Update entire libfdt to v1.4.0 to provide fdt_create_empty_tree()
Changes since v1:
* Added common/efi directory for shared EFI code, and arch/arm/efi for
arm-specfic code. Global build hacking of -fshort-wchar removed.
arm32, arm64, and x86 with/without EFI enabled toolchain all build.
The x86 build previously autodetected whether the EFI version should
be built or not based on toolchain support. I couldn't get this working
nicely with the common code, so for x86 I have the common code always
build, and the EFI autodection works as normal for building the EFI
version.
* Basic use of the EFI memory map instead of FDT based memory description.
More work needed to resolve differences between FDT description of
a small number of large memory banks with reserved regions, and EFI's
potentially long list of available regions, which can be long.
* More refactoring of common EFI code to not directly exit using blexit(),
as this broke the pre-linking targets. All shared code returns status,
and it is up to the caller to exit and clean up.
* Reduced the number of patches. Refactoring of x86 code first, then moving
all code to efi-shared.c in one patch.
* Fixed formatting/tab issues in new files, added Emacs footer.
* Fixed efi_get_memory_map to return NULL map pointer on error in addition
to failed status.
* Added comments in head.S regarding PE/COFF specification, and 1:1
mapping used by EFI code.
* Updated device tree bindings to use new multiboot bindings. Since the stub
is always built into XEN, we don't have to support older bindings.
Roy Franz (15):
move EFI boot code to common/efi
Move x86 specific funtions/variables to arch header
create arch functions to get and process EFI memory map.
Add architecture functions for pre/post ExitBootServices
Add efi_arch_cfg_file() to handle arch specific cfg file fields
Add efi_arch_handle_cmdline() for processing commandline
Move x86 specific video and disk probing code
Add efi_arch_memory() for arch specific memory setup
Add arch specific module handling to read_file()
Add SMBIOS and runtime services setup arch functions.
Add several misc. arch functions for EFI boot code.
Add efi_arch_use_config_file() function to control use of config file
add arm64 cache flushing code from linux v3.16
Update libfdt to v1.4.0
Add ARM EFI boot support
.gitignore | 2 +
xen/arch/arm/arm64/Makefile | 1 +
xen/arch/arm/arm64/cache.S | 100 ++
xen/arch/arm/arm64/head.S | 145 ++-
xen/arch/arm/xen.lds.S | 1 +
xen/arch/x86/Makefile | 15 +-
xen/arch/x86/efi/Makefile | 4 +-
xen/arch/x86/efi/boot.c | 1723 -----------------------------------
xen/arch/x86/efi/efi.h | 39 -
xen/arch/x86/efi/runtime.c | 2 +-
xen/common/Makefile | 1 +
xen/common/efi/Makefile | 17 +
xen/common/efi/boot.c | 823 +++++++++++++++++
xen/common/efi/check.c | 4 +
xen/common/efi/dummy.c | 1 +
xen/common/efi/efi.h | 39 +
xen/common/libfdt/Makefile.libfdt | 4 +-
xen/common/libfdt/fdt.c | 30 +-
xen/common/libfdt/fdt_empty_tree.c | 84 ++
xen/common/libfdt/fdt_ro.c | 7 +-
xen/common/libfdt/fdt_rw.c | 31 +-
xen/common/libfdt/fdt_sw.c | 4 +-
xen/common/libfdt/fdt_wip.c | 2 +-
xen/common/libfdt/version.lds | 6 +
xen/include/asm-arm/arm64/efibind.h | 216 +++++
xen/include/asm-arm/efi-boot.h | 602 ++++++++++++
xen/include/asm-arm/efi.h | 29 +
xen/include/asm-arm/efibind.h | 2 +
xen/include/asm-arm/setup.h | 2 +-
xen/include/asm-x86/efi-boot.h | 1064 +++++++++++++++++++++
xen/include/asm-x86/efi.h | 39 +
xen/include/xen/libfdt/fdt.h | 93 +-
xen/include/xen/libfdt/libfdt.h | 315 ++++++-
xen/include/xen/libfdt/libfdt_env.h | 4 +
34 files changed, 3627 insertions(+), 1824 deletions(-)
create mode 100644 xen/arch/arm/arm64/cache.S
delete mode 100644 xen/arch/x86/efi/boot.c
delete mode 100644 xen/arch/x86/efi/efi.h
create mode 100644 xen/common/efi/Makefile
create mode 100644 xen/common/efi/boot.c
create mode 100644 xen/common/efi/check.c
create mode 100644 xen/common/efi/dummy.c
create mode 100644 xen/common/efi/efi.h
create mode 100644 xen/common/libfdt/fdt_empty_tree.c
create mode 100644 xen/include/asm-arm/arm64/efibind.h
create mode 100644 xen/include/asm-arm/efi-boot.h
create mode 100644 xen/include/asm-arm/efi.h
create mode 100644 xen/include/asm-arm/efibind.h
create mode 100644 xen/include/asm-x86/efi-boot.h
create mode 100644 xen/include/asm-x86/efi.h
--
2.1.0.rc1