[haiku-development] Re: haiku_loader.efi on arm!

  • From: "X512" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "danger_mail" for DMARC)
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 11 Mar 2020 00:49:13 +0900

On 2020/03/10 22:56, Alexander von Gluck IV wrote:

Good morning!

A bit of good news.  The EFI haiku_loader now compiles for arm and (attempts) 
to start.

Change:

build/jam/ArchitectureRules:
   HAIKU_KERNEL_PLATFORM ?= efi ;
   HAIKU_BOOT_TARGETS += efi ;

jam -q @minimum-mmc

Attempting to boot the haiku_loader.efi under qemu:

qemu-system-arm -M virt -m 1024 -bios /usr/share/edk2/arm/QEMU_EFI.fd -net none 
-drive
file=fat:rw:objects/haiku/arm/release/system/boot/efi/

fs0:
haiku_loader.efi



Results in:

FSOpen: Open '\haiku_loader.efi' Success
[Security] 3rd party image[0] can be loaded after EndOfDxe:
PciRoot(0x0)/Pci(0x1,0x0)/HD(1,MBR,0xBE1AFDFA,0x3F,0xFBFC1)/\haiku_loader.efi.
InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B BDA329A8
Loading driver at 0x000BC4B6000 EntryPoint=0x000BC4B6138
InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF BDA33890
ProtectUefiImageCommon - 0xBDA329A8
- 0x00000000BC4B6000 - 0x0000000000048A8C
!!!!!!!!  ProtectUefiImageCommon - Section Alignment(0x20) is incorrect  
!!!!!!!!
InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA BFA7BB2C
Data Abort Exception PC at 0xBC4B6D20  CPSR 0x60000013
Data Abort Exception PC at 0xBC4B6D20  CPSR 0x60000013 nZCveaift_svc
R0 0xBFA59F10   R1 0x000415C8   R2 0x0003A628   R3 0x00800080
R4 0xBFA59010   R5 0xBDA32D10   R6 0xBC4F0628   R7 0xBFA7BA90
R8 0xBDA32010   R9 0x00000000  R10 0xBC5560A8  R11 0xBFA7BB20
R12 0xBFA9BCC0   SP 0xBFA7BA68   LR 0xBC4B69A4   PC 0xBC4B6D20
DFSR 0x00000005 DFAR 0x008000AC IFSR 0x00000000 IFAR 0x00000000
Translation fault on Section: read from 0x008000AC
ASSERT [ArmCpuDxe]
/builddir/build/BUILD/edk2-edk2-stable201905/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultEx
eptionHandler.c(267): ((BOOLEAN)(0==1))



The Section Alignment(0x20) comes from:
https://git.haiku-os.org/haiku/tree/src/system/boot/platform/efi/arch/arm/crt0-efi-arm.S#n57

The error comes from the EFI bios here:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c#L468

The section alignment should be correct.  As I understand it, given the EDK2 
code, the memory
protection should remain disabled in our usage case?  The check of the Section 
Alignment in the
EDK2 code seems pretty simplistic.

  -- Alex

I tried to run ARM haiku_loader.efi on qemu-system-arm from HaikuPorts with http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-ARM/DEBUG_GCC5/QEMU_EFI.fd as EFI firmware image and I get:
Data Abort Exception PC at 0x78630D20  CPSR 0x60000013

I used following command:
qemu-system-arm -M virt -m 1024 -bios QEMU_EFI.fd -net none -device usb-ehci -device virtio-gpu-pci -device usb-kbd -device usb-tablet -drive file=disk.img

Other related posts: