1## efisys.bin 2 3# EFI platform ID, used in environ/CMakelists.txt for bootmgfw filename naming also. 4if(ARCH STREQUAL "amd64") 5 set(EFI_PLATFORM_ID "x64") 6elseif(ARCH STREQUAL "i386") 7 set(EFI_PLATFORM_ID "ia32") 8elseif(ARCH STREQUAL "ia64") 9 set(EFI_PLATFORM_ID "ia64") 10elseif(ARCH STREQUAL "arm") 11 set(EFI_PLATFORM_ID "arm") 12elseif(ARCH STREQUAL "aarch64") 13 set(EFI_PLATFORM_ID "aa64") 14else() 15 message(FATAL_ERROR "Unknown ARCH '" ${ARCH} "', cannot generate a valid UEFI boot filename.") 16endif() 17 18add_custom_target(efisys 19 COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 EFIBOOT -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.efi 20 DEPENDS native-fatten fat bootmgfw 21 VERBATIM) 22 23 24# Create an 'empty' directory (guaranteed to be empty) to be able to add 25# arbitrary empty directories to the ISO image using mkisofs. 26file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty) 27 28# Retrieve the full paths to the generated files of the 'isombr', 'isoboot', 'isobtrt' and 'efisys' targets 29set(_isombr_file ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isombr.bin) # get_target_property(_isombr_file isombr LOCATION) 30set(_isoboot_file ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin) # get_target_property(_isoboot_file isoboot LOCATION) 31set(_isobtrt_file ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isobtrt.bin) # get_target_property(_isobtrt_file isobtrt LOCATION) 32set(_efisys_file ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin) # get_target_property(_efisys_file efisys LOCATION) 33 34# Create a mkisofs sort file to specify an explicit ordering for the boot files 35# to place them at the beginning of the image (makes ISO image analysis easier). 36# See mkisofs/schilytools/mkisofs/README.sort for more details. 37# As the default file sort weight is '0', give the boot files sort weights >= 1. 38# Note that it is sad that '-sort' does not work using grafted points, and as a 39# result we need in particular to use the boot catalog file "path" mkisofs that 40# mkisofs expects, that is, the boot catalog file name is appended to the first 41# host-system path listed in the file list, whatever it is, and that does not 42# work well if the first item is a graft point (and especially if it's a file 43# and not a directory). To fix that, the trick is to use as the first file item 44# the empty directory created earlier. This ensures that: 45# - the boot catalog file path is meaningful; 46# - since its contents are included by mkisofs in the root of the ISO image, 47# using the empty directory ensures that no extra unwanted files are added. 48# 49file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort "\ 50${CMAKE_CURRENT_BINARY_DIR}/empty/boot.catalog 4 51${_isoboot_file} 3 52${_isobtrt_file} 2 53${_efisys_file} 1 54") 55 56# ISO image identifier names 57set(ISO_MANUFACTURER "ReactOS Foundation") # For both the publisher and the preparer 58set(ISO_VOLNAME "ReactOS") # For both the Volume ID and the Volume set ID 59 60 61# Create user profile directories in the LiveImage 62function(add_allusers_profile_dirs _image_filelist _rootdir) 63 file(APPEND ${_image_filelist} "${_rootdir}/All Users/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 64 file(APPEND ${_image_filelist} "${_rootdir}/All Users/Documents/My Music=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 65 file(APPEND ${_image_filelist} "${_rootdir}/All Users/Documents/My Pictures=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 66 file(APPEND ${_image_filelist} "${_rootdir}/All Users/Documents/My Videos=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 67 file(APPEND ${_image_filelist} "${_rootdir}/All Users/Favorites=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 68 file(APPEND ${_image_filelist} "${_rootdir}/All Users/My Documents=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 69 file(APPEND ${_image_filelist} "${_rootdir}/All Users/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 70 file(APPEND ${_image_filelist} "${_rootdir}/All Users/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 71endfunction() 72function(add_user_profile_dirs _image_filelist _rootdir _username) 73 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 74 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Application Data/Microsoft/Internet Explorer/Quick Launch=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 75 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Cookies=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 76 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Desktop=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 77 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Favorites=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 78 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Local Settings/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 79 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Local Settings/History=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 80 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Local Settings/Temporary Internet Files=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 81 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/My Music=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 82 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/My Pictures=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 83 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/My Videos=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 84 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/NetHood=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 85 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/PrintHood=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 86 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Recent=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 87 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/SendTo=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 88 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 89 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/Administrative Tools=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 90 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 91 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty\n") 92endfunction() 93 94 95## BootCD 96# Create the file list 97file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcd.cmake.lst "") 98file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcd.cmake.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") 99 100add_custom_target(bootcd 101 COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcd.iso -iso-level 4 102 -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid ${ISO_VOLNAME} -volset ${ISO_VOLNAME} 103 -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog 104 -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort 105 -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcd.$<CONFIG>.lst 106 COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/bootcd.iso 107 DEPENDS isombr native-isohybrid native-mkisofs 108 VERBATIM) 109 110## BootCDRegTest 111# Create the file list 112file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.cmake.lst "") 113file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.cmake.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") 114 115add_custom_target(bootcdregtest 116 COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcdregtest.iso -iso-level 4 117 -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid ${ISO_VOLNAME} -volset ${ISO_VOLNAME} 118 -eltorito-boot loader/isobtrt.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog 119 -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort 120 -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.$<CONFIG>.lst 121 COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/bootcdregtest.iso 122 DEPENDS isombr native-isohybrid native-mkisofs 123 VERBATIM) 124 125## LiveCD 126# Create the file list 127file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst "") 128file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") 129 130# Create user profile directories 131add_allusers_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst "Profiles") 132add_user_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst "Profiles" "Default User") 133 134add_custom_target(livecd 135 COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/livecd.iso -iso-level 4 136 -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid ${ISO_VOLNAME} -volset ${ISO_VOLNAME} 137 -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog 138 -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort 139 -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/livecd.$<CONFIG>.lst 140 COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/livecd.iso 141 DEPENDS isombr native-isohybrid native-mkisofs 142 VERBATIM) 143 144## HybridCD 145# Create the file list 146file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst "") 147file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") 148 149# Create user profile directories 150add_allusers_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst "livecd/Profiles") 151add_user_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst "livecd/Profiles" "Default User") 152 153add_custom_target(hybridcd 154 COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/hybridcd.iso -iso-level 4 155 -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid ${ISO_VOLNAME} -volset ${ISO_VOLNAME} 156 -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog 157 -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort 158 -duplicates-once -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.$<CONFIG>.lst 159 COMMAND native-isohybrid -b ${_isombr_file} -t 0x96 ${REACTOS_BINARY_DIR}/hybridcd.iso 160 DEPENDS bootcd livecd 161 VERBATIM) 162 163add_cd_file(TARGET efisys FILE ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR bootcd regtest livecd hybridcd) 164 165add_subdirectory(freeldr) 166add_subdirectory(bootdata) 167add_subdirectory(environ) 168