reactos/boot/freeldr/freeldr/CMakeLists.txt

141 lines
3.5 KiB
CMake
Raw Normal View History

##
## PROJECT: FreeLoader
## LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
## PURPOSE: Common build definitions
## COPYRIGHT: Copyright 2003 Brian Palmer <brianp@sginet.com>
## Copyright 2011-2014 Amine Khaldi <amine.khaldi@reactos.org>
## Copyright 2011-2014 Timo Kreuzer <timo.kreuzer@reactos.org>
## Copyright 2014 Hervé Poussineau <hpoussin@reactos.org>
## Copyright 2023 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
##
if(MSVC)
# Explicitly use string pooling
add_compile_options("/GF")
endif()
#spec2def(freeldr_pe.exe freeldr.spec)
include_directories(BEFORE include)
include_directories(
${REACTOS_SOURCE_DIR}/ntoskrnl/include
${REACTOS_SOURCE_DIR}/sdk/lib/cmlib
${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs
${REACTOS_SOURCE_DIR}/sdk/include/reactos/elf)
add_definitions(-D_NTHAL_ -D_BLDR_ -D_NTSYSTEM_)
list(APPEND FREELDR_ARC_SOURCE
arcname.c
arch/arcemul.c
arch/archwsup.c
disk/disk.c
disk/partition.c
disk/ramdisk.c)
# disk/scsiport.c
# lib/fs/pxe.c
list(APPEND FREELDR_BOOTLIB_SOURCE
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes. CORE-9023 - During loading and initialization of the list of operating systems available in freeldr.ini, convert any legacy operating system entry encountered -- they are like those in NTLDR's boot.ini file, i.e.: ArcOsLoadPartition="LoadIdentifier" /List /of /Options into a new operating system INI entry, like those used by default in FreeLoader. This allows us to avoid treating this corner-case later in different parts of the code. Also, the "BootType" value is now determined there, only once. - Convert the OS loaders entry-points to ARC-compatible ones, following the "Advanced RISC Computing Specification, Version 1.2" specification https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf - Introduce helpers for retrieving options values from the argument vector in a simple way. - Simplify LoadOperatingSystem(), since now the "BootType" value has been determined once while loading the list of OSes (see above) and is well-defined there. Use the BuildArgvForOsLoader() helper to build the ARC-compatible argument vector from the corresponding INI settings for the selected operating system entry, and use it when calling the corresponding OS loader. - In the OS loaders, since we can now directly read the settings from the argument vector (instead of using INI settings), we can avoid using a bunch of fixed-size string buffers, and avoid potentially failing IniOpenSection() calls as well. - Simplify code in the Linux loader (and the RemoveQuotes() function). - Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings passed through the argument vector (equivalent to UiShowMessageBoxesInSection() ). - Use string-safe functions where needed (copy/concatenation/printf on fixed-size buffers).
2019-08-06 20:30:54 +00:00
lib/arcsupp.c
lib/debug.c
lib/peloader.c
lib/cache/blocklist.c
lib/cache/cache.c
lib/comm/rs232.c
## add KD support
lib/fs/btrfs.c
lib/fs/ext2.c
lib/fs/fat.c
lib/fs/fs.c
lib/fs/iso.c
lib/fs/ntfs.c
lib/inifile/ini_init.c
lib/inifile/inifile.c
lib/inifile/parse.c
lib/mm/meminit.c
lib/mm/mm.c
lib/mm/heap.c)
list(APPEND FREELDR_BOOTMGR_SOURCE
include/freeldr.h
cmdline.c
custom.c
# linuxboot.c
miscboot.c
options.c
oslist.c
ui/directui.c
# ui/gui.c
ui/minitui.c
ui/noui.c
ui/tui.c
ui/tuimenu.c
ui/ui.c
ui/video.c)
list(APPEND FREELDR_NTLDR_SOURCE
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmboot.c
ntldr/conversion.c
ntldr/registry.c
ntldr/winldr.c
ntldr/wlmemory.c
ntldr/wlregistry.c)
if(ARCH STREQUAL "i386")
list(APPEND FREELDR_COMMON_ASM_SOURCE
arch/i386/i386trap.S)
# arch/i386/linux.S
list(APPEND FREELDR_ARC_SOURCE
arch/i386/i386bug.c
arch/i386/halstub.c
arch/i386/ntoskrnl.c
disk/scsiport.c)
list(APPEND FREELDR_NTLDR_SOURCE
ntldr/arch/i386/winldr.c
ntldr/headless.c)
elseif(ARCH STREQUAL "amd64")
list(APPEND FREELDR_COMMON_ASM_SOURCE
arch/amd64/misc.S)
# arch/amd64/linux.S
list(APPEND FREELDR_ARC_SOURCE
arch/i386/i386bug.c
arch/i386/ntoskrnl.c)
list(APPEND FREELDR_NTLDR_SOURCE
ntldr/arch/amd64/winldr.c)
elseif(ARCH STREQUAL "arm")
list(APPEND FREELDR_NTLDR_SOURCE
ntldr/arch/arm/winldr.c)
else()
#TBD
endif()
list(APPEND FREELDR_BASE_SOURCE
bootmgr.c # This file is compiled with custom definitions
freeldr.c
ntldr/setupldr.c ## Strangely enough this file is needed in GCC builds
## even if ${FREELDR_NTLDR_SOURCE} is not added,
## otherwise we get linking errors with Rtl**Bitmap** APIs.
## Do not happen on MSVC builds however...
ntldr/inffile.c
ntldr/ntldropts.c
lib/rtl/libsupp.c)
if(ARCH STREQUAL "i386")
# Must be included together with disk/scsiport.c
list(APPEND FREELDR_BASE_SOURCE
${CMAKE_CURRENT_BINARY_DIR}/freeldr_pe.def)
endif()
include(pcat.cmake)
if(NOT ARCH STREQUAL "i386" OR NOT (SARCH STREQUAL "pc98" OR SARCH STREQUAL "xbox"))
include(uefi.cmake)
endif()