1SubDir HAIKU_TOP src system boot ; 2 3DEFINES += _BOOT_MODE ; 4 5SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch 6 $(TARGET_KERNEL_ARCH) ] ; 7SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix string ] ; 8SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix stdlib ] ; 9SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix locale ] ; 10SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) kernel lib ] ; 11 12UsePrivateHeaders [ FDirName libroot locale ] ; 13 14local extraSources = ; 15if $(TARGET_GCC_VERSION_$(TARGET_PACKAGING_ARCH)[1]) = 2 { 16 extraSources += atomic.S ; 17} 18 19BootMergeObject boot_libroot.o : 20 abs.c 21 ctype.cpp 22 LocaleData.cpp 23 qsort.c 24 kernel_vsprintf.cpp 25 memchr.c 26 memcmp.c 27 memmove.c 28 strdup.cpp 29 strndup.cpp 30 strlen.cpp 31 strnlen.cpp 32 strcmp.c 33 strcasecmp.c 34 strncmp.c 35 strcat.c 36 strcpy.c 37 strerror.c 38 strlcat.c 39 strlcpy.c 40 strchr.c 41 strrchr.c 42 strtol.c 43 $(extraSources) 44 : -fno-pic 45; 46 47local extraLinkerArgs = ; 48if $(HAIKU_BOARD_LOADER_BASE) { 49 extraLinkerArgs += --defsym BOARD_LOADER_BASE=$(HAIKU_BOARD_LOADER_BASE) ; 50} 51 52AddResources haiku_loader : boot_loader.rdef ; 53 54BootLd boot_loader_$(TARGET_BOOT_PLATFORM) : 55 boot_platform_$(TARGET_BOOT_PLATFORM).o 56 boot_arch_$(TARGET_KERNEL_ARCH).o 57 boot_loader.a 58 boot_net.a 59 boot_partitions.a 60 61 # file systems 62 boot_bfs.a 63 boot_amiga_ffs.a 64 boot_tarfs.a 65 boot_fatfs.a 66 boot_packagefs.a 67 68 boot_loader.a 69 # a second time, so undefined references in the file systems can be 70 # resolved 71 72 # needed by tarfs, packagefs, and video_splash.cpp 73 boot_zlib.a 74 75 # libroot functions needed by the stage2 boot loader 76 boot_libroot.o 77 78 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader_$(TARGET_BOOT_PLATFORM).ld 79 : -Bstatic $(extraLinkerArgs) 80; 81 82rule BuildCoffLoader { 83 local coffLoader = $(1) ; 84 local bootLoader = $(2) ; 85 # XXX: eventually switch on arch 86 COFF_FORMAT on $(coffLoader) = xcoff-powermac ; 87 HACK_COFF on $(coffLoader) = <build>hack-coff ; 88 89 Depends $(coffLoader) : <build>hack-coff ; 90 Depends $(coffLoader) : $(bootLoader) ; 91 MakeLocateDebug $(coffLoader) ; 92} 93 94actions BuildCoffLoader bind HACK_COFF { 95 rm -f $(1) 96 # get the address of the COFF entry 97 $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O symbolsrec $(2) $(2).syms 98 EP=`grep _coff_start $(2).syms | tr -d '\r' | cut -d'$' -f2` 99 rm -f $(2).syms 100 # copy to XCOFF format and patch the entry point 101 $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O $(COFF_FORMAT) --set-start="0x${EP}" $(2) $(1) 102 #$(CP) $(2) $(1) 103 # fill-in some fields objcopy missed 104 $(HACK_COFF) $(1) 105} 106 107BuildCoffLoader boot_loader_$(TARGET_BOOT_PLATFORM)_coff : boot_loader_$(TARGET_BOOT_PLATFORM) ; 108 109rule BuildBiosLoader { 110 local haikuLoader = $(1) ; 111 local bootLoader = $(2) ; 112 113 Depends $(haikuLoader) : $(bootLoader) ; 114 MakeLocateDebug $(haikuLoader) ; 115 116 on $(1) ResAttr $(1) : $(RESFILES) : false ; 117 if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] { 118 SetType $(1) ; 119 MimeSet $(1) ; 120 } 121} 122 123actions BuildBiosLoader { 124 rm -f $(1) 125 $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O binary $(2) $(1) 126} 127 128BuildBiosLoader haiku_loader : boot_loader_$(TARGET_BOOT_PLATFORM) ; 129 130# different target for PXE, to be build with TARGET_BOOT_PLATFORM=pxe_ia32 jam pxehaiku-loader 131BuildBiosLoader pxehaiku-loader : boot_loader_$(TARGET_BOOT_PLATFORM) ; 132 133SubInclude HAIKU_TOP src system boot arch $(TARGET_KERNEL_ARCH) ; 134SubInclude HAIKU_TOP src system boot loader ; 135SubInclude HAIKU_TOP src system boot platform ; 136