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