From bb43ef9710819692d048a1832dd1c934d6380f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 18 Jan 2015 13:55:23 +0000 Subject: [PATCH] [REACTOS] Add basic Hybrid-CD generation to our build system. Few changes were needed, especially in how we deal with the CD target "all": it's only for all the CD targets *BUT* the hybridcd. For the hybridcd you need to always specify the target manually (like in "... FOR all hybridcd" or "... FOR bootcd hybridcd" for example). Since at the moment we cannot have the bootcd in RAMDISK, and I want to be able to either have the hybridcd booting livecd from within the CD (i.e. read/writes from the CD) or in RAMDISK, I need to also add the files that are going to be copied into the bootcd or livecd into the hybridcd. CORE-9069 #resolve svn path=/trunk/; revision=66051 --- reactos/boot/CMakeLists.txt | 9 +++ reactos/boot/bootdata/CMakeLists.txt | 7 +- reactos/boot/bootdata/hybridcd.ini | 74 ++++++++++++++++++++ reactos/boot/freeldr/bootsect/CMakeLists.txt | 2 +- reactos/boot/freeldr/freeldr/CMakeLists.txt | 2 +- reactos/cmake/CMakeMacros.cmake | 34 ++++++++- 6 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 reactos/boot/bootdata/hybridcd.ini diff --git a/reactos/boot/CMakeLists.txt b/reactos/boot/CMakeLists.txt index c9341f49419..9321b32f90a 100644 --- a/reactos/boot/CMakeLists.txt +++ b/reactos/boot/CMakeLists.txt @@ -25,5 +25,14 @@ add_custom_target(livecd DEPENDS native-cdmake VERBATIM) +##hybridcd +#clear it out +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "") + +add_custom_target(hybridcd + COMMAND native-cdmake -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin @${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst REACTOS ${REACTOS_BINARY_DIR}/hybridcd.iso + DEPENDS native-cdmake livecd + VERBATIM) + add_subdirectory(freeldr) add_subdirectory(bootdata) diff --git a/reactos/boot/bootdata/CMakeLists.txt b/reactos/boot/bootdata/CMakeLists.txt index d5b894f0126..0a6b38b6dbf 100644 --- a/reactos/boot/bootdata/CMakeLists.txt +++ b/reactos/boot/bootdata/CMakeLists.txt @@ -63,13 +63,13 @@ add_cd_file( add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcdregtest/regtest.cmd DESTINATION reactos/bin FOR all) #autorun.inf -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun.inf DESTINATION root NO_CAB FOR all) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun.inf DESTINATION root NO_CAB FOR all hybridcd) #icon.ico -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon.ico DESTINATION root NO_CAB FOR all) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon.ico DESTINATION root NO_CAB FOR all hybridcd) #readme.txt -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION root NO_CAB FOR all) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION root NO_CAB FOR all hybridcd) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION reactos FOR all) #system.ini @@ -78,6 +78,7 @@ add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/system.ini DESTINATION reactos FOR #freeldr.ini add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd.ini DESTINATION root NO_CAB NAME_ON_CD freeldr.ini FOR bootcd regtest) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/livecd.ini DESTINATION root NAME_ON_CD freeldr.ini FOR livecd) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/hybridcd.ini DESTINATION root NAME_ON_CD freeldr.ini FOR hybridcd) #unattend add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcdregtest/unattend.inf DESTINATION reactos NO_CAB FOR regtest) diff --git a/reactos/boot/bootdata/hybridcd.ini b/reactos/boot/bootdata/hybridcd.ini new file mode 100644 index 00000000000..e8e53d5df2e --- /dev/null +++ b/reactos/boot/bootdata/hybridcd.ini @@ -0,0 +1,74 @@ +[FREELOADER] +DefaultOS=Setup +TimeOut=5 + +[Display] +TitleText=ReactOS Hybrid-CD +StatusBarColor=Cyan +StatusBarTextColor=Black +BackdropTextColor=White +BackdropColor=Blue +BackdropFillStyle=Medium +TitleBoxTextColor=White +TitleBoxColor=Red +MessageBoxTextColor=White +MessageBoxColor=Blue +MenuTextColor=Gray +MenuColor=Black +TextColor=Gray +SelectedTextColor=Black +SelectedColor=Gray +ShowTime=No +MenuBox=No +CenterMenu=No +MinimalUI=Yes +TimeText=Seconds until highlighted choice will be started automatically: + +[Operating Systems] +Setup="Setup" +LiveCD="LiveCD" +LiveCD_Debug="LiveCD (Debug)" +LiveCD_Screen="LiveCD (Screen)" +LiveCD_LogFile="LiveCD (Log file)" +LiveCD_RamDisk="LiveCD in RAM" +LiveCD_RamDisk_Debug="LiveCD in RAM (Debug)" +LiveCD_RamDisk_Screen="LiveCD in RAM (Screen)" + +[Setup] +BootType=ReactOSSetup +SystemPath=\bootcd + +[LiveCD] +BootType=Windows2003 +SystemPath=\livecd\reactos +Options=/MININT + +[LiveCD_Debug] +BootType=Windows2003 +SystemPath=\livecd\reactos +Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT + +[LiveCD_Screen] +BootType=Windows2003 +SystemPath=\livecd\reactos +Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT + +[LiveCD_LogFile] +BootType=Windows2003 +SystemPath=\livecd\reactos +Options=/DEBUG /DEBUGPORT=FILE:\Device\HarddiskX\PartitionY\debug.log /SOS /MININT + +[LiveCD_RamDisk] +BootType=Windows2003 +SystemPath=ramdisk(0)\reactos +Options=/MININT /RDPATH=livecd.iso /RDEXPORTASCD + +[LiveCD_RamDisk_Debug] +BootType=Windows2003 +SystemPath=ramdisk(0)\reactos +Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT /RDPATH=livecd.iso /RDEXPORTASCD + +[LiveCD_RamDisk_Screen] +BootType=Windows2003 +SystemPath=ramdisk(0)\reactos +Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT /RDPATH=livecd.iso /RDEXPORTASCD diff --git a/reactos/boot/freeldr/bootsect/CMakeLists.txt b/reactos/boot/freeldr/bootsect/CMakeLists.txt index 881c84d5712..4f71434d42f 100644 --- a/reactos/boot/freeldr/bootsect/CMakeLists.txt +++ b/reactos/boot/freeldr/bootsect/CMakeLists.txt @@ -11,7 +11,7 @@ if(ARCH STREQUAL "i386" OR ARCH STREQUAL "amd64") add_cd_file(TARGET dosmbr DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin FOR all) add_cd_file(TARGET fat32 DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin FOR all) add_cd_file(TARGET fat DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/fat.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 isoboot DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin FOR all hybridcd) add_cd_file(TARGET isobtrt DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin FOR all) add_cd_file(TARGET ext2 DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin FOR all) diff --git a/reactos/boot/freeldr/freeldr/CMakeLists.txt b/reactos/boot/freeldr/freeldr/CMakeLists.txt index 0cb80c7993f..02ab0c4b563 100644 --- a/reactos/boot/freeldr/freeldr/CMakeLists.txt +++ b/reactos/boot/freeldr/freeldr/CMakeLists.txt @@ -236,7 +236,7 @@ add_custom_target(freeldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys) # rename freeldr on livecd to setupldr.sys because isoboot.bin looks for setupldr.sys add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR bootcd regtest) -add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR livecd NAME_ON_CD setupldr.sys) +add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR livecd hybridcd NAME_ON_CD setupldr.sys) concatenate_files( ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin diff --git a/reactos/cmake/CMakeMacros.cmake b/reactos/cmake/CMakeMacros.cmake index 85eff72da34..da6a9bd52d5 100644 --- a/reactos/cmake/CMakeMacros.cmake +++ b/reactos/cmake/CMakeMacros.cmake @@ -286,8 +286,10 @@ function(add_cd_file) endif() #do we add it to all CDs? - if(_CD_FOR STREQUAL all) - set(_CD_FOR "bootcd;livecd;regtest") + list(FIND _CD_FOR all __cd) + if(NOT __cd EQUAL -1) + list(REMOVE_AT _CD_FOR __cd) + list(INSERT _CD_FOR __cd "bootcd;livecd;regtest") endif() #do we add it to bootcd? @@ -304,6 +306,8 @@ function(add_cd_file) get_filename_component(__file ${item} NAME) endif() set_property(GLOBAL APPEND PROPERTY BOOTCD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}") + #add it also into the hybridcd + set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "bootcd/${_CD_DESTINATION}/${__file}=${item}") endforeach() if(_CD_TARGET) #manage dependency @@ -339,9 +343,25 @@ function(add_cd_file) get_filename_component(__file ${item} NAME) endif() set_property(GLOBAL APPEND PROPERTY LIVECD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}") + #add it also into the hybridcd + set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "livecd/${_CD_DESTINATION}/${__file}=${item}") endforeach() endif() #end livecd + #do we need also to add it to hybridcd? + list(FIND _CD_FOR hybridcd __cd) + if(NOT __cd EQUAL -1) + foreach(item ${_CD_FILE}) + if(_CD_NAME_ON_CD) + #rename it in the cd tree + set(__file ${_CD_NAME_ON_CD}) + else() + get_filename_component(__file ${item} NAME) + endif() + set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}") + endforeach() + endif() #end hybridcd + #do we add it to regtest? list(FIND _CD_FOR regtest __cd) if(NOT __cd EQUAL -1) @@ -397,6 +417,11 @@ function(create_iso_lists) DESTINATION reactos NO_CAB FOR bootcd regtest) + add_cd_file( + FILE ${CMAKE_CURRENT_BINARY_DIR}/livecd.iso + DESTINATION root + FOR hybridcd) + get_property(_filelist GLOBAL PROPERTY BOOTCD_FILE_LIST) string(REPLACE ";" "\n" _filelist "${_filelist}") file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.lst "${_filelist}") @@ -407,6 +432,11 @@ function(create_iso_lists) file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.lst "${_filelist}") unset(_filelist) + get_property(_filelist GLOBAL PROPERTY HYBRIDCD_FILE_LIST) + string(REPLACE ";" "\n" _filelist "${_filelist}") + file(APPEND ${REACTOS_BINARY_DIR}/boot/hybridcd.lst "${_filelist}") + unset(_filelist) + get_property(_filelist GLOBAL PROPERTY BOOTCDREGTEST_FILE_LIST) string(REPLACE ";" "\n" _filelist "${_filelist}") file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcdregtest.lst "${_filelist}")