Setup -fno-pic or -fpic in Architecture Rules.
[haiku.git] / src / system / boot / Jamfile
blob72bb340278807b5f55f4bf3d2f76ba3e365f6f88
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
7                                 x86_64 ] ;
8 } else {
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 :
26         abs.c
27         ctype.cpp
28         LocaleData.cpp
29         qsort.c
30         kernel_vsprintf.cpp
31         memchr.c
32         memcmp.c
33         memmove.c
34         strdup.cpp
35         strndup.cpp
36         strlen.cpp
37         strnlen.cpp
38         strcmp.c
39         strcasecmp.c
40         strncmp.c
41         strcat.c
42         strcpy.c
43         strerror.c
44         strlcat.c
45         strlcpy.c
46         strchr.c
47         strrchr.c
48         strtol.c
49         $(extraSources)
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
57         boot_loader.a
58         boot_net.a
59         boot_partitions.a
61         # file systems
62         boot_bfs.a
63         boot_amiga_ffs.a
64         boot_tarfs.a
65         boot_fatfs.a
66         boot_packagefs.a
68         boot_loader.a
69                 # a second time, so undefined references in the file systems can be
70                 # resolved
72         # needed by tarfs, packagefs, and video_splash.cpp
73         boot_zlib.a
75         # libroot functions needed by the stage2 boot loader
76         boot_libroot.o
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 {
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)
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) ] {
118                 SetType $(1) ;
119                 MimeSet $(1) ;
120         }
123 actions BuildBiosLoader {
124         rm -f $(1)
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 {
142         rm -f $(1)
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 ;