From 80abc9a90788515d15ffbacacdc0c2f6b36e097b Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 27 Oct 2018 16:57:35 -0400 Subject: [PATCH] build: Restore a mechanism to build EFI-less anyboots and CDs. This fixes the 32-bit build following the merge of multiple bootloaders support. Fixes #14656. --- build/jam/ArchitectureRules | 1 + build/jam/ImageRules | 16 +++++++++++++--- build/jam/images/AnybootImage | 1 - build/jam/images/CDBootImage | 7 ++++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules index c153a6d131..0c8e93be92 100644 --- a/build/jam/ArchitectureRules +++ b/build/jam/ArchitectureRules @@ -284,6 +284,7 @@ rule KernelArchitectureSetup architecture case x86 : HAIKU_KERNEL_PLATFORM ?= bios_ia32 ; HAIKU_BOOT_TARGETS += bios_ia32 pxe_ia32 ; + HAIKU_ANYBOOT_LEGACY = 1 ; HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB # offset in floppy image (>= sizeof(haiku_loader)) diff --git a/build/jam/ImageRules b/build/jam/ImageRules index fcc22cd954..bd1b1ce825 100644 --- a/build/jam/ImageRules +++ b/build/jam/ImageRules @@ -1550,12 +1550,22 @@ rule BuildCDBootImage image : bootfloppy : bootefi : extrafiles Depends $(image) : $(bootefi) ; Depends $(image) : $(extrafiles) ; BOOTIMG on $(image) = $(bootfloppy) ; - BOOTEFI on $(image) = $(bootefi) ; - BuildCDBootImage1 $(image) : $(bootfloppy) $(bootefi) $(extrafiles) ; + if $(HAIKU_ANYBOOT_LEGACY) = 1 { + BuildCDBootImageMBR $(image) : $(bootfloppy) $(extrafiles) ; + } else { + BOOTEFI on $(image) = $(bootefi) ; + BuildCDBootImageEFI $(image) : $(bootfloppy) $(bootefi) $(extrafiles) ; + } } -actions BuildCDBootImage1 +actions BuildCDBootImageMBR +{ + $(RM) $(<) + mkisofs -b $(BOOTIMG) -r -J -V bootimg -o $(<) $(>[1]) $(>[2-]) +} + +actions BuildCDBootImageEFI { $(RM) $(<) mkisofs -b $(BOOTIMG) -eltorito-alt-boot -no-emul-boot -e $(BOOTEFI) -r -J -V bootimg -o $(<) $(>[1]) $(>[2]) $(>[3-]) diff --git a/build/jam/images/AnybootImage b/build/jam/images/AnybootImage index ebb3c4aef6..6994bcbf59 100644 --- a/build/jam/images/AnybootImage +++ b/build/jam/images/AnybootImage @@ -42,7 +42,6 @@ MakeLocate $(baseMBR) : $(HAIKU_OUTPUT_DIR) ; MakeLocate $(HAIKU_ANYBOOT) : $(HAIKU_ANYBOOT_DIR) ; if $(HAIKU_ANYBOOT_LEGACY) = 1 { - Echo "HAIKU_ANYBOOT_LEGACY defined so anyboot is MBR only" ; BuildAnybootImage $(HAIKU_ANYBOOT) : $(baseMBR) : $(HAIKU_CD_BOOT_IMAGE) : $(HAIKU_IMAGE_NAME) ; } else { diff --git a/build/jam/images/CDBootImage b/build/jam/images/CDBootImage index fd9746ff8e..6832e7ab49 100644 --- a/build/jam/images/CDBootImage +++ b/build/jam/images/CDBootImage @@ -27,13 +27,18 @@ if $(TARGET_ARCH) = ppc { 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 ] ; } else { 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 ] ; }