2023-03-09 16:30:34 +00:00
|
|
|
##
|
|
|
|
## 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>
|
|
|
|
##
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2015-11-07 09:03:26 +00:00
|
|
|
if(MSVC)
|
2019-01-13 00:56:19 +00:00
|
|
|
# Explicitly use string pooling
|
2020-09-21 10:16:02 +00:00
|
|
|
add_compile_options("/GF")
|
2015-11-07 09:03:26 +00:00
|
|
|
endif()
|
|
|
|
|
2023-03-09 16:30:34 +00:00
|
|
|
#spec2def(freeldr_pe.exe freeldr.spec)
|
2011-06-18 14:37:54 +00:00
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
include_directories(BEFORE include)
|
2023-03-09 16:30:34 +00:00
|
|
|
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)
|
2011-06-18 14:37:54 +00:00
|
|
|
|
|
|
|
add_definitions(-D_NTHAL_ -D_BLDR_ -D_NTSYSTEM_)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2023-03-09 16:30:34 +00:00
|
|
|
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
|
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
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
|
2016-02-05 00:17:33 +00:00
|
|
|
lib/debug.c
|
|
|
|
lib/peloader.c
|
2019-08-11 16:56:40 +00:00
|
|
|
lib/cache/blocklist.c
|
|
|
|
lib/cache/cache.c
|
2016-02-05 00:17:33 +00:00
|
|
|
lib/comm/rs232.c
|
|
|
|
## add KD support
|
2018-06-19 01:00:52 +00:00
|
|
|
lib/fs/btrfs.c
|
2016-02-05 00:17:33 +00:00
|
|
|
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
|
2017-12-09 13:18:25 +00:00
|
|
|
lib/mm/heap.c)
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_BOOTMGR_SOURCE
|
2016-02-05 00:17:33 +00:00
|
|
|
include/freeldr.h
|
|
|
|
cmdline.c
|
|
|
|
custom.c
|
2023-03-09 16:30:34 +00:00
|
|
|
# linuxboot.c
|
2016-02-05 00:17:33 +00:00
|
|
|
miscboot.c
|
|
|
|
options.c
|
|
|
|
oslist.c
|
2011-05-16 13:12:07 +00:00
|
|
|
ui/directui.c
|
2022-01-05 03:15:41 +00:00
|
|
|
# ui/gui.c
|
2011-05-16 13:12:07 +00:00
|
|
|
ui/minitui.c
|
|
|
|
ui/noui.c
|
|
|
|
ui/tui.c
|
|
|
|
ui/tuimenu.c
|
|
|
|
ui/ui.c
|
2019-08-11 16:56:40 +00:00
|
|
|
ui/video.c)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2023-03-09 16:30:34 +00:00
|
|
|
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)
|
2019-01-20 01:47:25 +00:00
|
|
|
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2019-01-20 01:47:25 +00:00
|
|
|
|
2013-01-08 20:33:08 +00:00
|
|
|
list(APPEND FREELDR_COMMON_ASM_SOURCE
|
2023-03-09 16:30:34 +00:00
|
|
|
arch/i386/i386trap.S)
|
|
|
|
# arch/i386/linux.S
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_ARC_SOURCE
|
2023-03-09 16:30:34 +00:00
|
|
|
arch/i386/i386bug.c
|
2016-02-05 00:17:33 +00:00
|
|
|
arch/i386/halstub.c
|
|
|
|
arch/i386/ntoskrnl.c
|
2011-06-18 14:37:54 +00:00
|
|
|
disk/scsiport.c)
|
2019-01-13 00:56:19 +00:00
|
|
|
|
2023-03-09 16:30:34 +00:00
|
|
|
list(APPEND FREELDR_NTLDR_SOURCE
|
|
|
|
ntldr/arch/i386/winldr.c
|
|
|
|
ntldr/headless.c)
|
2019-12-27 20:02:38 +00:00
|
|
|
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2013-01-08 20:33:08 +00:00
|
|
|
list(APPEND FREELDR_COMMON_ASM_SOURCE
|
2023-03-09 16:30:34 +00:00
|
|
|
arch/amd64/misc.S)
|
|
|
|
# arch/amd64/linux.S
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_ARC_SOURCE
|
2013-03-23 21:20:00 +00:00
|
|
|
arch/i386/i386bug.c
|
2023-03-09 16:30:34 +00:00
|
|
|
arch/i386/ntoskrnl.c)
|
2019-01-13 00:56:19 +00:00
|
|
|
|
2023-03-09 16:30:34 +00:00
|
|
|
list(APPEND FREELDR_NTLDR_SOURCE
|
|
|
|
ntldr/arch/amd64/winldr.c)
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2023-03-09 16:30:34 +00:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_NTLDR_SOURCE
|
2017-12-09 13:18:25 +00:00
|
|
|
ntldr/arch/arm/winldr.c)
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
else()
|
2023-03-09 16:30:34 +00:00
|
|
|
#TBD
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
2011-06-18 14:37:54 +00:00
|
|
|
list(APPEND FREELDR_BASE_SOURCE
|
|
|
|
bootmgr.c # This file is compiled with custom definitions
|
|
|
|
freeldr.c
|
2016-02-05 00:17:33 +00:00
|
|
|
ntldr/setupldr.c ## Strangely enough this file is needed in GCC builds
|
2019-01-13 00:56:19 +00:00
|
|
|
## even if ${FREELDR_NTLDR_SOURCE} is not added,
|
2016-02-05 00:17:33 +00:00
|
|
|
## otherwise we get linking errors with Rtl**Bitmap** APIs.
|
|
|
|
## Do not happen on MSVC builds however...
|
2019-08-11 16:56:40 +00:00
|
|
|
ntldr/inffile.c
|
[FREELDR] Parse NT kernel load options in a consistent manner.
- Introduce a set of NtLdrGet(Next)Option(Ex) helpers that allow
retrieving respectively, the "next" option in an options string,
and retrieving a given named option in such an options string,
by correctly parsing that string.
Valid syntaxes:
/OPTION1 /OPTION2/OPTION3 OPTION4 /OPTION5(=...) ...
Options separators are slashes, or whitespace (space, tab), mandatory
if no slash is used, and otherwise optional.
- Use these functions wherever NT load options are being parsed.
- Simplify the parsing of /DEBUGPORT=... using these functions.
- When parsing the /HAL=... or /KERNEL=... options, only the first
encountered one is taken into account, any other ones are discarded.
- When parsing the other load options, only their first occurrences are
taken into account, any other repetitions are discarded.
* The NOPAE option overrides any previous PAE option.
* Any NOEXECUTE(=) option should override any previous
NOEXECUTE=ALWAYSOFF (or equivalently, EXECUTE) option.
2020-11-03 00:16:14 +00:00
|
|
|
ntldr/ntldropts.c
|
2015-01-03 16:51:26 +00:00
|
|
|
lib/rtl/libsupp.c)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2023-03-19 16:46:00 +00:00
|
|
|
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()
|
2011-06-12 21:21:47 +00:00
|
|
|
|
2023-03-09 16:30:34 +00:00
|
|
|
include(pcat.cmake)
|
2023-03-19 19:13:16 +00:00
|
|
|
if(NOT ARCH STREQUAL "i386" OR NOT (SARCH STREQUAL "pc98" OR SARCH STREQUAL "xbox"))
|
|
|
|
include(uefi.cmake)
|
|
|
|
endif()
|