tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kernel goes dark on boot



On Wed, Apr 05, 2023 at 08:16:13AM +0000, Emmanuel Dreyfus wrote:
> Inspecting EFI memory map, I now understand why: the kernel
> is too big to fit in the coventional memory mapping where
> bootstrap code attempts to copy it.

In bootstrap, memmap says (a few leading zeros removed
for the sake of clarity, all values are in haxadecimal)

Type                 Start       End      Attributes
(...)
Conventional memory  00100000   00ffffff  0000000f
Loader code          01000000   01021fff  0000000f
Conventional memory  01022000   53dfcfff  0000000f

Kernel is supposed to load at 00200000. Its size is 1b34820
and that makes it overflow on loader code.

I tried patching sys/arch/i386/stand/efiboot/bootx64/efibootx64.c
to add 2000000 to efi_kernel_start and entry so that we load
after the offending loader code. The boostrap loads and start
the kernel, I hear the beep added at kernel start in locore.S
But it crashes later.

Another try: With plain unpatched bootx64.efi, I tried moving the 
kernel to 02200000 instead of 00200000 by the patch below. It boots. 
At least I have a workaround, but now I wonder what is the right fix.

Index: sys/arch/amd64/conf/Makefile.amd64
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/conf/Makefile.amd64,v
retrieving revision 1.86
diff -r1.86 Makefile.amd64
103c103
< TEXTADDR?=    0xffffffff80200000
---
> TEXTADDR?=    0xffffffff82200000
Index: sys/arch/amd64/include/param.h
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/include/param.h,v
retrieving revision 1.38
diff -r1.38 param.h
59c59
< #define       KERNTEXTOFF     0xffffffff80200000 /* start of kernel text */
---
> #define       KERNTEXTOFF     0xffffffff82200000 /* start of kernel text */
63c63
< #define KERNTEXTOFF_LO        0x80200000
---
> #define KERNTEXTOFF_LO        0x82200000



-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index