1 SubDir HAIKU_TOP src system boot ;
3 DEFINES += _BOOT_MODE ;
5 if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) != bios_ia32 {
6 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch
9 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch
10 $(TARGET_KERNEL_ARCH) ] ;
13 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix string ] ;
14 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix stdlib ] ;
15 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix locale ] ;
16 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) kernel lib ] ;
18 UsePrivateHeaders [ FDirName libroot locale ] ;
20 local extraSources = ;
21 if $(TARGET_GCC_VERSION_$(TARGET_PACKAGING_ARCH)[1]) = 2 {
22 extraSources += atomic.S ;
25 BootMergeObject boot_libroot.o :
52 AddResources haiku_loader : boot_loader.rdef ;
54 BootLd boot_loader_$(TARGET_BOOT_PLATFORM) :
55 boot_platform_$(TARGET_BOOT_PLATFORM).o
56 boot_arch_$(TARGET_KERNEL_ARCH).o
69 # a second time, so undefined references in the file systems can be
72 # needed by tarfs, packagefs, and video_splash.cpp
75 # libroot functions needed by the stage2 boot loader
78 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader_$(TARGET_BOOT_PLATFORM).ld
79 : $(TARGET_BOOT_LDFLAGS)
82 rule 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 ;
89 Depends $(coffLoader) : <build>hack-coff ;
90 Depends $(coffLoader) : $(bootLoader) ;
91 MakeLocateDebug $(coffLoader) ;
94 actions BuildCoffLoader bind HACK_COFF {
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`
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)
103 # fill-in some fields objcopy missed
107 BuildCoffLoader boot_loader_$(TARGET_BOOT_PLATFORM)_coff : boot_loader_$(TARGET_BOOT_PLATFORM) ;
109 rule BuildBiosLoader {
110 local haikuLoader = $(1) ;
111 local bootLoader = $(2) ;
113 Depends $(haikuLoader) : $(bootLoader) ;
114 MakeLocateDebug $(haikuLoader) ;
116 on $(1) ResAttr $(1) : $(RESFILES) : false ;
117 if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
123 actions BuildBiosLoader {
125 $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O binary $(2) $(1)
128 BuildBiosLoader haiku_loader : boot_loader_$(TARGET_BOOT_PLATFORM) ;
130 # different target for PXE, to be build with TARGET_BOOT_PLATFORM=pxe_ia32 jam pxehaiku-loader
131 BuildBiosLoader pxehaiku-loader : boot_loader_$(TARGET_BOOT_PLATFORM) ;
133 rule BuildEFILoader {
134 local efiLoader = $(1) ;
135 local bootLoader = $(2) ;
137 Depends $(efiLoader) : $(bootLoader) ;
138 MakeLocateDebug $(efiLoader) ;
141 actions BuildEFILoader {
143 $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
144 -j .rel -j .rela -j .reloc --target=efi-app-x86_64 $(2) $(1)
147 BuildEFILoader haiku_loader.efi : boot_loader_$(TARGET_BOOT_PLATFORM) ;
149 SubInclude HAIKU_TOP src system boot arch $(TARGET_KERNEL_ARCH) ;
150 SubInclude HAIKU_TOP src system boot loader ;
151 SubInclude HAIKU_TOP src system boot platform ;