Sunday, July 05, 2020

Re: snapshot boot fails with error "entry point at 0x1001000"

On Sat, Jul 04, 2020 at 11:09:54AM +0000, Michael Baehr wrote:
> Kastus Shchuka <openbsd@tprfct.net> wrote:
> "I installed 2020-07-03 snapshot on ASRock J4105M system and I am not able to boot it.
> Boot stops at the line
>
> entry point at 0x1001000
>
> If I try bsd.rd kernel, it boots just fine. After this failure with snapshot I 
> installed 6.7-release, and it boots without any issues."
>
>
> I've experienced something similar, including the sensitivity to kernel size. As best I can observe, the EFI bootloader is being handed a different block of RAM than where the kernel is actually loaded (which is at a fixed address defined in boot.c). Which block of memory gets returned, and whether boot fails, seems to be dependent on the particular UEFI ROM/chipset. In my case, debugging over serial, I observe a page fault while the kernel is still being loaded into RAM.
> "Are there any other solutions than compiling a custom smaller kernel?"
>
>
> Patching efiboot.c as follows and recompiling bootia32/bootx64 resolved it for me:
> --- a/sys/arch/amd64/stand/efiboot/efiboot.c
> +++ b/sys/arch/amd64/stand/efiboot/efiboot.c
> @@ -303,9 +303,9 @@ efi_memprobe(void)
> bios_memmap_t *bm;
> EFI_STATUS status;
> EFI_PHYSICAL_ADDRESS
> - addr = 0x10000000ULL; /* Below 256MB */
> + addr = 0x1000000;
>
> - status = EFI_CALL(BS->AllocatePages, AllocateMaxAddress, EfiLoaderData,
> + status = EFI_CALL(BS->AllocatePages, AllocateAddress, EfiLoaderData,
> EFI_SIZE_TO_PAGES(KERN_LOADSPACE_SIZE), &addr);
> if (status != EFI_SUCCESS)
> panic("BS->AllocatePages()");
> Let me know if that helps. I can't guarantee that this is actually what is causing your issue but it worked for me.

I tried this patch and was able to boot kernel from snapshot 2007-07-03 with recompiled BOOTX64.EFI.
It fixes the problem with EFI memory mapping on ASRock J4105M motherboard.

I wonder what would it take for the patch to be accepted in -current?

Thanks,

Kastus

No comments:

Post a Comment