2011-05-16 13:12:07 +00:00
|
|
|
|
2012-02-25 23:50:38 +00:00
|
|
|
if(SEPARATE_DBG)
|
|
|
|
# FIXME: http://sourceware.org/bugzilla/show_bug.cgi?id=11822
|
2016-08-23 19:20:44 +00:00
|
|
|
set(CMAKE_LDR_PE_HELPER_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
2019-04-06 14:50:56 +00:00
|
|
|
set(CMAKE_LDR_PE_HELPER_STANDARD_LIBRARIES_INIT "")
|
2012-10-28 01:58:36 +00:00
|
|
|
set(CMAKE_LDR_PE_HELPER_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries")
|
2012-02-25 23:50:38 +00:00
|
|
|
endif()
|
|
|
|
|
2015-11-07 09:03:26 +00:00
|
|
|
if(MSVC)
|
2019-01-13 00:56:19 +00:00
|
|
|
# We don't need hotpatching
|
2015-11-07 09:03:26 +00:00
|
|
|
replace_compile_flags("/hotpatch" " ")
|
2019-01-13 00:56:19 +00:00
|
|
|
|
|
|
|
# Explicitly use string pooling
|
|
|
|
add_compile_flags("/GF")
|
2015-11-07 09:03:26 +00:00
|
|
|
endif()
|
|
|
|
|
2016-02-03 22:18:05 +00:00
|
|
|
spec2def(freeldr_pe.exe freeldr.spec)
|
2011-10-01 12:14:45 +00:00
|
|
|
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2012-04-20 12:39:00 +00:00
|
|
|
CreateBootSectorTarget(frldr16
|
2011-06-18 14:37:54 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/arch/realmode/i386.S
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
|
2011-06-18 17:19:28 +00:00
|
|
|
F800)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2012-04-20 12:39:00 +00:00
|
|
|
CreateBootSectorTarget(frldr16
|
2011-08-25 14:43:15 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/arch/realmode/amd64.S
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
|
|
|
|
F800)
|
2011-06-18 14:37:54 +00:00
|
|
|
endif()
|
|
|
|
|
2011-05-16 13:12:07 +00:00
|
|
|
include_directories(BEFORE include)
|
|
|
|
include_directories(${REACTOS_SOURCE_DIR}/ntoskrnl/include)
|
2016-04-20 12:36:25 +00:00
|
|
|
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/cmlib)
|
|
|
|
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs)
|
|
|
|
include_directories(${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
|
|
|
|
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_NTLDR_SOURCE
|
2016-02-05 00:17:33 +00:00
|
|
|
ntldr/conversion.c
|
|
|
|
ntldr/registry.c
|
|
|
|
ntldr/winldr.c
|
|
|
|
ntldr/wlmemory.c
|
2017-12-09 13:18:25 +00:00
|
|
|
ntldr/wlregistry.c)
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_ARC_SOURCE
|
2015-02-01 21:35:45 +00:00
|
|
|
arcname.c
|
2019-08-11 16:56:40 +00:00
|
|
|
arch/arcemul.c
|
2015-02-01 21:35:45 +00:00
|
|
|
arch/archwsup.c
|
2011-05-16 13:12:07 +00:00
|
|
|
disk/disk.c
|
|
|
|
disk/partition.c
|
2017-12-09 13:18:25 +00:00
|
|
|
disk/ramdisk.c)
|
2011-06-10 12:55:14 +00:00
|
|
|
#disk/scsiport.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
|
|
|
|
linuxboot.c
|
|
|
|
miscboot.c
|
|
|
|
options.c
|
|
|
|
oslist.c
|
2011-05-16 13:12:07 +00:00
|
|
|
ui/directui.c
|
|
|
|
ui/gui.c
|
|
|
|
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
|
|
|
|
2019-01-20 01:47:25 +00:00
|
|
|
list(APPEND FREELDR_BASE_ASM_SOURCE)
|
|
|
|
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2019-01-20 01:47:25 +00:00
|
|
|
list(APPEND FREELDR_BASE_ASM_SOURCE
|
|
|
|
arch/i386/multiboot.S)
|
|
|
|
|
2013-01-08 20:33:08 +00:00
|
|
|
list(APPEND FREELDR_COMMON_ASM_SOURCE
|
2019-01-20 01:47:25 +00:00
|
|
|
arch/i386/drvmap.S
|
2013-01-08 20:33:08 +00:00
|
|
|
arch/i386/entry.S
|
2016-02-11 22:33:03 +00:00
|
|
|
arch/i386/int386.S
|
|
|
|
arch/i386/pnpbios.S
|
2013-01-08 20:33:08 +00:00
|
|
|
arch/i386/i386trap.S
|
2019-01-20 01:47:25 +00:00
|
|
|
arch/i386/linux.S)
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_NTLDR_SOURCE
|
2016-02-05 00:17:33 +00:00
|
|
|
ntldr/arch/i386/winldr.c
|
2017-12-09 13:18:25 +00:00
|
|
|
ntldr/headless.c)
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_ARC_SOURCE
|
2016-02-05 00:17:33 +00:00
|
|
|
lib/fs/pxe.c
|
|
|
|
arch/i386/halstub.c
|
|
|
|
arch/i386/ntoskrnl.c
|
2011-05-16 13:12:07 +00:00
|
|
|
arch/i386/archmach.c
|
|
|
|
arch/i386/drivemap.c
|
|
|
|
arch/i386/hardware.c
|
|
|
|
arch/i386/hwacpi.c
|
|
|
|
arch/i386/hwapm.c
|
2011-09-29 21:12:40 +00:00
|
|
|
arch/i386/hwdisk.c
|
2011-05-16 13:12:07 +00:00
|
|
|
arch/i386/hwpci.c
|
2011-06-18 14:37:54 +00:00
|
|
|
arch/i386/i386bug.c
|
|
|
|
arch/i386/i386idt.c
|
2011-05-16 13:12:07 +00:00
|
|
|
arch/i386/i386rtl.c
|
|
|
|
arch/i386/i386vid.c
|
|
|
|
arch/i386/machpc.c
|
|
|
|
arch/i386/pccons.c
|
|
|
|
arch/i386/pcdisk.c
|
|
|
|
arch/i386/pcmem.c
|
|
|
|
arch/i386/pcrtc.c
|
|
|
|
arch/i386/pcvideo.c
|
|
|
|
arch/i386/machxbox.c
|
|
|
|
arch/i386/xboxcons.c
|
|
|
|
arch/i386/xboxdisk.c
|
|
|
|
arch/i386/xboxfont.c
|
|
|
|
arch/i386/xboxi2c.c
|
|
|
|
arch/i386/xboxmem.c
|
|
|
|
arch/i386/xboxrtc.c
|
|
|
|
arch/i386/xboxvideo.c
|
2011-06-18 14:37:54 +00:00
|
|
|
disk/scsiport.c)
|
2019-01-13 00:56:19 +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
|
2011-06-26 10:49:22 +00:00
|
|
|
arch/amd64/entry.S
|
2011-08-26 13:10:18 +00:00
|
|
|
arch/amd64/int386.S
|
2013-01-08 20:33:08 +00:00
|
|
|
arch/amd64/pnpbios.S)
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_NTLDR_SOURCE
|
2017-12-09 13:18:25 +00:00
|
|
|
ntldr/arch/amd64/winldr.c)
|
2016-02-05 00:17:33 +00:00
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_ARC_SOURCE
|
2016-02-05 00:17:33 +00:00
|
|
|
lib/fs/pxe.c
|
|
|
|
arch/i386/ntoskrnl.c
|
2019-08-07 17:30:55 +00:00
|
|
|
arch/i386/drivemap.c
|
2011-06-10 12:55:14 +00:00
|
|
|
arch/i386/hardware.c
|
|
|
|
arch/i386/hwacpi.c
|
|
|
|
arch/i386/hwapm.c
|
2011-10-01 12:14:45 +00:00
|
|
|
arch/i386/hwdisk.c
|
2011-06-10 12:55:14 +00:00
|
|
|
arch/i386/hwpci.c
|
2013-03-23 21:20:00 +00:00
|
|
|
arch/i386/i386bug.c
|
2011-06-10 12:55:14 +00:00
|
|
|
arch/i386/i386rtl.c
|
|
|
|
arch/i386/i386vid.c
|
|
|
|
arch/i386/machpc.c
|
|
|
|
arch/i386/pccons.c
|
|
|
|
arch/i386/pcdisk.c
|
|
|
|
arch/i386/pcmem.c
|
|
|
|
arch/i386/pcrtc.c
|
2016-02-05 00:17:33 +00:00
|
|
|
arch/i386/pcvideo.c)
|
2019-01-13 00:56:19 +00:00
|
|
|
|
2014-07-05 19:02:41 +00:00
|
|
|
elseif(ARCH STREQUAL "arm")
|
|
|
|
list(APPEND FREELDR_COMMON_ASM_SOURCE
|
|
|
|
arch/arm/boot.S)
|
2016-02-05 00:17:33 +00:00
|
|
|
|
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
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
list(APPEND FREELDR_ARC_SOURCE
|
2016-02-03 15:20:37 +00:00
|
|
|
arch/arm/entry.c
|
2016-02-05 00:17:33 +00:00
|
|
|
arch/arm/macharm.c)
|
2011-05-16 13:12:07 +00:00
|
|
|
else()
|
|
|
|
#TBD
|
|
|
|
endif()
|
|
|
|
|
2014-02-12 11:37:40 +00:00
|
|
|
add_asm_files(freeldr_common_asm ${FREELDR_COMMON_ASM_SOURCE})
|
2017-12-09 13:18:25 +00:00
|
|
|
|
|
|
|
add_library(freeldr_common
|
|
|
|
${freeldr_common_asm}
|
2019-01-13 00:56:19 +00:00
|
|
|
${FREELDR_BOOTLIB_SOURCE}
|
|
|
|
${FREELDR_ARC_SOURCE}
|
|
|
|
${FREELDR_NTLDR_SOURCE}
|
|
|
|
${FREELDR_BOOTMGR_SOURCE})
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2017-10-27 21:18:01 +00:00
|
|
|
if(USE_CLANG_CL)
|
|
|
|
# We need to reduce the binary size
|
2017-12-09 13:18:25 +00:00
|
|
|
add_target_compile_flags(freeldr_common "/Os")
|
2017-10-27 21:18:01 +00:00
|
|
|
endif()
|
2019-03-31 08:30:45 +00:00
|
|
|
if(NOT MSVC AND ARCH STREQUAL "i386")
|
|
|
|
# Prevent a warning when doing a memcmp with address 0
|
|
|
|
set_source_files_properties(arch/i386/xboxmem.c PROPERTIES COMPILE_FLAGS "-Wno-nonnull")
|
|
|
|
endif()
|
2017-10-27 21:18:01 +00:00
|
|
|
|
2017-12-09 13:18:25 +00:00
|
|
|
set(PCH_SOURCE
|
2019-01-13 00:56:19 +00:00
|
|
|
${FREELDR_BOOTLIB_SOURCE}
|
|
|
|
${FREELDR_ARC_SOURCE}
|
|
|
|
${FREELDR_NTLDR_SOURCE}
|
|
|
|
${FREELDR_BOOTMGR_SOURCE})
|
2017-12-09 13:18:25 +00:00
|
|
|
|
|
|
|
add_pch(freeldr_common include/freeldr.h PCH_SOURCE)
|
|
|
|
add_dependencies(freeldr_common bugcodes asm xdk)
|
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
## GCC builds need this extra thing for some reason...
|
2019-01-20 01:47:25 +00:00
|
|
|
if(ARCH STREQUAL "i386" AND NOT MSVC)
|
2014-12-28 22:15:34 +00:00
|
|
|
target_link_libraries(freeldr_common mini_hal)
|
2011-09-20 08:50:38 +00:00
|
|
|
endif()
|
2011-06-12 21:21:47 +00:00
|
|
|
|
2019-01-20 01:47:25 +00:00
|
|
|
add_asm_files(freeldr_base_asm ${FREELDR_BASE_ASM_SOURCE})
|
|
|
|
|
2011-06-18 14:37:54 +00:00
|
|
|
list(APPEND FREELDR_BASE_SOURCE
|
2019-01-20 01:47:25 +00:00
|
|
|
${freeldr_base_asm}
|
2011-06-18 14:37:54 +00:00
|
|
|
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
|
2015-01-03 16:51:26 +00:00
|
|
|
lib/rtl/libsupp.c)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2016-02-03 22:18:05 +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)
|
2011-10-01 12:14:45 +00:00
|
|
|
endif()
|
|
|
|
|
2016-02-03 22:18:05 +00:00
|
|
|
add_executable(freeldr_pe ${FREELDR_BASE_SOURCE})
|
|
|
|
add_executable(freeldr_pe_dbg EXCLUDE_FROM_ALL ${FREELDR_BASE_SOURCE})
|
2014-02-12 11:37:40 +00:00
|
|
|
|
2019-04-06 14:50:56 +00:00
|
|
|
set_target_properties(freeldr_pe freeldr_pe_dbg
|
|
|
|
PROPERTIES
|
|
|
|
ENABLE_EXPORTS TRUE
|
|
|
|
DEFINE_SYMBOL "")
|
2019-02-03 11:57:20 +00:00
|
|
|
|
2014-02-12 11:37:40 +00:00
|
|
|
if(NOT MSVC AND SEPARATE_DBG)
|
|
|
|
set_target_properties(freeldr_pe PROPERTIES LINKER_LANGUAGE LDR_PE_HELPER)
|
|
|
|
set_target_properties(freeldr_pe_dbg PROPERTIES LINKER_LANGUAGE LDR_PE_HELPER)
|
2012-07-30 16:57:55 +00:00
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2014-02-12 11:37:40 +00:00
|
|
|
if(MSVC)
|
2015-04-11 14:03:19 +00:00
|
|
|
if(ARCH STREQUAL "arm")
|
|
|
|
add_target_link_flags(freeldr_pe "/ignore:4078 /ignore:4254 /DRIVER")
|
|
|
|
add_target_link_flags(freeldr_pe_dbg "/ignore:4078 /ignore:4254 /DRIVER")
|
|
|
|
else()
|
[FREELDR] Introduce a MSVC "linker script" file that centralizes the commands for defining section-limit symbols, and the ordering and merging of PE sections, and the necessary CMake code to use it. (#1224)
As the MSVC linker alone doesn't permit such control, the file uses
ASM language (C can alternatively be used), together with extra linker
command-line switches.
It is pre-processed 3 times: first for generating the ASM code, second
for the C code and the third time for generating the linker response
file.
In our case, the ASM code defines the __bss_start__ and __bss_end__
symbols that allow us to find the limits of the .bss section (which is
by the way automatically appended to the .data section by the MSVC linker).
The C code is used to specify the list of linker switches that can be
passed through the `#pragma comment(linker, ...)' directive (the can be
alternatively specified in the linker response section).
Finally the linker response section contains all the linker switches
that cannot be specified with the `#pragma comment(linker, ...)'
directive.
Using all this we can recycle the BSS initialization code, that has been
written originally for GCC only, also for the MSVC builds.
Also, remove the outdated .text16 section merging.
2019-01-19 22:28:17 +00:00
|
|
|
add_target_link_flags(freeldr_pe "/ignore:4078 /ignore:4254 /DRIVER /FIXED /FILEALIGN:0x200 /ALIGN:0x200")
|
|
|
|
add_linker_script(freeldr_pe freeldr_i386.msvc.lds)
|
|
|
|
add_target_link_flags(freeldr_pe_dbg "/ignore:4078 /ignore:4254 /DRIVER /FIXED /FILEALIGN:0x200 /ALIGN:0x200")
|
|
|
|
add_linker_script(freeldr_pe_dbg freeldr_i386.msvc.lds)
|
2015-04-11 14:03:19 +00:00
|
|
|
endif()
|
2014-02-12 11:37:40 +00:00
|
|
|
else()
|
[FREELDR] Introduce a MSVC "linker script" file that centralizes the commands for defining section-limit symbols, and the ordering and merging of PE sections, and the necessary CMake code to use it. (#1224)
As the MSVC linker alone doesn't permit such control, the file uses
ASM language (C can alternatively be used), together with extra linker
command-line switches.
It is pre-processed 3 times: first for generating the ASM code, second
for the C code and the third time for generating the linker response
file.
In our case, the ASM code defines the __bss_start__ and __bss_end__
symbols that allow us to find the limits of the .bss section (which is
by the way automatically appended to the .data section by the MSVC linker).
The C code is used to specify the list of linker switches that can be
passed through the `#pragma comment(linker, ...)' directive (the can be
alternatively specified in the linker response section).
Finally the linker response section contains all the linker switches
that cannot be specified with the `#pragma comment(linker, ...)'
directive.
Using all this we can recycle the BSS initialization code, that has been
written originally for GCC only, also for the MSVC builds.
Also, remove the outdated .text16 section merging.
2019-01-19 22:28:17 +00:00
|
|
|
add_target_link_flags(freeldr_pe "-Wl,--strip-all,--exclude-all-symbols,--file-alignment,0x200,--section-alignment,0x200")
|
|
|
|
add_linker_script(freeldr_pe freeldr_i386.lds)
|
|
|
|
add_target_link_flags(freeldr_pe_dbg "-Wl,--exclude-all-symbols,--file-alignment,0x200,--section-alignment,0x200")
|
|
|
|
add_linker_script(freeldr_pe_dbg freeldr_i386.lds)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
2011-06-18 17:19:28 +00:00
|
|
|
set_image_base(freeldr_pe 0x10000)
|
2011-06-12 21:21:47 +00:00
|
|
|
set_subsystem(freeldr_pe native)
|
2011-06-13 09:23:11 +00:00
|
|
|
set_entrypoint(freeldr_pe RealEntryPoint)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2011-09-24 16:08:37 +00:00
|
|
|
set_image_base(freeldr_pe_dbg 0x10000)
|
|
|
|
set_subsystem(freeldr_pe_dbg native)
|
|
|
|
set_entrypoint(freeldr_pe_dbg RealEntryPoint)
|
|
|
|
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2011-06-12 21:21:47 +00:00
|
|
|
target_link_libraries(freeldr_pe mini_hal)
|
2011-09-24 16:08:37 +00:00
|
|
|
target_link_libraries(freeldr_pe_dbg mini_hal)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|
|
|
|
|
2014-02-12 11:37:40 +00:00
|
|
|
target_link_libraries(freeldr_pe freeldr_common cportlib cmlib rtl libcntpr)
|
|
|
|
target_link_libraries(freeldr_pe_dbg freeldr_common cportlib cmlib rtl libcntpr)
|
2011-09-24 16:08:37 +00:00
|
|
|
|
2014-10-17 23:28:29 +00:00
|
|
|
if(STACK_PROTECTOR)
|
2014-10-04 20:26:14 +00:00
|
|
|
target_link_libraries(freeldr_pe gcc_ssp)
|
|
|
|
target_link_libraries(freeldr_pe_dbg gcc_ssp)
|
2014-10-18 14:22:09 +00:00
|
|
|
elseif(RUNTIME_CHECKS)
|
|
|
|
target_link_libraries(freeldr_pe runtmchk)
|
|
|
|
target_link_libraries(freeldr_pe_dbg runtmchk)
|
2014-10-18 21:12:12 +00:00
|
|
|
add_target_link_flags(freeldr_pe "/MERGE:.rtc=.text")
|
2014-10-04 20:26:14 +00:00
|
|
|
endif()
|
|
|
|
|
2011-06-12 21:21:47 +00:00
|
|
|
add_dependencies(freeldr_pe asm)
|
2011-09-24 16:08:37 +00:00
|
|
|
add_dependencies(freeldr_pe_dbg asm)
|
2011-06-12 21:21:47 +00:00
|
|
|
|
2015-04-11 14:03:19 +00:00
|
|
|
if(NOT ARCH STREQUAL "arm")
|
|
|
|
concatenate_files(
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
|
2018-03-10 13:41:13 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_FILE_NAME:freeldr_pe>)
|
2015-04-11 14:03:19 +00:00
|
|
|
add_custom_target(freeldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys)
|
|
|
|
else()
|
2018-03-10 13:41:13 +00:00
|
|
|
add_custom_target(freeldr ALL DEPENDS freeldr_pe)
|
2015-04-11 14:03:19 +00:00
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2019-01-13 00:56:19 +00:00
|
|
|
# Rename freeldr on livecd to setupldr.sys because isoboot.bin looks for setupldr.sys
|
2011-09-03 10:56:36 +00:00
|
|
|
add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR bootcd regtest)
|
2015-01-26 21:19:21 +00:00
|
|
|
add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR livecd hybridcd NAME_ON_CD setupldr.sys)
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2015-05-14 22:32:35 +00:00
|
|
|
if(NOT ARCH STREQUAL "arm")
|
|
|
|
concatenate_files(
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
|
2018-03-10 13:41:13 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_FILE_NAME:freeldr_pe>)
|
2015-05-14 22:32:35 +00:00
|
|
|
add_custom_target(setupldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys)
|
|
|
|
else()
|
2018-03-10 13:41:13 +00:00
|
|
|
add_custom_target(setupldr ALL DEPENDS freeldr_pe)
|
2015-05-14 22:32:35 +00:00
|
|
|
endif()
|
2011-06-12 21:21:47 +00:00
|
|
|
|
2011-09-03 10:56:36 +00:00
|
|
|
add_cd_file(TARGET setupldr FILE ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys DESTINATION loader NO_CAB FOR bootcd regtest)
|