1 SubDir HAIKU_TOP src system boot ;
3 SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
5 DEFINES += _BOOT_MODE ;
7 if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) = efi {
8 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch
11 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch
12 $(TARGET_KERNEL_ARCH) ] ;
15 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix string ] ;
16 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix stdlib ] ;
17 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix locale ] ;
18 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) kernel lib ] ;
20 UsePrivateHeaders [ FDirName libroot locale ] ;
22 local extraSources = ;
23 if $(TARGET_GCC_VERSION_$(TARGET_PACKAGING_ARCH)[1]) = 2 {
24 extraSources += atomic.S ;
27 BootMergeObject boot_libroot.o :
55 AddResources haiku_loader : boot_loader.rdef ;
57 BootLd boot_loader_$(TARGET_BOOT_PLATFORM) :
58 boot_platform_$(TARGET_BOOT_PLATFORM).o
59 boot_arch_$(TARGET_KERNEL_ARCH).o
72 # a second time, so undefined references in the file systems can be
75 # needed by tarfs, packagefs, and video_splash.cpp
78 # libroot functions needed by the stage2 boot loader
81 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader_$(TARGET_BOOT_PLATFORM).ld
82 : $(TARGET_BOOT_LDFLAGS)
85 rule BuildCoffLoader {
86 local coffLoader = $(1) ;
87 local bootLoader = $(2) ;
88 # XXX: eventually switch on arch
89 COFF_FORMAT on $(coffLoader) = xcoff-powermac ;
90 HACK_COFF on $(coffLoader) = <build>hack-coff ;
92 Depends $(coffLoader) : <build>hack-coff ;
93 Depends $(coffLoader) : $(bootLoader) ;
94 MakeLocateDebug $(coffLoader) ;
97 actions BuildCoffLoader bind HACK_COFF {
99 # get the address of the COFF entry
100 $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O symbolsrec $(2) $(2).syms
101 EP=`grep _coff_start $(2).syms | tr -d '\r' | cut -d'$' -f2`
103 # copy to XCOFF format and patch the entry point
104 $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O $(COFF_FORMAT) --set-start="0x${EP}" $(2) $(1)
106 # fill-in some fields objcopy missed
110 BuildCoffLoader boot_loader_$(TARGET_BOOT_PLATFORM)_coff : boot_loader_$(TARGET_BOOT_PLATFORM) ;
112 rule BuildBiosLoader {
113 local haikuLoader = $(1) ;
114 local bootLoader = $(2) ;
116 Depends $(haikuLoader) : $(bootLoader) ;
117 MakeLocateDebug $(haikuLoader) ;
119 on $(1) ResAttr $(1) : $(RESFILES) : false ;
120 if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
126 actions BuildBiosLoader {
128 $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O binary $(2) $(1)
131 BuildBiosLoader haiku_loader : boot_loader_$(TARGET_BOOT_PLATFORM) ;
133 # different target for PXE, to be build with TARGET_BOOT_PLATFORM=pxe_ia32 jam pxehaiku-loader
134 BuildBiosLoader pxehaiku-loader : boot_loader_$(TARGET_BOOT_PLATFORM) ;
136 rule BuildEFILoader {
137 local efiLoader = $(1) ;
138 local bootLoader = $(2) ;
140 Depends $(efiLoader) : $(bootLoader) ;
141 MakeLocateDebug $(efiLoader) ;
144 actions BuildEFILoader {
146 $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -j .text -j .sdata -j .data -j .dynamic -j .dynsym \
147 -j .rel -j .rela -j .reloc --target=efi-app-x86_64 $(2) $(1)
150 BuildEFILoader haiku_loader.efi : boot_loader_$(TARGET_BOOT_PLATFORM) ;
152 SubInclude HAIKU_TOP src system boot arch $(TARGET_KERNEL_ARCH) ;
153 SubInclude HAIKU_TOP src system boot loader ;
154 SubInclude HAIKU_TOP src system boot platform ;