mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 05:02:56 +00:00
[BOOTSECTOR]
- export obj2bin on gcc builds, too - Add new macro CreateBootSectorTarget2, which uses portable assembly and use it with isoboot.S. I will replace all bootsectors with the new code one at a time, and in the end we can eventually drop nmake - add wrapper isobtrt.S, which defines ROS_REGTEST and includes isoboot.S svn path=/trunk/; revision=52156
This commit is contained in:
parent
7b19156c50
commit
65d0fe96c2
6 changed files with 42 additions and 10 deletions
|
@ -59,7 +59,7 @@ if(NOT CMAKE_CROSSCOMPILING)
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
export(TARGETS widl wrc gendib cabman cdmake mkhive spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
export(TARGETS widl wrc gendib cabman cdmake mkhive obj2bin spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
||||||
else()
|
else()
|
||||||
export(TARGETS gendib cabman cdmake mkhive obj2bin spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
export(TARGETS gendib cabman cdmake mkhive obj2bin spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
|
|
||||||
if(MSVC)
|
if(ARCH MATCHES i386 OR ARCH MATCHES amd64)
|
||||||
CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.S ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00)
|
|
||||||
else()
|
#CreateBootSectorTarget2(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.S ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 0)
|
||||||
|
#CreateBootSectorTarget2(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.S ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0)
|
||||||
|
#CreateBootSectorTarget2(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.S ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00)
|
||||||
|
#CreateBootSectorTarget2(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.S ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 0)
|
||||||
|
CreateBootSectorTarget2(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/isoboot.S ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin 7000)
|
||||||
|
#CreateBootSectorTarget2(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.S ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 0)
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.asm ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 0)
|
CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.asm ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 0)
|
||||||
CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.asm ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0)
|
CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.asm ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0)
|
||||||
CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.asm ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 0)
|
CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.asm ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00)
|
||||||
CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.asm ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 0)
|
CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.asm ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 0)
|
||||||
CreateBootSectorTarget(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/isoboot.asm ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin 0)
|
|
||||||
CreateBootSectorTarget(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.asm ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 0)
|
CreateBootSectorTarget(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.asm ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -17,3 +23,5 @@ add_cd_file(TARGET fat DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR
|
||||||
add_cd_file(TARGET isoboot DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin FOR all)
|
add_cd_file(TARGET isoboot DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin FOR all)
|
||||||
add_cd_file(TARGET isobtrt DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin FOR all)
|
add_cd_file(TARGET isobtrt DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin FOR all)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,9 @@
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
|
|
||||||
//#define DEBUG_MESSAGES /* Uncomment to get debugging messages */
|
//#define DEBUG_MESSAGES /* Uncomment to get debugging messages */
|
||||||
|
#ifndef ROS_REGTEST
|
||||||
#define WAIT_FOR_KEY
|
#define WAIT_FOR_KEY
|
||||||
|
#endif
|
||||||
|
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
// BEGIN THE BIOS/CODE/DATA SEGMENT
|
// BEGIN THE BIOS/CODE/DATA SEGMENT
|
||||||
|
@ -129,7 +130,6 @@ relocate:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Make sure the keyboard buffer is empty
|
// Make sure the keyboard buffer is empty
|
||||||
#ifdef WAIT_FOR_KEY
|
|
||||||
call pollchar_and_empty
|
call pollchar_and_empty
|
||||||
|
|
||||||
// Check for MBR on harddisk
|
// Check for MBR on harddisk
|
||||||
|
@ -148,6 +148,7 @@ relocate:
|
||||||
je .boot_cdrom // no boot sector found (hopefully there are no weird bootsectors which begin with 0)
|
je .boot_cdrom // no boot sector found (hopefully there are no weird bootsectors which begin with 0)
|
||||||
pop ax
|
pop ax
|
||||||
|
|
||||||
|
#ifdef WAIT_FOR_KEY
|
||||||
// Display the 'Press key' message and wait for a maximum of 5 seconds
|
// Display the 'Press key' message and wait for a maximum of 5 seconds
|
||||||
call crlf
|
call crlf
|
||||||
mov si, offset presskey_msg // si points to 'Press key' message
|
mov si, offset presskey_msg // si points to 'Press key' message
|
||||||
|
@ -171,6 +172,7 @@ relocate:
|
||||||
dec byte ptr ds:[TimeoutCount] // decrement timeout counter
|
dec byte ptr ds:[TimeoutCount] // decrement timeout counter
|
||||||
jz .boot_harddisk
|
jz .boot_harddisk
|
||||||
jmp .next_second
|
jmp .next_second
|
||||||
|
#endif
|
||||||
|
|
||||||
.boot_harddisk:
|
.boot_harddisk:
|
||||||
call crlf
|
call crlf
|
||||||
|
@ -192,7 +194,6 @@ relocate:
|
||||||
mov dx, HEX(0080)
|
mov dx, HEX(0080)
|
||||||
|
|
||||||
ljmp16 0, HEX(7C00)
|
ljmp16 0, HEX(7C00)
|
||||||
#endif
|
|
||||||
|
|
||||||
.boot_cdrom:
|
.boot_cdrom:
|
||||||
#ifdef WAIT_FOR_KEY
|
#ifdef WAIT_FOR_KEY
|
||||||
|
|
3
reactos/boot/freeldr/bootsect/isobtrt.S
Normal file
3
reactos/boot/freeldr/bootsect/isobtrt.S
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
#define ROS_REGTEST
|
||||||
|
#include "isoboot.S"
|
|
@ -352,3 +352,23 @@ macro(CreateBootSectorTarget _target_name _asm_file _object_file _base_address)
|
||||||
set_source_files_properties(${_object_file} PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${_object_file} PROPERTIES GENERATED TRUE)
|
||||||
add_custom_target(${_target_name} ALL DEPENDS ${_object_file})
|
add_custom_target(${_target_name} ALL DEPENDS ${_object_file})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
macro(CreateBootSectorTarget2 _target_name _asm_file _binary_file _base_address)
|
||||||
|
set(_object_file ${_binary_file}.o)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${_object_file}
|
||||||
|
COMMAND ${CMAKE_ASM_COMPILER} -x assembler-with-cpp -o ${_object_file} -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm -D__ASM__ -c ${_asm_file}
|
||||||
|
DEPENDS ${_asm_file})
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${_binary_file}
|
||||||
|
COMMAND native-obj2bin ${_object_file} ${_binary_file} ${_base_address}
|
||||||
|
# COMMAND objcopy --output-target binary --image-base 0x${_base_address} ${_object_file} ${_binary_file}
|
||||||
|
DEPENDS ${_object_file})
|
||||||
|
|
||||||
|
set_source_files_properties(${_object_file} ${_binary_file} PROPERTIES GENERATED TRUE)
|
||||||
|
|
||||||
|
add_custom_target(${_target_name} ALL DEPENDS ${_binary_file})
|
||||||
|
|
||||||
|
endmacro()
|
||||||
|
|
|
@ -192,7 +192,7 @@ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs)
|
||||||
#pseh workaround
|
#pseh workaround
|
||||||
set(PSEH_LIB "pseh")
|
set(PSEH_LIB "pseh")
|
||||||
|
|
||||||
macro(CreateBootSectorTarget _target_name _asm_file _binary_file _base_address)
|
macro(CreateBootSectorTarget2 _target_name _asm_file _binary_file _base_address)
|
||||||
|
|
||||||
set(_object_file ${_binary_file}.obj)
|
set(_object_file ${_binary_file}.obj)
|
||||||
set(_temp_file ${_binary_file}.tmp)
|
set(_temp_file ${_binary_file}.tmp)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue