From 4e86394e3de1ca75313fa0b61d9e1069ef020aba Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 9 Jan 2022 17:55:49 +0100 Subject: [PATCH] Fix the kernel having an .init section linked at a high address. The .init section for global constructors in the kernel is unused at the moment as the _init function is never invoked, but its existence means it got linked at 128 MiB on i686. This address isn't mapped by the kernel and the bootloader requires the machine to have that much physical memory. Unfortunately that meant the i686 build didn't work on machines with less than 129 MiB of memory. --- kernel/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 69374bbb..0e3daa4d 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -167,8 +167,12 @@ $(OBJS) \ $(CRTN_OBJ) \ end.o -LINK_OBJECTS=\ -$(CRTI_OBJ) $(CRTBEGIN_OBJ) $(OBJS) $(LIBS) $(CRTN_OBJ) $(CRTEND_OBJ) end.o +# TODO: The .init section is linked at 128 MiB on i686 and at 4 MiB on x86_64 +# which increases the memory requirement (and isn't mapped) and the _init +# function isn't invoked yet in the kernel anyway. +#LINK_OBJECTS=\ +#$(CRTI_OBJ) $(CRTBEGIN_OBJ) $(OBJS) $(LIBS) $(CRTN_OBJ) $(CRTEND_OBJ) end.o +LINK_OBJECTS=$(OBJS) $(LIBS) end.o # Rules and recipes for building the kernel.