Hi .
This may be an odd question, but has anyone tried successfully to build UEFI for ARM 32 bit on Juno ? When we attempted to do it this is what we tried without success, please let us know if there is a solution available:
First we switched the toolchain on the makefile like this
diff --git a/ArmPlatformPkg/ArmJunoPkg/Makefile b/ArmPlatformPkg/ArmJunoPkg/Makefile
index e07e71b..8a23d56 100755
--- a/ArmPlatformPkg/ArmJunoPkg/Makefile
+++ b/ArmPlatformPkg/ArmJunoPkg/Makefile
@@ -16,8 +16,8 @@
# - ARMLINUXGCC_TOOLS_PATH: for ARMLINUXGCC
EDK2_TOOLCHAIN ?= GCC49
-GCC49_AARCH64_PREFIX ?= aarch64-linux-gnu-
-EDK2_ARCH ?= AARCH64
+GCC49_ARM_PREFIX ?= arm-none-eabi-
+EDK2_ARCH ?= ARM
Using gcc-linaro-arm-none-eabi-4.9-2014.07_linux we get this error :
/home/mgarcia/bin/toolchain/gcc-linaro-arm-none-eabi-4.9-2014.07_linux/bin/arm-none-eabi-gcc" -I/home/mgarcia/workspace/juno/edk2/ArmPlatformPkg/ArmVExpressPkg/Include -I/home/mgarcia/workspace/juno/edk2/ArmPlatformPkg/ArmJunoPkg/Include -c -x assembler -imacros /home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/DEBUG/AutoGen.h -mlittle-endian -o /home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.obj -I/home/mgarcia/workspace/juno/edk2/ArmPkg/Library/ArmSmcLib/Arm -I/home/mgarcia/workspace/juno/edk2/ArmPkg/Library/ArmSmcLib -I/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/DEBUG -I/home/mgarcia/workspace/juno/edk2/MdePkg -I/home/mgarcia/workspace/juno/edk2/MdePkg/Include -I/home/mgarcia/workspace/juno/edk2/MdePkg/Include/Arm -I/home/mgarcia/workspace/juno/edk2/ArmPkg -I/home/mgarcia/workspace/juno/edk2/ArmPkg/Include /home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii: Assembler messages:
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:21: Error: attempt to use an ARM instruction on a Thumb-only processor -- `push {r4-r8}'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:23: Error: attempt to use an ARM instruction on a Thumb-only processor -- `push {r0}'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:26: Error: attempt to use an ARM instruction on a Thumb-only processor -- `ldr r7,[r0,#28]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:27: Error: attempt to use an ARM instruction on a Thumb-only processor -- `ldr r6,[r0,#24]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:28: Error: attempt to use an ARM instruction on a Thumb-only processor -- `ldr r5,[r0,#20]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:29: Error: attempt to use an ARM instruction on a Thumb-only processor -- `ldr r4,[r0,#16]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:30: Error: attempt to use an ARM instruction on a Thumb-only processor -- `ldr r3,[r0,#12]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:31: Error: attempt to use an ARM instruction on a Thumb-only processor -- `ldr r2,[r0,#8]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:32: Error: attempt to use an ARM instruction on a Thumb-only processor -- `ldr r1,[r0,#4]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:33: Error: attempt to use an ARM instruction on a Thumb-only processor -- `ldr r0,[r0,#0]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:35: Error: attempt to use an ARM instruction on a Thumb-only processor -- `smc #0'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:38: Error: attempt to use an ARM instruction on a Thumb-only processor -- `pop {r8}'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:42: Error: attempt to use an ARM instruction on a Thumb-only processor -- `str r3,[r8,#12]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:43: Error: attempt to use an ARM instruction on a Thumb-only processor -- `str r2,[r8,#8]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:44: Error: attempt to use an ARM instruction on a Thumb-only processor -- `str r1,[r8,#4]'
make[1]: Leaving directory `/media/drive2/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:45: Error: attempt to use an ARM instruction on a Thumb-only processor -- `str r0,[r8,#0]'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:47: Error: attempt to use an ARM instruction on a Thumb-only processor -- `mov r0,r8'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:50: Error: attempt to use an ARM instruction on a Thumb-only processor -- `pop {r4-r8}'
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.iii:52: Error: attempt to use an ARM instruction on a Thumb-only processor -- `bx lr'
make[1]: *** [/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPkg/Library/ArmSmcLib/ArmSmcLib/OUTPUT/Arm/ArmSmc.obj] Error 1
We "fixed" that error by switching to ArmSmcLibNull in the DSC file (for the time being, this is acceptable for us as our goal is only to get the image) . After doing it, compilation goes fine but looks like we get an error when generating the image:
"GenFw" -e UEFI_DRIVER -o /home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs/DEBUG/BootMonFs.efi /home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs/DEBUG/BootMonFs.dll
GenFw: ERROR 3000: Invalid
/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs/DEBUG/BootMonFs.dll bad symbol definition.
WriteSections (): /home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs/DEBUG/BootMonFs.dll unsupported ELF EM_ARM relocation 0x28.
Then again we did some hack on the Basetools like this :
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -701,6 +701,7 @@ WriteSections32 (
case R_ARM_TLS_GD32:
case R_ARM_TLS_LDM32:
case R_ARM_TLS_IE32:
+ case 0x28:
// Thease are all PC-relative relocations and don't require modification
// GCC does not seem to have the concept of a application that just needs to get relocated.
break;
@@ -829,6 +830,7 @@ WriteRelocations32 (
After which we get this error :
make[1]: *** [/home/mgarcia/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs/DEBUG/BootMonFs.efi] Error 2
make[1]: Leaving directory `/media/drive2/workspace/juno/edk2/Build/ArmJuno/DEBUG_GCC49/ARM/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs'
Full logs are attached.
Any pointers are greatly appreciated .