From 1f96a3cbde8cddbc9c874e161615df2edfef98d1 Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Mon, 8 Oct 2018 19:28:00 -0500 Subject: [PATCH] system/boot: Add support for multiple bootloaders --- build/jam/ArchitectureRules | 102 ++++--- build/jam/BootRules | 101 ++++++- build/jam/BuildSetup | 2 +- build/jam/ImageRules | 32 ++- build/jam/board/sam460ex/BoardSetup | 2 +- build/jam/images/AnybootImage | 32 ++- build/jam/images/CDBootImage | 9 +- build/jam/images/FloppyBootImage | 2 +- build/jam/packages/HaikuLoader | 2 +- .../kernel/bluetooth/btCoreData/Jamfile | 4 +- src/add-ons/kernel/bluetooth/hci/Jamfile | 4 +- .../kernel/bus_managers/isa/arch/arm/Jamfile | 1 - .../kernel/bus_managers/isa/arch/m68k/Jamfile | 1 - .../kernel/bus_managers/isa/arch/ppc/Jamfile | 1 - .../kernel/bus_managers/isa/arch/x86/Jamfile | 1 - src/add-ons/kernel/file_cache/Jamfile | 1 - src/bin/makebootable/Jamfile | 4 +- src/system/boot/Jamfile | 184 +++++++------ src/system/boot/arch/x86/Jamfile | 86 +++--- src/system/boot/loader/Jamfile | 260 +++++++++--------- .../loader/file_systems/amiga_ffs/Jamfile | 22 +- .../boot/loader/file_systems/bfs/Jamfile | 33 ++- .../boot/loader/file_systems/fat/Jamfile | 28 +- .../boot/loader/file_systems/hfs_plus/Jamfile | 16 +- .../loader/file_systems/packagefs/Jamfile | 76 ++--- .../boot/loader/file_systems/tarfs/Jamfile | 38 +-- src/system/boot/loader/loader.cpp | 4 +- src/system/boot/loader/net/Jamfile | 46 ++-- src/system/boot/platform/Jamfile | 7 +- src/system/boot/platform/bios_ia32/Jamfile | 77 +++--- .../boot/platform/bios_ia32/stage1.nasm | 5 +- src/system/boot/platform/efi/Jamfile | 32 ++- src/system/boot/platform/generic/Jamfile | 21 +- src/system/boot/platform/pxe_ia32/Jamfile | 49 ++-- src/system/kernel/Jamfile | 8 +- src/system/kernel/device_manager/Jamfile | 1 - src/system/kernel/disk_device_manager/Jamfile | 1 - src/system/kernel/platform/u-boot/Jamfile | 2 +- .../system/kernel/disk_device_manager/Jamfile | 2 +- src/tests/system/kernel/scheduler/Jamfile | 2 +- src/tools/makebootable/Jamfile | 4 +- 41 files changed, 754 insertions(+), 551 deletions(-) diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules index a7db33126d..5c423812b0 100644 --- a/build/jam/ArchitectureRules +++ b/build/jam/ArchitectureRules @@ -239,13 +239,15 @@ rule KernelArchitectureSetup architecture switch $(cpu) { case ppc : - HAIKU_BOOT_PLATFORM ?= openfirmware ; - HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB + HAIKU_KERNEL_PLATFORM ?= openfirmware ; + HAIKU_BOOT_TARGETS += openfirmware ; + HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB # offset in floppy image (>= sizeof(haiku_loader)) HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 384 ; # in kB case arm : - HAIKU_BOOT_PLATFORM ?= u-boot ; + HAIKU_KERNEL_PLATFORM ?= u-boot ; + HAIKU_BOOT_TARGETS += u-boot ; HAIKU_BOOT_SDIMAGE_SIZE ?= 128 ; # SOC's like allwinner need an offset to skip the hardcoded initial loader @@ -269,7 +271,9 @@ rule KernelArchitectureSetup architecture HAIKU_BOOT_LOADER_BASE ?= 0x1000000 ; case x86 : - HAIKU_BOOT_PLATFORM ?= bios_ia32 ; + HAIKU_KERNEL_PLATFORM ?= bios_ia32 ; + HAIKU_BOOT_TARGETS += bios_ia32 pxe_ia32 ; + HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB # offset in floppy image (>= sizeof(haiku_loader)) HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 320 ; # in kB @@ -280,8 +284,10 @@ rule KernelArchitectureSetup architecture } case x86_64 : - # x86_64 completely shares the x86 bootloader. - HAIKU_BOOT_PLATFORM ?= bios_ia32 ; + # x86_64 completely shares the x86 bootloader for MBR. + HAIKU_KERNEL_PLATFORM ?= bios_ia32 ; + HAIKU_BOOT_TARGETS += bios_ia32 efi pxe_ia32 ; + HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB # offset in floppy image (>= sizeof(haiku_loader)) HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 320 ; # in kB @@ -295,8 +301,9 @@ rule KernelArchitectureSetup architecture } case m68k : - HAIKU_BOOT_PLATFORM ?= atari_m68k ; - switch $(HAIKU_BOOT_PLATFORM) { + HAIKU_KERNEL_PLATFORM ?= atari_m68k ; + HAIKU_BOOT_TARGETS += atari_m68k ; + switch $(HAIKU_KERNEL_PLATFORM) { case atari_m68k : { HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB @@ -319,7 +326,7 @@ rule KernelArchitectureSetup architecture # private kernel headers to be used when compiling kernel code HAIKU_PRIVATE_KERNEL_HEADERS = [ PrivateHeaders $(DOT) kernel libroot shared - kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ] + kernel/boot/platform/$(HAIKU_KERNEL_PLATFORM) ] [ ArchHeaders $(HAIKU_KERNEL_ARCH) ] [ FDirName $(HAIKU_COMMON_DEBUG_OBJECT_DIR_$(architecture)) system kernel ] @@ -379,11 +386,8 @@ rule KernelArchitectureSetup architecture HAIKU_KERNEL_C++FLAGS += -mtune=68020-60 ; case x86 : - # EFI Bootloader - if $(HAIKU_BOOT_PLATFORM) = efi { - HAIKU_BOOT_CCFLAGS += -mno-red-zone -maccumulate-outgoing-args ; - HAIKU_BOOT_C++FLAGS += -mno-red-zone -maccumulate-outgoing-args ; - } + HAIKU_KERNEL_CCFLAGS += -march=pentium ; + HAIKU_KERNEL_C++FLAGS += -march=pentium ; case x86_64 : # Kernel lives in the top 2GB of the address space, use kernel code @@ -398,23 +402,6 @@ rule KernelArchitectureSetup architecture HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ; HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ; - # BIOS Bootloader is 32-bit. - if $(HAIKU_BOOT_PLATFORM) = bios_ia32 { - if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 { - HAIKU_BOOT_LINKFLAGS += -m elf_i386 ; - } else { - HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ; - } - HAIKU_BOOT_CCFLAGS += -m32 -march=pentium ; - HAIKU_BOOT_C++FLAGS += -m32 -march=pentium ; - } - - # EFI Bootloader - if $(HAIKU_BOOT_PLATFORM) = efi { - HAIKU_BOOT_CCFLAGS += -mno-red-zone -maccumulate-outgoing-args ; - HAIKU_BOOT_C++FLAGS += -mno-red-zone -maccumulate-outgoing-args ; - } - if x86 in $(HAIKU_ARCHS[2-]) || x86_gcc2 in $(HAIKU_ARCHS[2-]) { Echo "Enable kernel ia32 compatibility" ; HAIKU_KERNEL_DEFINES += _COMPAT_MODE ; @@ -422,15 +409,50 @@ rule KernelArchitectureSetup architecture } } - if $(HAIKU_BOOT_PLATFORM) = efi { - HAIKU_BOOT_CCFLAGS += -fpic -fno-stack-protector -fPIC -fshort-wchar - -Wno-error=unused-variable ; - HAIKU_BOOT_C++FLAGS += -fpic -fno-stack-protector -fPIC -fshort-wchar - -Wno-error=unused-variable ; - HAIKU_BOOT_LDFLAGS = -Bstatic -Bsymbolic -shared -nostdlib -znocombreloc -nostartfiles -no-undefined ; - } else { - HAIKU_BOOT_CCFLAGS += -fno-pic ; - HAIKU_BOOT_C++FLAGS += -fno-pic ; + local bootTarget ; + for bootTarget in $(HAIKU_BOOT_TARGETS) { + switch $(bootTarget) { + case efi : + # efi bootloader is PIC + HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fpic -fno-stack-protector + -fPIC -fshort-wchar -mno-red-zone -maccumulate-outgoing-args + -Wno-error=unused-variable -Wno-error=main ; + HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fpic -fno-stack-protector + -fPIC -fshort-wchar -mno-red-zone -maccumulate-outgoing-args + -Wno-error=unused-variable -Wno-error=main ; + HAIKU_BOOT_$(bootTarget:U)_LDFLAGS = -Bstatic -Bsymbolic + -nostdlib -znocombreloc -nostartfiles -no-undefined ; + case bios_ia32 : + # bios_ia32 is non-PIC + HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fno-pic -march=pentium ; + HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fno-pic -march=pentium ; + if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 { + HAIKU_BOOT_$(bootTarget:U)_LDFLAGS += -m elf_i386 ; + } else { + HAIKU_BOOT_$(bootTarget:U)_LDFLAGS += -m elf_i386_haiku ; + } + if $(gccVersion[1]) >= 3 { + HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -Wno-error=main -m32 ; + HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -Wno-error=main -m32 ; + } + case pxe_ia32 : + # pxe_ia32 is non-PIC + HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fno-pic -march=pentium ; + HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fno-pic -march=pentium ; + if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 { + HAIKU_BOOT_$(bootTarget:U)_LDFLAGS += -m elf_i386 ; + } else { + HAIKU_BOOT_$(bootTarget:U)_LDFLAGS += -m elf_i386_haiku ; + } + if $(gccVersion[1]) >= 3 { + HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -Wno-error=main -m32 ; + HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -Wno-error=main -m32 ; + } + case * : + # all other bootloaders are non-PIC + HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fno-pic -Wno-error=main ; + HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fno-pic -Wno-error=main ; + } } # warning flags diff --git a/build/jam/BootRules b/build/jam/BootRules index 9d9949a934..305ab519be 100644 --- a/build/jam/BootRules +++ b/build/jam/BootRules @@ -1,10 +1,72 @@ +rule MultiBootSubDirSetup bootTargets +{ + local result ; + local bootTarget ; + bootTargets ?= $(HAIKU_BOOT_TARGETS) ; + for bootTarget in $(bootTargets) { + local bootTargetObject = $(bootTarget:G=) ; + result += $(bootTargetObject) ; + + TARGET_BOOT_PLATFORM on $(bootTargetObject) = $(bootTarget) ; + + SOURCE_GRIST on $(bootTargetObject) + = $(SOURCE_GRIST:E=)!$(bootTarget) ; + + HDRGRIST on $(bootTargetObject) + = $(HDRGRIST:E=)!$(bootTarget) ; + + local var ; + for var in TARGET_ARCH { + $(var) on $(architectureObject) = $($(var)_$(architecture)) ; + } + + # Clone the current config variable values and the variables SubDir + # resets. + for var in $(AUTO_SET_UP_CONFIG_VARIABLES) SUBDIR$(SUBDIRRESET) { + $(var) on $(architectureObject) = $($(var)) ; + } + + local hostTarget = HOST TARGET ; + local objectDirVars = + COMMON_ARCH COMMON_DEBUG DEBUG_$(HAIKU_DEBUG_LEVELS) + ; + objectDirVars = + COMMON_PLATFORM_LOCATE_TARGET + $(hostTarget)_$(objectDirVars)_LOCATE_TARGET + LOCATE_TARGET + LOCATE_SOURCE + SEARCH_SOURCE + ; + + for var in $(objectDirVars) { + $(var) on $(bootTargetObject) = ; + } + + on $(bootTargetObject) { + SetupObjectsDir ; + SetupFeatureObjectsDir $(bootTarget) ; + + for var in $(objectDirVars) { + $(var) on $(bootTargetObject) = $($(var)) ; + } + } + } + + return $(result) ; +} + +rule MultiBootGristFiles files +{ + return $(files:G=$(TARGET_BOOT_PLATFORM)) ; +} + rule SetupBoot { # Usage SetupBoot : : ; # # - Ideally sources, otherwise HDRSEARCH can not be - # set for the sources and the sources some header - # dependencies might be missing. + # set for the sources and the sources some header + # dependencies might be missing. local sources = [ FGristFiles $(1) ] ; local objects = $(sources:S=$(SUFOBJ)) ; @@ -19,20 +81,27 @@ rule SetupBoot $(HAIKU_BOOT_C++_HEADERS_DIR_$(TARGET_PACKAGING_ARCH)) ; } + # MultiBootSubDirSetup sets the target boot platform on the target object, + # so this will be correct here in SetupBoot. + # This does mean, however, that MultiBootSubDirSetup needs to be used in + # all Jamfiles for things to work correctly. + # Also means ArchitectureRules need to use platform specific variables, + # rather than the previously generic TARGET_BOOT_CCFLAGS and friends. + local platform = $(TARGET_BOOT_PLATFORM:U) ; local object ; for object in $(objects) { # add boot flags for the object - ObjectCcFlags $(object) : $(TARGET_BOOT_CCFLAGS) $(2) ; - ObjectC++Flags $(object) : $(TARGET_BOOT_C++FLAGS) $(2) ; + ObjectCcFlags $(object) : $(HAIKU_BOOT_CCFLAGS) $(HAIKU_BOOT_$(platform)_CCFLAGS) $(2) ; + ObjectC++Flags $(object) : $(HAIKU_BOOT_C++FLAGS) $(HAIKU_BOOT_$(platform)_C++FLAGS) $(2) ; ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ; - ASFLAGS on $(object) = $(TARGET_BOOT_CCFLAGS) ; + ASFLAGS on $(object) = $(HAIKU_BOOT_$(platform)_CCFLAGS) ; # override warning flags TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCH) on $(object) = $(TARGET_KERNEL_WARNING_CCFLAGS) ; TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCH) on $(object) = $(TARGET_KERNEL_WARNING_C++FLAGS) ; - } + } } rule BootObjects @@ -47,18 +116,20 @@ rule BootLd LINK on $(1) = $(TARGET_LD_$(TARGET_PACKAGING_ARCH)) ; - LINKFLAGS on $(1) = $(TARGET_BOOT_LINKFLAGS) $(4) ; + LINKFLAGS on $(1) = $(HAIKU_BOOT_$(TARGET_BOOT_PLATFORM:U)_LDFLAGS) $(4) ; if $(3) { LINKFLAGS on $(1) += --script=$(3) ; } # Remove any preset LINKLIBS, but link against libgcc.a. Linking against # libsupc++ is opt-out. - local libs ; - if ! [ on $(1) return $(HAIKU_NO_LIBSUPC++) ] { - libs += [ TargetBootLibsupc++ true ] ; - Depends $(1) : [ TargetBootLibsupc++ ] ; + if $(TARGET_BOOT_PLATFORM) != efi { + local libs ; + if ! [ on $(1) return $(HAIKU_NO_LIBSUPC++) ] { + libs += [ TargetBootLibsupc++ true ] ; + Depends $(1) : [ TargetBootLibsupc++ ] ; + } + LINKLIBS on $(1) = $(libs) [ TargetBootLibgcc true ] ; + Depends $(1) : [ TargetBootLibgcc ] ; } - LINKLIBS on $(1) = $(libs) [ TargetBootLibgcc true ] ; - Depends $(1) : [ TargetBootLibgcc ] ; # TODO: Do we really want to invoke SetupBoot here? The objects should # have been compiled with BootObjects anyway, so we're doing that twice. @@ -93,13 +164,13 @@ rule BootMergeObject # : Sources to be compiled. Grist will be added. # : Additional flags for compilation. # : Object files or static libraries to be merged. No grist - # will be added. + # will be added. # SetupBoot $(2) : $(3) ; Objects $(2) ; MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ; - LINKFLAGS on $(1) += $(TARGET_BOOT_LINKFLAGS) ; + LINKFLAGS on $(1) += $(HAIKU_BOOT_$(TARGET_BOOT_PLATFORM:U)_LDFLAGS) ; } rule BootStaticLibrary diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index dea2f61158..41be3402b8 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -656,7 +656,7 @@ for var in $(archDependentBuildVars)_$(TARGET_PACKAGING_ARCHS) { TARGET_BOOT_LIBGCC = $(HAIKU_BOOT_LIBGCC_$(TARGET_PACKAGING_ARCH)) ; TARGET_BOOT_LIBSUPC++ = $(HAIKU_BOOT_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ; -TARGET_BOOT_PLATFORM ?= $(HAIKU_BOOT_PLATFORM) ; +TARGET_KERNEL_PLATFORM ?= $(HAIKU_KERNEL_PLATFORM) ; local architecture ; for architecture in $(TARGET_PACKAGING_ARCHS) { diff --git a/build/jam/ImageRules b/build/jam/ImageRules index 6adef62eb8..fcc22cd954 100644 --- a/build/jam/ImageRules +++ b/build/jam/ImageRules @@ -1492,12 +1492,12 @@ rule BuildFloppyBootImage image : haikuLoader : archive FLOPPY_IMAGE_SIZE on $(image) = $(HAIKU_BOOT_FLOPPY_IMAGE_SIZE) ; ARCHIVE_IMAGE_OFFSET on $(image) = $(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ; BuildFloppyBootImage1 $(image) : $(haikuLoader) $(archive) ; - if $(HAIKU_BOOT_PLATFORM) = atari_m68k { + if $(HAIKU_KERNEL_PLATFORM) = atari_m68k { Depends $(image) : fixup_tos_boot_checksum ; BuildFloppyBootImageFixupM68K $(image) : fixup_tos_boot_checksum ; } - if $(HAIKU_BOOT_PLATFORM) = amiga_m68k { + if $(HAIKU_KERNEL_PLATFORM) = amiga_m68k { Depends $(image) : fixup_amiga_boot_checksum ; BuildFloppyBootImageFixupM68K $(image) : fixup_amiga_boot_checksum ; @@ -1544,20 +1544,21 @@ actions BuildFloppyBootImageFixupM68K #pragma mark - CD Boot Image rules -rule BuildCDBootImage image : bootfloppy : extrafiles +rule BuildCDBootImage image : bootfloppy : bootefi : extrafiles { Depends $(image) : $(bootfloppy) ; + Depends $(image) : $(bootefi) ; Depends $(image) : $(extrafiles) ; BOOTIMG on $(image) = $(bootfloppy) ; + BOOTEFI on $(image) = $(bootefi) ; - BuildCDBootImage1 $(image) : $(bootfloppy) $(extrafiles) ; + BuildCDBootImage1 $(image) : $(bootfloppy) $(bootefi) $(extrafiles) ; } actions BuildCDBootImage1 { $(RM) $(<) - mkisofs -b $(BOOTIMG) -r -J -V bootimg -o $(<) $(>[1]) $(>[2-]) \ - || genisoimage -b $(BOOTIMG) -r -J -V bootimg -o $(<) $(>[1]) $(>[2-]) + mkisofs -b $(BOOTIMG) -eltorito-alt-boot -no-emul-boot -e $(BOOTEFI) -r -J -V bootimg -o $(<) $(>[1]) $(>[2]) $(>[3-]) } @@ -1600,3 +1601,22 @@ actions BuildCDBootPPCImage1 bind MAPS boot/haikuloader.xcf -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd $(RM) -r $(HAIKU_OUTPUT_DIR)/cd } + +#pragma mark - EFI System Partition rules + +rule BuildEfiSystemPartition image : efiLoader +{ + Depends $(image) : $(efiLoader) ; + + BuildEfiSystemPartition1 $(image) : $(efiLoader) ; +} + +actions BuildEfiSystemPartition1 +{ + $(RM) $(<) + dd if=/dev/zero of=$(<) bs=1024 count=2880 + mformat -i $(<) -n 36 -h 2 -t 80 + mmd -D s -i $(<) ::/EFI + mmd -D s -i $(<) ::/EFI/BOOT + mcopy -D o -i $(<) $(>) ::/EFI/BOOT/BOOTX64.EFI +} diff --git a/build/jam/board/sam460ex/BoardSetup b/build/jam/board/sam460ex/BoardSetup index 81423453a8..a84d323ffe 100644 --- a/build/jam/board/sam460ex/BoardSetup +++ b/build/jam/board/sam460ex/BoardSetup @@ -3,7 +3,7 @@ HAIKU_BOARD_DESCRIPTION = "ACube Sam460ex" ; # must force both since they are set before this file is read. -HAIKU_BOOT_PLATFORM = u-boot ; +HAIKU_KERNEL_PLATFORM = u-boot ; #FIXME!!!!!!!!!!!!!!! # diff --git a/build/jam/images/AnybootImage b/build/jam/images/AnybootImage index b1bdca7783..c7a4cf753b 100644 --- a/build/jam/images/AnybootImage +++ b/build/jam/images/AnybootImage @@ -19,13 +19,41 @@ actions BuildAnybootImage1 { $(2[1]) -b $(2[2]) $(2[3]) $(2[4]) $(1) } +rule BuildAnybootImageEfi anybootImage : mbrPart : efiPart : isoPart : imageFile { + local anyboot = anyboot ; + + Depends $(anybootImage) : $(anyboot) ; + Depends $(anybootImage) : $(isoPart) ; + Depends $(anybootImage) : $(mbrPart) ; + Depends $(anybootImage) : $(efiPart) ; + Depends $(anybootImage) : $(imageFile) ; + + BuildAnybootImageEfi1 $(anybootImage) : $(anyboot) $(mbrPart) $(efiPart) $(isoPart) $(imageFile) ; +} + +actions BuildAnybootImageEfi1 { + $(2[1]) -b $(2[2]) -e $(2[3]) $(2[4]) $(2[5]) $(1) +} + local baseMBR = base_mbr.bin ; local mbrSource = [ FDirName $(HAIKU_TOP) src bin writembr mbr.S ] ; BuildMBR $(baseMBR) : $(mbrSource) ; MakeLocate $(baseMBR) : $(HAIKU_OUTPUT_DIR) ; MakeLocate $(HAIKU_ANYBOOT) : $(HAIKU_ANYBOOT_DIR) ; -BuildAnybootImage $(HAIKU_ANYBOOT) : $(baseMBR) : $(HAIKU_CD_BOOT_IMAGE) - : $(HAIKU_IMAGE_NAME) ; + +if $(HAIKU_ANYBOOT_UEFI) = 1 { + Echo "Anyboot is MBR/UEFI hybrid" ; + 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 { + Echo "Anyboot is MBR only" ; + 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?) #RmTemps $(HAIKU_ANYBOOT) : $(baseMBR) ; diff --git a/build/jam/images/CDBootImage b/build/jam/images/CDBootImage index 26ff0f98db..fd9746ff8e 100644 --- a/build/jam/images/CDBootImage +++ b/build/jam/images/CDBootImage @@ -28,9 +28,14 @@ if $(TARGET_ARCH) = ppc { BuildCDBootPPCImage $(HAIKU_CD_BOOT_IMAGE) : $(hfsmaps) : $(elfloader) : $(coffloader) : $(chrpscript) : $(extras) ; } else { - SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; + 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) : $(extras) ; + BuildCDBootImage $(HAIKU_CD_BOOT_IMAGE) : $(HAIKU_BOOT_FLOPPY) : $(efiPartition) : $(extras) ; + + SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; } NotFile haiku-boot-cd ; diff --git a/build/jam/images/FloppyBootImage b/build/jam/images/FloppyBootImage index d5c33e0bde..f95b9c6a25 100644 --- a/build/jam/images/FloppyBootImage +++ b/build/jam/images/FloppyBootImage @@ -169,7 +169,7 @@ Depends haiku-floppyboot-archive : $(HAIKU_FLOPPY_BOOT_ARCHIVE) ; HAIKU_BOOT_FLOPPY = haiku-boot-floppy.image ; MakeLocate $(HAIKU_BOOT_FLOPPY) : $(HAIKU_OUTPUT_DIR) ; -BuildFloppyBootImage $(HAIKU_BOOT_FLOPPY) : haiku_loader +BuildFloppyBootImage $(HAIKU_BOOT_FLOPPY) : haiku_loader.$(HAIKU_KERNEL_PLATFORM) : $(HAIKU_FLOPPY_BOOT_ARCHIVE) ; # remove the archive diff --git a/build/jam/packages/HaikuLoader b/build/jam/packages/HaikuLoader index 31298459a7..5f048b0a80 100644 --- a/build/jam/packages/HaikuLoader +++ b/build/jam/packages/HaikuLoader @@ -3,7 +3,7 @@ HaikuPackage $(haikuLoaderPackage) ; # boot loader -AddFilesToPackage : haiku_loader ; +AddFilesToPackage : haiku_loader.$(HAIKU_KERNEL_PLATFORM) ; # Force no compression, so the stage one loader can directly execute the boot diff --git a/src/add-ons/kernel/bluetooth/btCoreData/Jamfile b/src/add-ons/kernel/bluetooth/btCoreData/Jamfile index 7134dee174..dade358f01 100644 --- a/src/add-ons/kernel/bluetooth/btCoreData/Jamfile +++ b/src/add-ons/kernel/bluetooth/btCoreData/Jamfile @@ -2,11 +2,11 @@ SubDir HAIKU_TOP src add-ons kernel bluetooth btCoreData ; UsePrivateHeaders kernel net bluetooth ; UsePrivateHeaders [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ] ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; +#UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_KERNEL_PLATFORM) ] ; # disable debug output, if debugging is disabled if $(DEBUG) = 0 { - SubDirCcFlags [ FDefines DEBUG_MAX_LEVEL_FLOW=0 DEBUG_MAX_LEVEL_INFO=0 ] ; + SubDirCcFlags [ FDefines DEBUG_MAX_LEVEL_FLOW=0 DEBUG_MAX_LEVEL_INFO=0 ] ; } diff --git a/src/add-ons/kernel/bluetooth/hci/Jamfile b/src/add-ons/kernel/bluetooth/hci/Jamfile index 4a3020cb20..e34ca4fbb8 100644 --- a/src/add-ons/kernel/bluetooth/hci/Jamfile +++ b/src/add-ons/kernel/bluetooth/hci/Jamfile @@ -3,11 +3,11 @@ SubDir HAIKU_TOP src add-ons kernel bluetooth hci ; UsePrivateKernelHeaders ; UsePrivateHeaders net bluetooth ; UsePrivateHeaders [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ] ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; +#UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_KERNEL_PLATFORM) ] ; # disable debug output, if debugging is disabled if $(DEBUG) = 0 { - SubDirCcFlags [ FDefines DEBUG_MAX_LEVEL_FLOW=0 DEBUG_MAX_LEVEL_INFO=0 ] ; + SubDirCcFlags [ FDefines DEBUG_MAX_LEVEL_FLOW=0 DEBUG_MAX_LEVEL_INFO=0 ] ; } KernelAddon hci : diff --git a/src/add-ons/kernel/bus_managers/isa/arch/arm/Jamfile b/src/add-ons/kernel/bus_managers/isa/arch/arm/Jamfile index 12a6b4a5d1..f3168180b8 100644 --- a/src/add-ons/kernel/bus_managers/isa/arch/arm/Jamfile +++ b/src/add-ons/kernel/bus_managers/isa/arch/arm/Jamfile @@ -3,7 +3,6 @@ SubDir HAIKU_TOP src add-ons kernel bus_managers isa arch arm ; SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ; UsePrivateHeaders kernel [ FDirName kernel arch arm ] ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; KernelStaticLibrary isa_arch_bus_manager : isa_dma.c diff --git a/src/add-ons/kernel/bus_managers/isa/arch/m68k/Jamfile b/src/add-ons/kernel/bus_managers/isa/arch/m68k/Jamfile index 2d7030f324..10eb364a7c 100644 --- a/src/add-ons/kernel/bus_managers/isa/arch/m68k/Jamfile +++ b/src/add-ons/kernel/bus_managers/isa/arch/m68k/Jamfile @@ -3,7 +3,6 @@ SubDir HAIKU_TOP src add-ons kernel bus_managers isa arch m68k ; SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ; UsePrivateHeaders kernel [ FDirName kernel arch m68k ] ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; KernelStaticLibrary isa_arch_bus_manager : isa_dma.c diff --git a/src/add-ons/kernel/bus_managers/isa/arch/ppc/Jamfile b/src/add-ons/kernel/bus_managers/isa/arch/ppc/Jamfile index 94ad7cd43c..67f7856312 100644 --- a/src/add-ons/kernel/bus_managers/isa/arch/ppc/Jamfile +++ b/src/add-ons/kernel/bus_managers/isa/arch/ppc/Jamfile @@ -3,7 +3,6 @@ SubDir HAIKU_TOP src add-ons kernel bus_managers isa arch ppc ; SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ; #UsePrivateHeaders kernel [ FDirName kernel arch ppc ] ; -#UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UsePrivateKernelHeaders ; KernelStaticLibrary isa_arch_bus_manager : diff --git a/src/add-ons/kernel/bus_managers/isa/arch/x86/Jamfile b/src/add-ons/kernel/bus_managers/isa/arch/x86/Jamfile index 2618a2e39b..1cbb277eb2 100644 --- a/src/add-ons/kernel/bus_managers/isa/arch/x86/Jamfile +++ b/src/add-ons/kernel/bus_managers/isa/arch/x86/Jamfile @@ -3,7 +3,6 @@ SubDir HAIKU_TOP src add-ons kernel bus_managers isa arch x86 ; SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ; UsePrivateHeaders kernel [ FDirName kernel arch x86 ] ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; KernelStaticLibrary isa_arch_bus_manager : isa_dma.cpp diff --git a/src/add-ons/kernel/file_cache/Jamfile b/src/add-ons/kernel/file_cache/Jamfile index 6d83c5a6d0..7632f2cda1 100644 --- a/src/add-ons/kernel/file_cache/Jamfile +++ b/src/add-ons/kernel/file_cache/Jamfile @@ -2,7 +2,6 @@ SubDir HAIKU_TOP src add-ons kernel file_cache ; UsePrivateKernelHeaders ; UsePrivateHeaders [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ] ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; KernelAddon log : log.cpp diff --git a/src/bin/makebootable/Jamfile b/src/bin/makebootable/Jamfile index 3c1f52a22b..579398dcb8 100644 --- a/src/bin/makebootable/Jamfile +++ b/src/bin/makebootable/Jamfile @@ -1,5 +1,5 @@ SubDir HAIKU_TOP src bin makebootable ; -if $(TARGET_BOOT_PLATFORM) { - SubInclude HAIKU_TOP src bin makebootable platform $(TARGET_BOOT_PLATFORM) ; +if $(TARGET_KERNEL_PLATFORM) { + SubInclude HAIKU_TOP src bin makebootable platform $(TARGET_KERNEL_PLATFORM) ; } diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile index 30fc89178d..39197d36c6 100644 --- a/src/system/boot/Jamfile +++ b/src/system/boot/Jamfile @@ -1,87 +1,9 @@ SubDir HAIKU_TOP src system boot ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - DEFINES += _BOOT_MODE ; -if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) = efi { - SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch - x86_64 ] ; -} else { - SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch - $(TARGET_KERNEL_ARCH) ] ; -} - -SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix string ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix stdlib ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix locale ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) kernel lib ] ; - UsePrivateHeaders [ FDirName libroot locale ] ; -local extraSources = ; -if $(TARGET_GCC_VERSION_$(TARGET_PACKAGING_ARCH)[1]) = 2 { - extraSources += atomic.S ; -} - -BootMergeObject boot_libroot.o : - abs.c - ctype.cpp - LocaleData.cpp - qsort.c - kernel_vsprintf.cpp - memchr.c - memcmp.c - memmove.c - strdup.cpp - strndup.cpp - strlen.cpp - strnlen.cpp - strcmp.c - strcasecmp.c - strncmp.c - strcat.c - strcpy.c - strerror.c - strlcat.c - strlcpy.c - strchr.c - strrchr.c - strtol.c - strtoul.c - $(extraSources) -; - -AddResources haiku_loader : boot_loader.rdef ; - -BootLd boot_loader_$(TARGET_BOOT_PLATFORM) : - boot_platform_$(TARGET_BOOT_PLATFORM).o - boot_arch_$(TARGET_KERNEL_ARCH).o - boot_loader.a - boot_net.a - boot_partitions.a - - # file systems - boot_bfs.a - boot_amiga_ffs.a - boot_tarfs.a - boot_fatfs.a - boot_packagefs.a - - boot_loader.a - # a second time, so undefined references in the file systems can be - # resolved - - # needed by tarfs, packagefs, and video_splash.cpp - boot_zlib.a - - # libroot functions needed by the stage2 boot loader - boot_libroot.o - - : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader_$(TARGET_BOOT_PLATFORM).ld - : $(TARGET_BOOT_LDFLAGS) -; - rule BuildCoffLoader { local coffLoader = $(1) ; local bootLoader = $(2) ; @@ -107,8 +29,6 @@ actions BuildCoffLoader bind HACK_COFF { $(HACK_COFF) $(1) } -BuildCoffLoader boot_loader_$(TARGET_BOOT_PLATFORM)_coff : boot_loader_$(TARGET_BOOT_PLATFORM) ; - rule BuildBiosLoader { local haikuLoader = $(1) ; local bootLoader = $(2) ; @@ -128,11 +48,6 @@ actions BuildBiosLoader { $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O binary $(2) $(1) } -BuildBiosLoader haiku_loader : boot_loader_$(TARGET_BOOT_PLATFORM) ; - -# different target for PXE, to be build with TARGET_BOOT_PLATFORM=pxe_ia32 jam pxehaiku-loader -BuildBiosLoader pxehaiku-loader : boot_loader_$(TARGET_BOOT_PLATFORM) ; - rule BuildEFILoader { local efiLoader = $(1) ; local bootLoader = $(2) ; @@ -147,7 +62,104 @@ actions BuildEFILoader { -j .rel -j .rela -j .reloc --target=efi-app-x86_64 $(2) $(1) } -BuildEFILoader haiku_loader.efi : boot_loader_$(TARGET_BOOT_PLATFORM) ; +local extraSources = ; +if $(TARGET_GCC_VERSION_$(TARGET_PACKAGING_ARCH)[1]) = 2 { + extraSources += atomic.S ; +} + +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) = efi { + SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch + x86_64 ] ; + } else { + SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch + $(TARGET_KERNEL_ARCH) ] ; + } + + SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix string ] ; + SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix stdlib ] ; + SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix locale ] ; + SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) kernel lib ] ; + + BootMergeObject boot_libroot_$(platform:G=).o : + abs.c + ctype.cpp + LocaleData.cpp + qsort.c + kernel_vsprintf.cpp + memchr.c + memcmp.c + memmove.c + strdup.cpp + strndup.cpp + strlen.cpp + strnlen.cpp + strcmp.c + strcasecmp.c + strncmp.c + strcat.c + strcpy.c + strerror.c + strlcat.c + strlcpy.c + strchr.c + strrchr.c + strtol.c + strtoul.c + $(extraSources) + ; + + AddResources haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader.rdef ; + + local archGrist = [ FGrist src system boot arch $(TARGET_KERNEL_ARCH) $(platform:G=) ] ; + local archObject = boot_arch_$(TARGET_KERNEL_ARCH).o ; + local ldflags = $(HAIKU_BOOT_$(platform:G=:U)_LDFLAGS) ; + ldflags ?= $(TARGET_BOOT_LDFLAGS) ; + + # efi loader needs to be shared. + if $(TARGET_BOOT_PLATFORM) = efi { + ldflags += -shared ; + } + + BootLd boot_loader_$(platform:G=) : + boot_platform_$(platform:G=).o + $(archObject:G=$(archGrist)) + [ MultiBootGristFiles + boot_loader.a + boot_net.a + boot_partitions.a + + # file systems + boot_bfs.a + boot_amiga_ffs.a + boot_tarfs.a + boot_fatfs.a + boot_packagefs.a + + boot_loader.a + # a second time, so undefined references in the file systems can be + # resolved + + # needed by tarfs, packagefs, and video_splash.cpp + boot_zlib.a + ] + # libroot functions needed by the stage2 boot loader + boot_libroot_$(platform:G=).o + + : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader_$(platform:G=).ld + : $(ldflags) + ; + + BuildCoffLoader boot_loader_$(TARGET_BOOT_PLATFORM)_coff : boot_loader_$(TARGET_BOOT_PLATFORM) ; + + if $(TARGET_BOOT_PLATFORM) != efi { + BuildBiosLoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ; + } else { + BuildEFILoader haiku_loader.$(TARGET_BOOT_PLATFORM) : boot_loader_$(TARGET_BOOT_PLATFORM) ; + } + } +} SubInclude HAIKU_TOP src system boot arch $(TARGET_KERNEL_ARCH) ; SubInclude HAIKU_TOP src system boot loader ; diff --git a/src/system/boot/arch/x86/Jamfile b/src/system/boot/arch/x86/Jamfile index 1e03bf70bf..8bf9087dab 100644 --- a/src/system/boot/arch/x86/Jamfile +++ b/src/system/boot/arch/x86/Jamfile @@ -1,47 +1,51 @@ SubDir HAIKU_TOP src system boot arch x86 ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; +local platform ; +for platform in [ MultiBootSubDirSetup bios_ia32 efi pxe_ia32 ] { + on $(platform) { + DEFINES += _BOOT_MODE ; -DEFINES += _BOOT_MODE ; + local kernelArchSources = + arch_elf.cpp + ; -local kernelArchSources = - arch_elf.cpp -; + local kernelArchSpecificSources ; + local kernelLibArchSpecificSources ; + if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) = efi { + kernelArchSpecificSources = cpuid.cpp ; + kernelLibArchSpecificSources = arch_string.cpp ; + } else { + kernelArchSpecificSources = cpuid.S ; + kernelLibArchSpecificSources = arch_string.S ; + } -local kernelArchSpecificSources ; -local kernelLibArchSpecificSources ; -if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) = efi { - kernelArchSpecificSources = cpuid.cpp ; - kernelLibArchSpecificSources = arch_string.cpp ; -} else { - kernelArchSpecificSources = cpuid.S ; - kernelLibArchSpecificSources = arch_string.S ; + local librootOsArchSources = + byteorder.S + ; + + BootMergeObject [ FGristFiles boot_arch_$(TARGET_KERNEL_ARCH).o ] : + $(kernelArchSources) + $(kernelArchSpecificSources) + $(kernelLibArchSpecificSources) + $(librootOsArchSources) + : -std=c++11 # additional flags + ; + + SEARCH on [ FGristFiles $(kernelArchSources) ] + = [ FDirName $(HAIKU_TOP) src system kernel arch x86 ] ; + + if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) = efi { + SEARCH on [ FGristFiles $(kernelArchSpecificSources) ] + = [ FDirName $(HAIKU_TOP) src system kernel arch x86 64 ] ; + SEARCH on [ FGristFiles $(kernelLibArchSpecificSources) ] + = [ FDirName $(HAIKU_TOP) src system libroot posix string arch x86_64 ] ; + } else { + SEARCH on [ FGristFiles $(kernelArchSpecificSources) ] + = [ FDirName $(HAIKU_TOP) src system kernel arch x86 32 ] ; + SEARCH on [ FGristFiles $(kernelLibArchSpecificSources) ] + = [ FDirName $(HAIKU_TOP) src system kernel lib arch x86 ] ; + } + SEARCH on [ FGristFiles $(librootOsArchSources) ] + = [ FDirName $(HAIKU_TOP) src system libroot os arch x86 ] ; + } } - -local librootOsArchSources = - byteorder.S -; - -BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o : - $(kernelArchSources) - $(kernelArchSpecificSources) - $(kernelLibArchSpecificSources) - $(librootOsArchSources) -; - -SEARCH on [ FGristFiles $(kernelArchSources) ] - = [ FDirName $(HAIKU_TOP) src system kernel arch x86 ] ; - -if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) = efi { -SEARCH on [ FGristFiles $(kernelArchSpecificSources) ] - = [ FDirName $(HAIKU_TOP) src system kernel arch x86 64 ] ; -SEARCH on [ FGristFiles $(kernelLibArchSpecificSources) ] - = [ FDirName $(HAIKU_TOP) src system libroot posix string arch x86_64 ] ; -} else { -SEARCH on [ FGristFiles $(kernelArchSpecificSources) ] - = [ FDirName $(HAIKU_TOP) src system kernel arch x86 32 ] ; -SEARCH on [ FGristFiles $(kernelLibArchSpecificSources) ] - = [ FDirName $(HAIKU_TOP) src system kernel lib arch x86 ] ; -} -SEARCH on [ FGristFiles $(librootOsArchSources) ] - = [ FDirName $(HAIKU_TOP) src system libroot os arch x86 ] ; diff --git a/src/system/boot/loader/Jamfile b/src/system/boot/loader/Jamfile index b76f85493d..0f4917369a 100644 --- a/src/system/boot/loader/Jamfile +++ b/src/system/boot/loader/Jamfile @@ -1,7 +1,5 @@ SubDir HAIKU_TOP src system boot loader ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems amiga ; SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems apple ; SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems gpt ; @@ -11,142 +9,150 @@ UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName kernel util ] ; UsePrivateHeaders shared storage ; -{ - DEFINES += - _BOOT_MODE - BOOT_ARCH=\\\"$(TARGET_KERNEL_ARCH)\\\" - KMESSAGE_CONTAINER_ONLY +local defines = $(DEFINES) ; - BOOT_SUPPORT_PARTITION_INTEL - - BOOT_SUPPORT_FILE_SYSTEM_BFS - BOOT_SUPPORT_FILE_SYSTEM_TARFS - #BOOT_SUPPORT_FILE_MAP_DISK - BOOT_SUPPORT_FILE_SYSTEM_FAT - ; - - # Add architecture specific partition/file system modules - - switch $(TARGET_KERNEL_ARCH) { - case "ppc" : +local platform ; +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { { + DEFINES = $(defines) ; + DEFINES += - BOOT_SUPPORT_PARTITION_AMIGA - BOOT_SUPPORT_PARTITION_APPLE + _BOOT_MODE + BOOT_ARCH=\\\"$(TARGET_KERNEL_ARCH)\\\" + KMESSAGE_CONTAINER_ONLY - BOOT_SUPPORT_FILE_SYSTEM_AMIGA_FFS + BOOT_SUPPORT_PARTITION_INTEL + + BOOT_SUPPORT_FILE_SYSTEM_BFS + BOOT_SUPPORT_FILE_SYSTEM_TARFS + #BOOT_SUPPORT_FILE_MAP_DISK + BOOT_SUPPORT_FILE_SYSTEM_FAT ; - } - case "x86" : - { - DEFINES += - ALTERNATE_BOOT_ARCH=\\\"x86_64\\\" - BOOT_SUPPORT_ELF64 - BOOT_SUPPORT_PARTITION_EFI + # Add architecture specific partition/file system modules - #BOOT_SUPPORT_FILE_SYSTEM_FAT - ; - if $(HAIKU_BOOT_PLATFORM) = efi { - DEFINES += - _BOOT_PLATFORM_EFI - ; + switch $(TARGET_KERNEL_ARCH) { + case "ppc" : + { + DEFINES += + BOOT_SUPPORT_PARTITION_AMIGA + BOOT_SUPPORT_PARTITION_APPLE + + BOOT_SUPPORT_FILE_SYSTEM_AMIGA_FFS + ; + } + case "x86" : + { + DEFINES += + ALTERNATE_BOOT_ARCH=\\\"x86_64\\\" + BOOT_SUPPORT_ELF64 + + BOOT_SUPPORT_PARTITION_EFI + + #BOOT_SUPPORT_FILE_SYSTEM_FAT + ; + if $(TARGET_BOOT_PLATFORM) = efi { + DEFINES += + _BOOT_PLATFORM_EFI + ; + } + } } + + if $(TARGET_BOOT_PLATFORM) != efi { + DEFINES += BOOT_SUPPORT_ELF32 ; + } + + local kernelC++Header = [ FDirName $(HAIKU_TOP) headers private kernel util + kernel_cpp.h ] ; + + SubDirC++Flags -fno-rtti -include $(kernelC++Header) ; } + + + BootStaticLibrary [ MultiBootGristFiles boot_loader ] : + PathBlacklist.cpp + elf.cpp + heap.cpp + kernel_args.cpp + load_driver_settings.cpp + loader.cpp + main.cpp + menu.cpp + package_support.cpp + pager.cpp + partitions.cpp + RootFileSystem.cpp + stdio.cpp + vfs.cpp + vm.cpp + + # libroot + driver_settings.cpp + + # utils + kernel_cpp.cpp + KMessage.cpp + list.cpp + ring_buffer.cpp + safemode_settings.cpp + StringHash.cpp + + DataIO.cpp + Referenceable.cpp + ; + + # The partition support is built in an extra static library + # so that only the ones that are used will be included. + + BootStaticLibrary [ MultiBootGristFiles boot_partitions ] : + FileMapDisk.cpp + amiga_rdb.cpp + apple.cpp + + efi_gpt.cpp + Header.cpp + crc32.cpp + utility.cpp + + intel.cpp + PartitionMap.cpp + PartitionMapParser.cpp + ; + + # Tell Jam where to find the utility sources + SEARCH on [ FGristFiles kernel_cpp.cpp list.cpp ring_buffer.cpp StringHash.cpp ] + = [ FDirName $(HAIKU_TOP) src system kernel util ] ; + + SEARCH on [ FGristFiles KMessage.cpp ] + = [ FDirName $(HAIKU_TOP) src system kernel messaging ] ; + + SEARCH on [ FGristFiles safemode_settings.cpp ] + = [ FDirName $(HAIKU_TOP) src system kernel debug ] ; + + SEARCH on [ FGristFiles driver_settings.cpp ] + = [ FDirName $(HAIKU_TOP) src system libroot os ] ; + + SEARCH on [ FGristFiles amiga_rdb.cpp ] + = [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems amiga ] ; + + SEARCH on [ FGristFiles apple.cpp ] + = [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems apple ] ; + + SEARCH on [ FGristFiles efi_gpt.cpp Header.cpp crc32.cpp utility.cpp ] + = [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems gpt ] ; + + SEARCH on [ FGristFiles intel.cpp PartitionMap.cpp PartitionMapParser.cpp ] + = [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems intel ] ; + + SEARCH on [ FGristFiles stage2_crt0.S ] + = [ FDirName $(HAIKU_TOP) src system boot arch $(TARGET_KERNEL_ARCH) ] ; + + SEARCH on [ FGristFiles DataIO.cpp Referenceable.cpp ] + = [ FDirName $(HAIKU_TOP) src kits support ] ; } - - if $(HAIKU_BOOT_PLATFORM) != efi { - DEFINES += BOOT_SUPPORT_ELF32 ; - } - - local kernelC++Header = [ FDirName $(HAIKU_TOP) headers private kernel util - kernel_cpp.h ] ; - - SubDirC++Flags -fno-rtti -include $(kernelC++Header) ; } - -BootStaticLibrary boot_loader : - PathBlacklist.cpp - elf.cpp - heap.cpp - kernel_args.cpp - load_driver_settings.cpp - loader.cpp - main.cpp - menu.cpp - package_support.cpp - pager.cpp - partitions.cpp - RootFileSystem.cpp - stdio.cpp - vfs.cpp - vm.cpp - - # libroot - driver_settings.cpp - - # utils - kernel_cpp.cpp - KMessage.cpp - list.cpp - ring_buffer.cpp - safemode_settings.cpp - StringHash.cpp - - DataIO.cpp - Referenceable.cpp - ; - -# The partition support is built in an extra static library -# so that only the ones that are used will be included. - -BootStaticLibrary boot_partitions : - FileMapDisk.cpp - amiga_rdb.cpp - apple.cpp - - efi_gpt.cpp - Header.cpp - crc32.cpp - utility.cpp - - intel.cpp - PartitionMap.cpp - PartitionMapParser.cpp - ; - -# Tell Jam where to find the utility sources -SEARCH on [ FGristFiles kernel_cpp.cpp list.cpp ring_buffer.cpp StringHash.cpp ] - = [ FDirName $(HAIKU_TOP) src system kernel util ] ; - -SEARCH on [ FGristFiles KMessage.cpp ] - = [ FDirName $(HAIKU_TOP) src system kernel messaging ] ; - -SEARCH on [ FGristFiles safemode_settings.cpp ] - = [ FDirName $(HAIKU_TOP) src system kernel debug ] ; - -SEARCH on [ FGristFiles driver_settings.cpp ] - = [ FDirName $(HAIKU_TOP) src system libroot os ] ; - -SEARCH on [ FGristFiles amiga_rdb.cpp ] - = [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems amiga ] ; - -SEARCH on [ FGristFiles apple.cpp ] - = [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems apple ] ; - -SEARCH on [ FGristFiles efi_gpt.cpp Header.cpp crc32.cpp utility.cpp ] - = [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems gpt ] ; - -SEARCH on [ FGristFiles intel.cpp PartitionMap.cpp PartitionMapParser.cpp ] - = [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems intel ] ; - -SEARCH on [ FGristFiles stage2_crt0.S ] - = [ FDirName $(HAIKU_TOP) src system boot arch $(TARGET_KERNEL_ARCH) ] ; - -SEARCH on [ FGristFiles DataIO.cpp Referenceable.cpp ] - = [ FDirName $(HAIKU_TOP) src kits support ] ; - - SubInclude HAIKU_TOP src system boot loader file_systems ; SubInclude HAIKU_TOP src system boot loader net ; diff --git a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile index 7b94061dfd..04e087d7be 100644 --- a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile +++ b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile @@ -1,8 +1,5 @@ SubDir HAIKU_TOP src system boot loader file_systems amiga_ffs ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders kernel storage ; @@ -10,9 +7,16 @@ UsePrivateHeaders kernel storage ; SubDirC++Flags -fno-rtti ; -BootStaticLibrary boot_amiga_ffs : - amiga_ffs.cpp - Volume.cpp - Directory.cpp - File.cpp - ; +local platform ; +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; + + BootStaticLibrary [ MultiBootGristFiles boot_amiga_ffs ] : + amiga_ffs.cpp + Volume.cpp + Directory.cpp + File.cpp + ; + } +} diff --git a/src/system/boot/loader/file_systems/bfs/Jamfile b/src/system/boot/loader/file_systems/bfs/Jamfile index 31e8f291d9..b1c1b546cf 100644 --- a/src/system/boot/loader/file_systems/bfs/Jamfile +++ b/src/system/boot/loader/file_systems/bfs/Jamfile @@ -1,7 +1,5 @@ SubDir HAIKU_TOP src system boot loader file_systems bfs ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - UsePrivateKernelHeaders ; UsePrivateHeaders file_systems shared storage ; @@ -12,18 +10,23 @@ local defines = [ FDefines _BOOT_MODE ] ; SubDirCcFlags $(defines) ; SubDirC++Flags -fno-rtti $(defines) ; -BootStaticLibrary boot_bfs : - bfs.cpp - Directory.cpp - File.cpp - Link.cpp - Stream.cpp - BPlusTree.cpp - QueryParserUtils.cpp - ; +local platform ; +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + BootStaticLibrary [ MultiBootGristFiles boot_bfs ] : + bfs.cpp + Directory.cpp + File.cpp + Link.cpp + Stream.cpp + BPlusTree.cpp + QueryParserUtils.cpp + ; -SEARCH on [ FGristFiles BPlusTree.cpp ] - = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems bfs ] ; + SEARCH on [ FGristFiles BPlusTree.cpp ] + = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems bfs ] ; -SEARCH on [ FGristFiles QueryParserUtils.cpp ] - += [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems shared ] ; + SEARCH on [ FGristFiles QueryParserUtils.cpp ] + += [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems shared ] ; + } +} diff --git a/src/system/boot/loader/file_systems/fat/Jamfile b/src/system/boot/loader/file_systems/fat/Jamfile index 1bd92389b6..25d3d2e83d 100644 --- a/src/system/boot/loader/file_systems/fat/Jamfile +++ b/src/system/boot/loader/file_systems/fat/Jamfile @@ -1,25 +1,23 @@ SubDir HAIKU_TOP src system boot loader file_systems fat ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - -#UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; -#UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; -#UsePrivateHeaders [ FDirName storage ] ; UsePrivateKernelHeaders ; UsePrivateHeaders shared storage ; -#SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_systems fat ; - local defines = [ FDefines _BOOT_MODE ] ; SubDirCcFlags $(defines) ; SubDirC++Flags -fno-rtti $(defines) ; -BootStaticLibrary boot_fatfs : - fatfs.cpp - Volume.cpp - CachedBlock.cpp - Directory.cpp - File.cpp - Stream.cpp - ; +local platform ; +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + BootStaticLibrary [ MultiBootGristFiles boot_fatfs ] : + fatfs.cpp + Volume.cpp + CachedBlock.cpp + Directory.cpp + File.cpp + Stream.cpp + ; + } +} diff --git a/src/system/boot/loader/file_systems/hfs_plus/Jamfile b/src/system/boot/loader/file_systems/hfs_plus/Jamfile index 9fdadd3582..b9e184e874 100644 --- a/src/system/boot/loader/file_systems/hfs_plus/Jamfile +++ b/src/system/boot/loader/file_systems/hfs_plus/Jamfile @@ -1,13 +1,17 @@ SubDir HAIKU_TOP src system boot loader file_systems hfs_plus ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders kernel storage ; SubDirC++Flags -fno-rtti ; -BootStaticLibrary boot_hfs_plus : - hfs_plus.cpp - ; +local platform ; +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; + + BootStaticLibrary [ MultiBootGristFiles boot_hfs_plus ] : + hfs_plus.cpp + ; + } +} diff --git a/src/system/boot/loader/file_systems/packagefs/Jamfile b/src/system/boot/loader/file_systems/packagefs/Jamfile index 8220f1385b..d8115e1d09 100644 --- a/src/system/boot/loader/file_systems/packagefs/Jamfile +++ b/src/system/boot/loader/file_systems/packagefs/Jamfile @@ -1,8 +1,5 @@ SubDir HAIKU_TOP src system boot loader file_systems packagefs ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UsePrivateHeaders kernel shared storage support ; UseBuildFeatureHeaders zlib ; @@ -13,43 +10,48 @@ local kernelC++Header = [ FDirName $(HAIKU_TOP) headers private kernel util SubDirC++Flags -fno-rtti -include $(kernelC++Header) ; -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package ] ; -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg ] ; -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits storage ] ; -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits support ] ; +local platform ; +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; + SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package ] ; + SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg ] ; + SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits storage ] ; + SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits support ] ; -BootStaticLibrary boot_packagefs : - packagefs.cpp - PackageSettingsItem.cpp + BootStaticLibrary [ MultiBootGristFiles boot_packagefs ] : + packagefs.cpp + PackageSettingsItem.cpp - # package kit/hpkg - BlockBufferPool.cpp - BlockBufferPoolImpl.cpp - BlockBufferPoolNoLock.cpp - BufferPool.cpp - PoolBuffer.cpp - DataReader.cpp - ErrorOutput.cpp - FDDataReader.cpp - PackageContentHandler.cpp - PackageData.cpp - PackageDataReader.cpp - PackageEntry.cpp - PackageEntryAttribute.cpp - PackageFileHeapAccessorBase.cpp - PackageFileHeapReader.cpp - PackageReaderImpl.cpp - ReaderImplBase.cpp + # package kit/hpkg + BlockBufferPool.cpp + BlockBufferPoolImpl.cpp + BlockBufferPoolNoLock.cpp + BufferPool.cpp + PoolBuffer.cpp + DataReader.cpp + ErrorOutput.cpp + FDDataReader.cpp + PackageContentHandler.cpp + PackageData.cpp + PackageDataReader.cpp + PackageEntry.cpp + PackageEntryAttribute.cpp + PackageFileHeapAccessorBase.cpp + PackageFileHeapReader.cpp + PackageReaderImpl.cpp + ReaderImplBase.cpp - # storage kit - FdIO.cpp + # storage kit + FdIO.cpp - # support kit - CompressionAlgorithm.cpp - ZlibCompressionAlgorithm.cpp -; - -Includes [ FGristFiles ZlibCompressionAlgorithm.cpp ] - : [ BuildFeatureAttribute zlib : headers ] ; + # support kit + CompressionAlgorithm.cpp + ZlibCompressionAlgorithm.cpp + ; + Includes [ FGristFiles ZlibCompressionAlgorithm.cpp ] + : [ BuildFeatureAttribute zlib : headers ] ; + } +} diff --git a/src/system/boot/loader/file_systems/tarfs/Jamfile b/src/system/boot/loader/file_systems/tarfs/Jamfile index 29de6d32f1..e73602a3b9 100644 --- a/src/system/boot/loader/file_systems/tarfs/Jamfile +++ b/src/system/boot/loader/file_systems/tarfs/Jamfile @@ -1,8 +1,5 @@ SubDir HAIKU_TOP src system boot loader file_systems tarfs ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders kernel shared storage ; @@ -25,21 +22,28 @@ local zlibSources = zutil.c ; -LOCATE on [ FGristFiles $(zlibSources) ] = $(zlibSourceDirectory) ; -Depends [ FGristFiles $(zlibSources) ] - : [ BuildFeatureAttribute zlib : sources ] ; +local platform ; +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; -BootStaticLibrary boot_zlib : - $(zlibSources) - ; + LOCATE on [ FGristFiles $(zlibSources) ] = $(zlibSourceDirectory) ; + Depends [ FGristFiles $(zlibSources) ] + : [ BuildFeatureAttribute zlib : sources ] ; + + BootStaticLibrary [ MultiBootGristFiles boot_zlib ] : + $(zlibSources) + ; -Includes [ FGristFiles tarfs.cpp ] : [ BuildFeatureAttribute zlib : sources ] ; - # Strictly speaking it should be "headers", but the sources contain the - # headers as well and we have already added the sources directory to the - # header search path for the subdirectory. Should building boot_zlib be - # moved to its own directory, this should better be changes as well. + Includes [ FGristFiles tarfs.cpp ] : [ BuildFeatureAttribute zlib : sources ] ; + # Strictly speaking it should be "headers", but the sources contain the + # headers as well and we have already added the sources directory to the + # header search path for the subdirectory. Should building boot_zlib be + # moved to its own directory, this should better be changes as well. -BootStaticLibrary boot_tarfs : - tarfs.cpp - ; + BootStaticLibrary [ MultiBootGristFiles boot_tarfs ] : + tarfs.cpp + ; + } +} diff --git a/src/system/boot/loader/loader.cpp b/src/system/boot/loader/loader.cpp index 2651468c32..bfdd8620d3 100644 --- a/src/system/boot/loader/loader.cpp +++ b/src/system/boot/loader/loader.cpp @@ -260,7 +260,9 @@ load_modules(stage2_args* args, BootVolume& volume) // and now load all partitioning and file system modules // needed to identify the boot volume - if (!gBootVolume.GetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, false)) { + if (!gBootVolume.GetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, false) + && gBootVolume.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT) + != BOOT_METHOD_CD) { // iterate over the mounted volumes and load their file system Partition *partition; if (gRoot->GetPartitionFor(volume.RootDirectory(), &partition) diff --git a/src/system/boot/loader/net/Jamfile b/src/system/boot/loader/net/Jamfile index 5d3fd0e039..4ad60ad070 100644 --- a/src/system/boot/loader/net/Jamfile +++ b/src/system/boot/loader/net/Jamfile @@ -1,28 +1,32 @@ SubDir HAIKU_TOP src system boot loader net ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - -UsePrivateHeaders kernel [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UsePrivateHeaders drivers ; SubDirC++Flags -D_BOOT_MODE -fno-rtti ; -local tcp = ; -local iscsi = ; -if $(TARGET_ARCH) = ppc { - tcp = TCP.cpp ; - iscsi = iSCSITarget.cpp ; -} +local platform ; +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + UsePrivateHeaders kernel [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; -BootStaticLibrary boot_net : - ARP.cpp - ChainBuffer.cpp - Ethernet.cpp - IP.cpp - NetDefs.cpp - NetStack.cpp - RemoteDisk.cpp - UDP.cpp - $(tcp) - $(iscsi) -; + local tcp = ; + local iscsi = ; + if $(TARGET_ARCH) = ppc { + tcp = TCP.cpp ; + iscsi = iSCSITarget.cpp ; + } + + BootStaticLibrary [ MultiBootGristFiles boot_net ] : + ARP.cpp + ChainBuffer.cpp + Ethernet.cpp + IP.cpp + NetDefs.cpp + NetStack.cpp + RemoteDisk.cpp + UDP.cpp + $(tcp) + $(iscsi) + ; + } +} diff --git a/src/system/boot/platform/Jamfile b/src/system/boot/platform/Jamfile index 5821c4e739..397699295f 100644 --- a/src/system/boot/platform/Jamfile +++ b/src/system/boot/platform/Jamfile @@ -1,7 +1,8 @@ SubDir HAIKU_TOP src system boot platform ; -if $(TARGET_BOOT_PLATFORM) { +if $(HAIKU_BOOT_TARGETS) { SubInclude HAIKU_TOP src system boot platform generic ; - SubInclude HAIKU_TOP src system boot platform $(TARGET_BOOT_PLATFORM) ; + for platform in $(HAIKU_BOOT_TARGETS) { + SubInclude HAIKU_TOP src system boot platform $(platform) ; + } } - diff --git a/src/system/boot/platform/bios_ia32/Jamfile b/src/system/boot/platform/bios_ia32/Jamfile index 0822156732..afb2a4febf 100644 --- a/src/system/boot/platform/bios_ia32/Jamfile +++ b/src/system/boot/platform/bios_ia32/Jamfile @@ -1,8 +1,6 @@ SubDir HAIKU_TOP src system boot platform bios_ia32 ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - -SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform $(TARGET_BOOT_PLATFORM) ; +SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform bios_ia32 ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName graphics common ] ; @@ -17,42 +15,49 @@ UsePrivateHeaders [ FDirName storage ] ; SubDirC++Flags $(defines) -fno-rtti ; } -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; +local platform ; +for platform in [ MultiBootSubDirSetup bios_ia32 ] { + on $(platform) { + SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; -BootMergeObject boot_platform_bios_ia32.o : - shell.S - start.cpp - debug.cpp - bios.cpp - bios_asm.S - console.cpp - serial.cpp - devices.cpp - keyboard.cpp - menu.cpp - mmu.cpp - multiboot.cpp - cpu.cpp - acpi.cpp - smp.cpp - smp_trampoline.S - support.S - video.cpp - apm.cpp - hpet.cpp - interrupts.cpp - interrupts_asm.S - long.cpp - long_asm.S + BootMergeObject boot_platform_bios_ia32.o : + shell.S + start.cpp + debug.cpp + bios.cpp + bios_asm.S + console.cpp + serial.cpp + devices.cpp + keyboard.cpp + menu.cpp + mmu.cpp + multiboot.cpp + cpu.cpp + acpi.cpp + smp.cpp + smp_trampoline.S + support.S + video.cpp + apm.cpp + hpet.cpp + interrupts.cpp + interrupts_asm.S + long.cpp + long_asm.S - # VESA/DDC EDID - decode_edid.c - dump_edid.c + # VESA/DDC EDID + decode_edid.c + dump_edid.c - : - : boot_platform_generic.a -; + : + : boot_platform_generic_bios_ia32.a + ; + } +} -NASMFLAGS on stage1.bin = -f bin -O5 ; +local flags = -f bin -O5 -dKERNEL_PLATFORM=$(HAIKU_KERNEL_PLATFORM) ; +NASMFLAGS on stage1.bin = $(flags) ; +Echo "NASMFLAGS = $(flags)" ; Object stage1.bin : stage1.nasm ; diff --git a/src/system/boot/platform/bios_ia32/stage1.nasm b/src/system/boot/platform/bios_ia32/stage1.nasm index 48bf562571..83d77b24af 100644 --- a/src/system/boot/platform/bios_ia32/stage1.nasm +++ b/src/system/boot/platform/bios_ia32/stage1.nasm @@ -644,11 +644,14 @@ kErrorString db "Failed to load OS. Press any key to reboot..." %endif ; the path to the boot loader +%defstr platformName KERNEL_PLATFORM +%defstr loaderName +%strcat loaderName "haiku_loader",".",platformName kPathComponents: pathComponent "system" pathComponent "packages" kLastPathComponent: -pathComponent "haiku_loader" +pathComponent loaderName db 0 diff --git a/src/system/boot/platform/efi/Jamfile b/src/system/boot/platform/efi/Jamfile index 16f6a6d2dd..a602de5f5c 100644 --- a/src/system/boot/platform/efi/Jamfile +++ b/src/system/boot/platform/efi/Jamfile @@ -1,7 +1,5 @@ SubDir HAIKU_TOP src system boot platform efi ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - UsePrivateHeaders [ FDirName kernel boot ] ; UseBuildFeatureHeaders gnuefi ; UseBuildFeatureHeaders gnuefi : headersProtocol ; @@ -46,16 +44,22 @@ Includes [ FGristFiles $(efi_glue_src) $(platform_src) ] [ BuildFeatureAttribute gnuefi : headersArch ] ; -BootMergeObject boot_platform_efi.o : - $(efi_glue_src) - $(platform_src) - : - : boot_platform_generic.a - ; +local platform ; +for platform in [ MultiBootSubDirSetup efi ] { + on $(platform) { -SEARCH on [ FGristFiles relocation_func.cpp ] - = [ FDirName $(SUBDIR) arch $(TARGET_ARCH) ] ; -LOCATE on [ FGristFiles $(efi_glue_src) ] - = [ BuildFeatureAttribute gnuefi : libdir : path ] ; -Depends [ FGristFiles $(efi_glue_src) ] - : [ BuildFeatureAttribute gnuefi : libdir ] ; + BootMergeObject boot_platform_efi.o : + $(efi_glue_src) + $(platform_src) + : + : boot_platform_generic_efi.a + ; + + SEARCH on [ FGristFiles relocation_func.cpp ] + = [ FDirName $(SUBDIR) arch $(TARGET_ARCH) ] ; + LOCATE on [ FGristFiles $(efi_glue_src) ] + = [ BuildFeatureAttribute gnuefi : libdir : path ] ; + Depends [ FGristFiles $(efi_glue_src) ] + : [ BuildFeatureAttribute gnuefi : libdir ] ; + } +} diff --git a/src/system/boot/platform/generic/Jamfile b/src/system/boot/platform/generic/Jamfile index 565f3662d8..641ae16f5f 100644 --- a/src/system/boot/platform/generic/Jamfile +++ b/src/system/boot/platform/generic/Jamfile @@ -1,17 +1,20 @@ SubDir HAIKU_TOP src system boot platform generic ; -SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ; - UseBuildFeatureHeaders zlib ; UsePrivateKernelHeaders ; SubDirC++Flags -D_BOOT_MODE -fno-rtti ; -BootStaticLibrary boot_platform_generic : - text_menu.cpp - video_blit.cpp - video_splash.cpp -; +local platform ; +for platform in [ MultiBootSubDirSetup ] { + on $(platform) { + BootStaticLibrary boot_platform_generic_$(platform:G=) : + text_menu.cpp + video_blit.cpp + video_splash.cpp + ; -Includes [ FGristFiles video_splash.cpp ] - : [ BuildFeatureAttribute zlib : headers ] ; + Includes [ FGristFiles video_splash.cpp ] + : [ BuildFeatureAttribute zlib : headers ] ; + } +} \ No newline at end of file diff --git a/src/system/boot/platform/pxe_ia32/Jamfile b/src/system/boot/platform/pxe_ia32/Jamfile index 74d51b85ec..a9cf86c1a9 100644 --- a/src/system/boot/platform/pxe_ia32/Jamfile +++ b/src/system/boot/platform/pxe_ia32/Jamfile @@ -2,7 +2,7 @@ SubDir HAIKU_TOP src system boot platform pxe_ia32 ; SubDirHdrs $(SUBDIR) $(DOTDOT) bios_ia32 ; SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform bios_ia32 ; -SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform $(TARGET_BOOT_PLATFORM) ; +SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform pxe_ia32 ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName graphics common ] ; @@ -47,30 +47,35 @@ local bios_ia32_edid_src = ; -BootMergeObject boot_platform_pxe_ia32.o : - pxe_stage2.S - smp_trampoline.S - pxe_bios.S - devices.cpp - network.cpp - pxe_undi.cpp - $(bios_ia32_src) - $(bios_ia32_edid_src) +local platform ; +for platform in [ MultiBootSubDirSetup pxe_ia32 ] { + on $(platform) { + BootMergeObject boot_platform_pxe_ia32.o : + pxe_stage2.S + smp_trampoline.S + pxe_bios.S + devices.cpp + network.cpp + pxe_undi.cpp + $(bios_ia32_src) + $(bios_ia32_edid_src) - : - : boot_platform_generic.a -; + : + : boot_platform_generic_pxe_ia32.a + ; -SEARCH on [ FGristFiles $(bios_ia32_src) ] - = [ FDirName $(SUBDIR) $(DOTDOT) bios_ia32 ] ; + SEARCH on [ FGristFiles $(bios_ia32_src) ] + = [ FDirName $(SUBDIR) $(DOTDOT) bios_ia32 ] ; -SEARCH on [ FGristFiles $(bios_ia32_edid_src) ] - = [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; + SEARCH on [ FGristFiles $(bios_ia32_edid_src) ] + = [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ; -SEARCH on [ FGristFiles $(genericPlatformSources) ] - = [ FDirName $(HAIKU_TOP) src system boot platform generic ] ; + SEARCH on [ FGristFiles $(genericPlatformSources) ] + = [ FDirName $(HAIKU_TOP) src system boot platform generic ] ; -# We also need the bios_ia32 stage1.bin for building bin/makebootable -SEARCH on stage1.bin - = [ FDirName $(SUBDIR) $(DOTDOT) bios_ia32 ] ; + # We also need the bios_ia32 stage1.bin for building bin/makebootable + SEARCH on stage1.bin + = [ FDirName $(SUBDIR) $(DOTDOT) bios_ia32 ] ; + } +} diff --git a/src/system/kernel/Jamfile b/src/system/kernel/Jamfile index 7964320883..5f45850d25 100644 --- a/src/system/kernel/Jamfile +++ b/src/system/kernel/Jamfile @@ -113,7 +113,7 @@ KernelLd kernel_$(TARGET_ARCH) : kernel_vm.o kernel_arch_$(TARGET_KERNEL_ARCH).o - kernel_platform_$(TARGET_BOOT_PLATFORM).o + kernel_platform_$(TARGET_KERNEL_PLATFORM).o linkhack.so @@ -153,7 +153,7 @@ if $(HAIKU_ARCH) in x86_64 arm { kernel_vm.o kernel_arch_$(TARGET_KERNEL_ARCH).o - kernel_platform_$(TARGET_BOOT_PLATFORM).o + kernel_platform_$(TARGET_KERNEL_PLATFORM).o linkhack.so @@ -202,6 +202,6 @@ SubInclude HAIKU_TOP src system kernel slab ; SubInclude HAIKU_TOP src system kernel util ; SubInclude HAIKU_TOP src system kernel vm ; -if $(TARGET_BOOT_PLATFORM) { - SubInclude HAIKU_TOP src system kernel platform $(TARGET_BOOT_PLATFORM) ; +if $(TARGET_KERNEL_PLATFORM) { + SubInclude HAIKU_TOP src system kernel platform $(TARGET_KERNEL_PLATFORM) ; } diff --git a/src/system/kernel/device_manager/Jamfile b/src/system/kernel/device_manager/Jamfile index 2ab592fbca..52f5e0d90b 100644 --- a/src/system/kernel/device_manager/Jamfile +++ b/src/system/kernel/device_manager/Jamfile @@ -1,6 +1,5 @@ SubDir HAIKU_TOP src system kernel device_manager ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UsePrivateHeaders [ FDirName kernel util ] shared ; KernelMergeObject kernel_device_manager.o : diff --git a/src/system/kernel/disk_device_manager/Jamfile b/src/system/kernel/disk_device_manager/Jamfile index 0dc6836eba..58414707b1 100644 --- a/src/system/kernel/disk_device_manager/Jamfile +++ b/src/system/kernel/disk_device_manager/Jamfile @@ -4,7 +4,6 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) jobs ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits storage disk_device ] ; # DiskDeviceTypes.cpp -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName kernel ] ; UsePrivateHeaders [ FDirName kernel fs ] ; diff --git a/src/system/kernel/platform/u-boot/Jamfile b/src/system/kernel/platform/u-boot/Jamfile index e66f4f10ba..c9ff42d2bb 100644 --- a/src/system/kernel/platform/u-boot/Jamfile +++ b/src/system/kernel/platform/u-boot/Jamfile @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src system kernel platform u-boot ; -SubDirHdrs $(HAIKU_TOP) headers private kernel platform $(TARGET_BOOT_PLATFORM) ; +SubDirHdrs $(HAIKU_TOP) headers private kernel platform $(TARGET_KERNEL_PLATFORM) ; UseLibraryHeaders [ FDirName libfdt ] ; SubDirCcFlags $(TARGET_KERNEL_PIC_CCFLAGS) ; diff --git a/src/tests/system/kernel/disk_device_manager/Jamfile b/src/tests/system/kernel/disk_device_manager/Jamfile index e73a79f47f..c044313bad 100644 --- a/src/tests/system/kernel/disk_device_manager/Jamfile +++ b/src/tests/system/kernel/disk_device_manager/Jamfile @@ -8,7 +8,7 @@ SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits storage ] ; #UsePrivateHeaders $(DOT) ; UsePrivateHeaders shared ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; +UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_KERNEL_PLATFORM) ] ; UsePrivateHeaders [ FDirName kernel disk_device_manager ] ; UsePrivateHeaders [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ] ; UsePrivateHeaders [ FDirName kernel fs ] ; diff --git a/src/tests/system/kernel/scheduler/Jamfile b/src/tests/system/kernel/scheduler/Jamfile index b90549924c..4463003c4c 100644 --- a/src/tests/system/kernel/scheduler/Jamfile +++ b/src/tests/system/kernel/scheduler/Jamfile @@ -4,7 +4,7 @@ SubDir HAIKU_TOP src tests system kernel scheduler ; UsePrivateHeaders kernel ; UsePrivateHeaders [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ] ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; +UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_KERNEL_PLATFORM) ] ; #UseHeaders [ FDirName $(HAIKU_TOP) src system kernel cache ] ; local includes = -include $(SUBDIR)/override_types.h ; diff --git a/src/tools/makebootable/Jamfile b/src/tools/makebootable/Jamfile index 799661ed74..dd1fc8fa42 100644 --- a/src/tools/makebootable/Jamfile +++ b/src/tools/makebootable/Jamfile @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src tools makebootable ; -if $(TARGET_BOOT_PLATFORM) { +if $(TARGET_KERNEL_PLATFORM) { SubInclude HAIKU_TOP src tools makebootable platform - $(TARGET_BOOT_PLATFORM) ; + $(TARGET_KERNEL_PLATFORM) ; }