1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:27:35 +00:00

Revert "Kernel/x86: Bake the Prekernel and the Kernel into one image"

Some hardware/software configurations crash KVM as soon as we try to
start Serenity. The exact cause is currently unknown, so just fully
revert it for now.

This reverts commit 897c4e5145.
This commit is contained in:
Tim Schumacher 2023-04-28 17:27:24 +02:00 committed by Jelle Raaijmakers
parent a8d08357c9
commit 9ab598af49
10 changed files with 50 additions and 81 deletions

View file

@ -720,25 +720,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
target_link_libraries(Kernel PRIVATE kernel_heap clang_rt.builtins)
endif()
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
set(KERNEL_ELF_OBJCOPY_TARGET "elf64-x86-64")
endif()
# In x86_64 the Kernel is linked to the Pre-kernel binary.
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
add_custom_command(
TARGET Kernel POST_BUILD
COMMAND ${CMAKE_COMMAND} -E env NM=${CMAKE_NM} sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
COMMAND ${CMAKE_COMMAND} -E env OBJCOPY=${CMAKE_OBJCOPY} sh ${CMAKE_CURRENT_SOURCE_DIR}/embedmap.sh
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug Kernel Kernel.debug
COMMAND ${CMAKE_OBJCOPY} --strip-debug Kernel
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=Kernel.debug Kernel
COMMAND ${CMAKE_OBJCOPY} --set-section-flags .heap=load Kernel Kernel_shared_object
COMMAND ${CMAKE_OBJCOPY} -I binary -O ${KERNEL_ELF_OBJCOPY_TARGET} --rename-section .data=.Kernel_image --set-section-alignment .Kernel_image=4096 Kernel_shared_object Kernel.o
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Kernel.o ${CMAKE_CURRENT_BINARY_DIR}/kernel.map
)
elseif ("${SERENITY_ARCH}" STREQUAL "aarch64")
add_custom_command(
add_custom_command(
TARGET Kernel POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E env NM=${CMAKE_NM} sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
COMMAND "${CMAKE_COMMAND}" -E env OBJCOPY=${CMAKE_OBJCOPY} sh ${CMAKE_CURRENT_SOURCE_DIR}/embedmap.sh
@ -746,14 +728,9 @@ elseif ("${SERENITY_ARCH}" STREQUAL "aarch64")
COMMAND ${CMAKE_OBJCOPY} --strip-debug Kernel
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=Kernel.debug Kernel
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/kernel.map
)
endif()
)
# Both architectures (x86_64, aarch64) share the same location in their respective architecture build folder.
# In x86_64 the Kernel is linked to the Pre-kernel binary and then generates the result Kernel binary.
# In aarch64 there's no Pre-kernel stage yet, so we immediately get a Kernel binary.
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel" DESTINATION boot)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel.debug" DESTINATION boot)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kernel.map" DESTINATION res)