mirror of
https://github.com/reactos/reactos.git
synced 2024-08-19 18:02:55 +00:00
![Joachim Henze](/assets/img/avatar_default.png)
This version (after .rsrc) works different than the proper version I used for 0.4.12 (after .reloc). Inserting after .rsrc as actually not correct, but Thomas believes it can be used as a temporary trick to avoid random memory corruption upon relocations of the kernel, caused by ROSBE-154. I follow his advice, although when judging from practical tests only: as long as we limit this script to NTOSKRNL like I do for releases there have no negative consequences been observed in real life yet even with the proper version of 0.4.12. Up to now those problems have only been observed when used for drivers MODULE TYPE sdk/cmake/gcc.cmake as well, like it was tried for a moment in master 0.4.13-dev-609-gc4d8e2a6e9
Using for drivers immediately did lead to BSODs like CORE-16183 and therefore was mitigated in master by total disabling of the scripts for both, kernel and drivers in 0.4.13-dev-621-g36e9a6f8dd
To allow installing DVDWritenow without BSOD, we need the script at least for ntoskrnl! Master remains affected by the BSOD until Thomas allows to commit there as well.
64 lines
1.8 KiB
CMake
64 lines
1.8 KiB
CMake
|
|
PROJECT(NTOS)
|
|
|
|
include(ntos.cmake)
|
|
|
|
set(NTOSKRNL_SOURCE ${SOURCE})
|
|
set(NTOSKRNL_ASM_SOURCE ${ASM_SOURCE})
|
|
|
|
set(NTKRNLMP_SOURCE ${SOURCE})
|
|
set(NTKRNLMP_ASM_SOURCE ${ASM_SOURCE})
|
|
|
|
spec2def(ntoskrnl.exe ntoskrnl.spec ADD_IMPORTLIB)
|
|
add_asm_files(ntoskrnl_asm ${NTOSKRNL_ASM_SOURCE})
|
|
|
|
add_executable(ntoskrnl
|
|
${ntoskrnl_asm}
|
|
${NTOSKRNL_SOURCE}
|
|
guid.c
|
|
ntoskrnl.rc
|
|
${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl.def)
|
|
set_property(TARGET ntoskrnl PROPERTY ENABLE_EXPORTS TRUE)
|
|
set_target_properties(ntoskrnl PROPERTIES DEFINE_SYMBOL "")
|
|
|
|
if(ARCH STREQUAL "i386")
|
|
set_entrypoint(ntoskrnl KiSystemStartup 4)
|
|
else()
|
|
set_entrypoint(ntoskrnl KiSystemStartup)
|
|
endif()
|
|
set_subsystem(ntoskrnl native)
|
|
|
|
if(MSVC)
|
|
set_image_base(ntoskrnl 0x00400000)
|
|
add_target_link_flags(ntoskrnl "/SECTION:.rsrc,!DP") #Accessed from bugcheck code
|
|
add_target_link_flags(ntoskrnl "/SECTION:INIT,D")
|
|
else()
|
|
if(GDB)
|
|
set_image_base(ntoskrnl 0x00800000)
|
|
else()
|
|
set_image_base(ntoskrnl 0x80800000)
|
|
endif()
|
|
add_linker_script(ntoskrnl ${REACTOS_SOURCE_DIR}/sdk/cmake/init-section.lds)
|
|
endif()
|
|
|
|
target_link_libraries(ntoskrnl cportlib csq ${PSEH_LIB} cmlib ntlsalib rtl ${ROSSYM_LIB} libcntpr wdmguid ioevent)
|
|
|
|
if(STACK_PROTECTOR)
|
|
target_link_libraries(ntoskrnl gcc_ssp)
|
|
elseif(RUNTIME_CHECKS)
|
|
target_link_libraries(ntoskrnl runtmchk)
|
|
endif()
|
|
|
|
add_importlibs(ntoskrnl hal kdcom bootvid)
|
|
add_pch(ntoskrnl ${REACTOS_SOURCE_DIR}/ntoskrnl/include/ntoskrnl.h NTOSKRNL_SOURCE)
|
|
add_dependencies(ntoskrnl psdk bugcodes asm)
|
|
add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all)
|
|
|
|
if(BUILD_MP)
|
|
add_subdirectory(ntkrnlmp)
|
|
endif()
|
|
|
|
add_asm_files(ntdllsys_asm ntdll.S)
|
|
add_library(ntdllsys ${ntdllsys_asm})
|
|
set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE "C")
|
|
add_dependencies(ntdllsys asm) |