From 768f6b3bc48e139523d5a7c35a148f460dae6a74 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 13 Mar 2020 19:28:22 +0100 Subject: [PATCH] Fix build for non-EFI architectures. Change-Id: Ic2c8a9a64e63f4b844e964eb1066291d2edda7b3 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2343 Reviewed-by: Adrien Destugues --- build/jam/images/AnybootImage | 29 +++++++++++++++++++---------- build/jam/images/CDBootImage | 35 ++++++++++++++++++++++------------- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/build/jam/images/AnybootImage b/build/jam/images/AnybootImage index 6994bcbf59..e3d1e660e6 100644 --- a/build/jam/images/AnybootImage +++ b/build/jam/images/AnybootImage @@ -41,16 +41,25 @@ BuildMBR $(baseMBR) : $(mbrSource) ; MakeLocate $(baseMBR) : $(HAIKU_OUTPUT_DIR) ; MakeLocate $(HAIKU_ANYBOOT) : $(HAIKU_ANYBOOT_DIR) ; -if $(HAIKU_ANYBOOT_LEGACY) = 1 { - BuildAnybootImage $(HAIKU_ANYBOOT) : $(baseMBR) : $(HAIKU_CD_BOOT_IMAGE) - : $(HAIKU_IMAGE_NAME) ; -} else { - local efiLoader = haiku_loader.efi ; - local efiPartition = esp.image ; - MakeLocate $(efiPartition) ; - BuildEfiSystemPartition $(efiPartition) : $(efiLoader) ; - BuildAnybootImageEfi $(HAIKU_ANYBOOT) : $(baseMBR) : $(efiPartition) : $(HAIKU_CD_BOOT_IMAGE) - : $(HAIKU_IMAGE_NAME) ; +# Currently the Anyboot image is available only for EFI+BIOS or BIOS-only +# systems. It is not needed for other systems, where usually you can boot +# the same way from an USB or CD drive, instead of needing completely +# different layouts. +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + if $(TARGET_BOOT_PLATFORM) = efi { + local efiLoader = haiku_loader.efi ; + local efiPartition = esp.image ; + MakeLocate $(efiPartition) ; + BuildEfiSystemPartition $(efiPartition) : $(efiLoader) ; + BuildAnybootImageEfi $(HAIKU_ANYBOOT) : $(baseMBR) + : $(efiPartition) : $(HAIKU_CD_BOOT_IMAGE) + : $(HAIKU_IMAGE_NAME) ; + } else if $(HAIKU_ANYBOOT_LEGACY) = 1 { + BuildAnybootImage $(HAIKU_ANYBOOT) : $(baseMBR) + : $(HAIKU_CD_BOOT_IMAGE) : $(HAIKU_IMAGE_NAME) ; + } + } } # TODO: this one seems to cause the build to fail each other run (caching?) diff --git a/build/jam/images/CDBootImage b/build/jam/images/CDBootImage index c956f324af..0823bcdfb3 100644 --- a/build/jam/images/CDBootImage +++ b/build/jam/images/CDBootImage @@ -13,6 +13,7 @@ NotFile $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) ; # common extra files to put on the boot iso local extras = README.html ; +SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; if $(TARGET_ARCH) = ppc { local elfloader = boot_loader_openfirmware ; @@ -24,23 +25,31 @@ if $(TARGET_ARCH) = ppc { # HFS creator and application type mapping for mkisofs local hfsmaps = hfs.map ; - SEARCH on $(chrpscript) $(hfsmaps) $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; + SEARCH on $(chrpscript) $(hfsmaps) $(extras) + = [ FDirName $(HAIKU_TOP) data boot_cd ] ; - BuildCDBootPPCImage $(HAIKU_CD_BOOT_IMAGE) : $(hfsmaps) : $(elfloader) : $(coffloader) : $(chrpscript) : $(extras) ; -} else if $(HAIKU_ANYBOOT_LEGACY) = 1 { - BuildCDBootImage $(HAIKU_CD_BOOT_IMAGE) : $(HAIKU_BOOT_FLOPPY) : : $(extras) ; - - SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; + BuildCDBootPPCImage $(HAIKU_CD_BOOT_IMAGE) : $(hfsmaps) + : $(elfloader) : $(coffloader) : $(chrpscript) : $(extras) ; } else { - local efiLoader = haiku_loader.efi ; - local efiPartition = esp.image ; - MakeLocate $(efiPartition) : $(HAIKU_OUTPUT_DIR) ; - BuildEfiSystemPartition $(efiPartition) : $(efiLoader) ; + # For other platforms, we have to check which bootloader is used. There + # can be multiple ones, making this a bit confusing. + for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + if $(TARGET_BOOT_PLATFORM) = efi { + local efiLoader = haiku_loader.efi ; + local efiPartition = esp.image ; + MakeLocate $(efiPartition) : $(HAIKU_OUTPUT_DIR) ; + BuildEfiSystemPartition $(efiPartition) : $(efiLoader) ; - BuildCDBootImage $(HAIKU_CD_BOOT_IMAGE) : $(HAIKU_BOOT_FLOPPY) - : $(efiPartition) : $(extras) ; + BuildCDBootImage $(HAIKU_CD_BOOT_IMAGE) : $(HAIKU_BOOT_FLOPPY) + : $(efiPartition) : $(extras) ; - SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; + } else if $(HAIKU_ANYBOOT_LEGACY) = 1 { + BuildCDBootImage $(HAIKU_CD_BOOT_IMAGE) : $(HAIKU_BOOT_FLOPPY) : + : $(extras) ; + } + } + } } NotFile haiku-boot-cd ;