https://git.reactos.org/?p=reactos.git;a=commitdiff;h=27c0f0e72de8ee8c5cf12…
commit 27c0f0e72de8ee8c5cf12492fd43b007dd52c60a
Author: Dmitry Borisov <di.sean(a)protonmail.com>
AuthorDate: Fri May 19 00:05:50 2023 +0600
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu May 18 20:05:50 2023 +0200
[FREELDR] Fix builds for PC-98 and Xbox platforms (#5275)
Fix broken build after UEFI support merge.
Addendum to commit 150f72127.
CORE-11954, CORE-16216, CORE-17977
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
---
boot/boot_images.cmake | 56 ++++++++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 20 deletions(-)
diff --git a/boot/boot_images.cmake b/boot/boot_images.cmake
index 6ceb37fee73..877cf28bb4a 100644
--- a/boot/boot_images.cmake
+++ b/boot/boot_images.cmake
@@ -4,7 +4,9 @@
if(ARCH STREQUAL "amd64")
set(EFI_PLATFORM_ID "x64")
elseif(ARCH STREQUAL "i386")
- set(EFI_PLATFORM_ID "ia32")
+ if(NOT (SARCH STREQUAL "pc98" OR SARCH STREQUAL "xbox"))
+ set(EFI_PLATFORM_ID "ia32")
+ endif()
elseif(ARCH STREQUAL "ia64")
set(EFI_PLATFORM_ID "ia64")
elseif(ARCH STREQUAL "arm")
@@ -15,11 +17,17 @@ else()
message(FATAL_ERROR "Unknown ARCH '" ${ARCH} "', cannot
generate a valid UEFI boot filename.")
endif()
-add_custom_target(efisys
- 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:uefildr> EFI/BOOT/boot${EFI_PLATFORM_ID}.efi
- DEPENDS native-fatten fat uefildr
- VERBATIM)
+if(DEFINED EFI_PLATFORM_ID)
+ add_custom_target(efisys
+ 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:uefildr>
EFI/BOOT/boot${EFI_PLATFORM_ID}.efi
+ DEPENDS native-fatten fat uefildr
+ VERBATIM)
+endif()
+# ISO image EFI boot parameters
+set(ISO_EFI_BOOT_PARAMS)
# Create an 'empty' directory (guaranteed to be empty) to be able to add
# arbitrary empty directories to the ISO image using mkisofs.
@@ -29,7 +37,10 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty)
set(_isombr_file ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isombr.bin) #
get_target_property(_isombr_file isombr LOCATION)
set(_isoboot_file ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin) #
get_target_property(_isoboot_file isoboot LOCATION)
set(_isobtrt_file ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isobtrt.bin) #
get_target_property(_isobtrt_file isobtrt LOCATION)
-set(_efisys_file ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin) #
get_target_property(_efisys_file efisys LOCATION)
+if(DEFINED EFI_PLATFORM_ID)
+ set(_efisys_file ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin) #
get_target_property(_efisys_file efisys LOCATION)
+ list(APPEND ISO_EFI_BOOT_PARAMS -eltorito-alt-boot -eltorito-platform efi
-eltorito-boot loader/efisys.bin -no-emul-boot)
+endif()
# Create a mkisofs sort file to specify an explicit ordering for the boot files
# to place them at the beginning of the image (makes ISO image analysis easier).
@@ -46,12 +57,15 @@ set(_efisys_file ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin) #
get_target_property(
# - since its contents are included by mkisofs in the root of the ISO image,
# using the empty directory ensures that no extra unwanted files are added.
#
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort "\
+set(ISO_SORT_FILE_DATA "\
${CMAKE_CURRENT_BINARY_DIR}/empty/boot.catalog 4
${_isoboot_file} 3
${_isobtrt_file} 2
-${_efisys_file} 1
")
+if(DEFINED EFI_PLATFORM_ID)
+ string(APPEND ISO_SORT_FILE_DATA "${_efisys_file} 1\n")
+endif()
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort ${ISO_SORT_FILE_DATA})
# ISO image identifier names
set(ISO_MANUFACTURER "ReactOS Project") # For both the publisher and the
preparer
@@ -100,7 +114,7 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcd.cmake.lst
"${CMAKE_CURRENT_BINARY_
add_custom_target(bootcd
COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcd.iso -iso-level 4
-publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid
${ISO_VOLNAME} -volset ${ISO_VOLNAME}
- -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
+ -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4
${ISO_EFI_BOOT_PARAMS} -hide boot.catalog
-sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort
-no-cache-inodes -graft-points -path-list
${CMAKE_CURRENT_BINARY_DIR}/bootcd.$<CONFIG>.lst
COMMAND native-isohybrid -b ${_isombr_file} -t 0x96
${REACTOS_BINARY_DIR}/bootcd.iso
@@ -115,7 +129,7 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.cmake.lst
"${CMAKE_CURRENT_
add_custom_target(bootcdregtest
COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/bootcdregtest.iso -iso-level
4
-publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid
${ISO_VOLNAME} -volset ${ISO_VOLNAME}
- -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
+ -eltorito-boot loader/isobtrt.bin -no-emul-boot -boot-load-size 4
${ISO_EFI_BOOT_PARAMS} -hide boot.catalog
-sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort
-no-cache-inodes -graft-points -path-list
${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.$<CONFIG>.lst
COMMAND native-isohybrid -b ${_isombr_file} -t 0x96
${REACTOS_BINARY_DIR}/bootcdregtest.iso
@@ -134,7 +148,7 @@ add_user_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake.lst
"Profiles" "D
add_custom_target(livecd
COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/livecd.iso -iso-level 4
-publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid
${ISO_VOLNAME} -volset ${ISO_VOLNAME}
- -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
+ -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4
${ISO_EFI_BOOT_PARAMS} -hide boot.catalog
-sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort
-no-cache-inodes -graft-points -path-list
${CMAKE_CURRENT_BINARY_DIR}/livecd.$<CONFIG>.lst
COMMAND native-isohybrid -b ${_isombr_file} -t 0x96
${REACTOS_BINARY_DIR}/livecd.iso
@@ -153,19 +167,21 @@ add_user_profile_dirs(${CMAKE_CURRENT_BINARY_DIR}/hybridcd.cmake.lst
"livecd/Pro
add_custom_target(hybridcd
COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/hybridcd.iso -iso-level 4
-publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid
${ISO_VOLNAME} -volset ${ISO_VOLNAME}
- -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
+ -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4
${ISO_EFI_BOOT_PARAMS} -hide boot.catalog
-sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort
-duplicates-once -no-cache-inodes -graft-points -path-list
${CMAKE_CURRENT_BINARY_DIR}/hybridcd.$<CONFIG>.lst
COMMAND native-isohybrid -b ${_isombr_file} -t 0x96
${REACTOS_BINARY_DIR}/hybridcd.iso
DEPENDS bootcd livecd
VERBATIM)
-# For things like flashing USB drives, we also add the efi file into efi/boot.
-add_cd_file(TARGET efisys FILE ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin DESTINATION loader
NO_CAB NOT_IN_HYBRIDCD FOR bootcd regtest livecd hybridcd)
+if(DEFINED EFI_PLATFORM_ID)
+ # For things like flashing USB drives, we also add the efi file into efi/boot.
+ add_cd_file(TARGET efisys FILE ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin DESTINATION
loader NO_CAB NOT_IN_HYBRIDCD FOR bootcd regtest livecd hybridcd)
-add_cd_file(
- TARGET uefildr
- DESTINATION efi/boot
- NO_CAB
- NAME_ON_CD boot${EFI_PLATFORM_ID}.efi
- FOR livecd hybridcd)
+ add_cd_file(
+ TARGET uefildr
+ DESTINATION efi/boot
+ NO_CAB
+ NAME_ON_CD boot${EFI_PLATFORM_ID}.efi
+ FOR livecd hybridcd)
+endif()