SubDir HAIKU_TOP src system boot ; DEFINES += _BOOT_MODE ; 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 $(extraSources) : -fno-pic ; local extraLinkerArgs = ; if $(HAIKU_BOARD_LOADER_BASE) { extraLinkerArgs += --defsym BOARD_LOADER_BASE=$(HAIKU_BOARD_LOADER_BASE) ; } 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 : -Bstatic $(extraLinkerArgs) ; rule BuildCoffLoader { local coffLoader = $(1) ; local bootLoader = $(2) ; # XXX: eventually switch on arch COFF_FORMAT on $(coffLoader) = xcoff-powermac ; HACK_COFF on $(coffLoader) = hack-coff ; Depends $(coffLoader) : hack-coff ; Depends $(coffLoader) : $(bootLoader) ; MakeLocateDebug $(coffLoader) ; } actions BuildCoffLoader bind HACK_COFF { rm -f $(1) # get the address of the COFF entry $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O symbolsrec $(2) $(2).syms EP=`grep _coff_start $(2).syms | tr -d '\r' | cut -d'$' -f2` rm -f $(2).syms # copy to XCOFF format and patch the entry point $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O $(COFF_FORMAT) --set-start="0x${EP}" $(2) $(1) #$(CP) $(2) $(1) # fill-in some fields objcopy missed $(HACK_COFF) $(1) } BuildCoffLoader boot_loader_$(TARGET_BOOT_PLATFORM)_coff : boot_loader_$(TARGET_BOOT_PLATFORM) ; rule BuildBiosLoader { local haikuLoader = $(1) ; local bootLoader = $(2) ; Depends $(haikuLoader) : $(bootLoader) ; MakeLocateDebug $(haikuLoader) ; on $(1) ResAttr $(1) : $(RESFILES) : false ; if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] { SetType $(1) ; MimeSet $(1) ; } } actions BuildBiosLoader { rm -f $(1) $(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) ; SubInclude HAIKU_TOP src system boot arch $(TARGET_KERNEL_ARCH) ; SubInclude HAIKU_TOP src system boot loader ; SubInclude HAIKU_TOP src system boot platform ;