1SubDir HAIKU_TOP src system kernel ; 2 3{ 4 local defines = 5 HAIKU_ARCH=\\\"$(TARGET_ARCH)\\\" 6 ; 7 8 defines = [ FDefines $(defines) ] ; 9 SubDirCcFlags $(defines) ; 10 SubDirC++Flags $(defines) ; 11} 12 13SEARCH_SOURCE += [ FDirName $(SUBDIR) events ] ; 14SEARCH_SOURCE += [ FDirName $(SUBDIR) locks ] ; 15SEARCH_SOURCE += [ FDirName $(SUBDIR) scheduler ] ; 16 17UsePrivateHeaders libroot ; 18UsePrivateHeaders shared ; 19UsePrivateHeaders runtime_loader ; 20 21AddResources kernel_$(TARGET_ARCH) : kernel.rdef ; 22 23SetVersionScript kernel_$(TARGET_ARCH) : kernel_versions ; 24SetVersionScript kernel.so : kernel_versions ; 25 26KernelMergeObject kernel_core.o : 27 boot_item.cpp 28 boot_splash.cpp 29 commpage.cpp 30 condition_variable.cpp 31 convertutf.cpp 32 cpu.cpp 33 DPC.cpp 34 elf.cpp 35 guarded_heap.cpp 36 heap.cpp 37 image.cpp 38 int.cpp 39 kernel_daemon.cpp 40 linkhack.c 41 listeners.cpp 42 low_resource_manager.cpp 43 main.cpp 44 module.cpp 45 port.cpp 46 real_time_clock.cpp 47 sem.cpp 48 shutdown.cpp 49 signal.cpp 50 system_info.cpp 51 smp.cpp 52 syscalls.cpp 53 team.cpp 54 thread.cpp 55 timer.cpp 56 UserEvent.cpp 57 usergroup.cpp 58 UserTimer.cpp 59 60 # events 61 wait_for_objects.cpp 62 Notifications.cpp 63 event_queue.cpp 64 65 # locks 66 lock.cpp 67 user_mutex.cpp 68 69 # scheduler 70 low_latency.cpp 71 power_saving.cpp 72 scheduler.cpp 73 scheduler_cpu.cpp 74 scheduler_profiler.cpp 75 scheduler_thread.cpp 76 scheduler_tracing.cpp 77 scheduling_analysis.cpp 78 79 : $(TARGET_KERNEL_PIC_CCFLAGS) 80; 81 82# We need to specify the dependency on the generated syscalls files explicitly. 83Includes [ FGristFiles syscalls.cpp ] 84 : 85 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_dispatcher.h 86 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_table.h 87 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_numbers.h 88; 89 90KernelLd linkhack.so : 91 <$(SOURCE_GRIST)>linkhack.o 92 : 93 : 94 -shared -Bdynamic 95; 96 97KernelLd kernel_$(TARGET_ARCH) : 98 kernel_cache.o 99 kernel_core.o 100 kernel_debug.o 101 kernel_device_manager.o 102 kernel_disk_device_manager.o 103 kernel_fs.o 104 kernel_messaging.o 105 kernel_posix.o 106 kernel_slab.o 107 kernel_util.o 108 kernel_vm.o 109 110 kernel_arch_$(TARGET_KERNEL_ARCH).o 111 kernel_platform_$(TARGET_KERNEL_PLATFORM).o 112 113 linkhack.so 114 115 # kernel parts borrowed from libroot and others 116 kernel_os_main.o 117 kernel_os_arch_$(TARGET_ARCH).o 118 kernel_lib_posix.o 119 kernel_lib_posix_arch_$(TARGET_ARCH).o 120 kernel_misc.o 121 122 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld 123 : --orphan-handling=warn -L $(HAIKU_TOP)/src/system/ldscripts/common/ 124 -Bdynamic -export-dynamic -dynamic-linker /foo/bar 125 $(TARGET_KERNEL_PIC_LINKFLAGS) --no-undefined 126 : 127; 128 129if $(HAIKU_ARCH) in x86_64 arm { 130 # Cannot relink everything as a shared object on x86_64 as shared library 131 # code is required to be position-independent. Instead create a copy of the 132 # executable kernel image and change the ELF header type to DYN. A bit of 133 # a hack, but avoids having to recompile a PIC copy of the kernel code. 134 # kernel.so is only used when linking modules to provide symbol information, 135 # this is sufficient for that purpose. 136 KernelSo kernel.so : kernel_$(TARGET_ARCH) ; 137} else { 138 KernelLd kernel.so : 139 kernel_cache.o 140 kernel_core.o 141 kernel_debug.o 142 kernel_device_manager.o 143 kernel_disk_device_manager.o 144 kernel_fs.o 145 kernel_messaging.o 146 kernel_posix.o 147 kernel_slab.o 148 kernel_util.o 149 kernel_vm.o 150 151 kernel_arch_$(TARGET_KERNEL_ARCH).o 152 kernel_platform_$(TARGET_KERNEL_PLATFORM).o 153 154 linkhack.so 155 156 # kernel libroot parts 157 kernel_os_main.o 158 kernel_os_arch_$(TARGET_ARCH).o 159 kernel_lib_posix.o 160 kernel_lib_posix_arch_$(TARGET_ARCH).o 161 kernel_misc.o 162 163 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld 164 : --orphan-handling=warn -L $(HAIKU_TOP)/src/system/ldscripts/common/ 165 -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar 166 $(TARGET_KERNEL_PIC_LINKFLAGS) 167 ; 168} 169 170NotFile kernel ; 171Depends kernel : kernel_$(TARGET_ARCH) ; 172Depends kernel.so : kernel ; 173 # kernel.so will be rebuilt with the kernel 174 175# propagate the container update variable from kernel to kernel_$(TARGET_ARCH) 176PropagateContainerUpdateTargetFlags kernel_$(TARGET_ARCH) : kernel ; 177 178# Copy kernel and update the copy's revision section. We link everything 179# against the original, but the copy will end up on the disk image (this way 180# we avoid unnecessary dependencies). The copy will be located in a subdirectory. 181if $(TARGET_PLATFORM) = haiku { 182 MakeLocate <revisioned>kernel_$(TARGET_ARCH) 183 : [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ; 184 CopySetHaikuRevision <revisioned>kernel_$(TARGET_ARCH) 185 : kernel_$(TARGET_ARCH) ; 186} 187 188 189SubInclude HAIKU_TOP src system kernel arch ; 190SubInclude HAIKU_TOP src system kernel cache ; 191SubInclude HAIKU_TOP src system kernel device_manager ; 192SubInclude HAIKU_TOP src system kernel debug ; 193SubInclude HAIKU_TOP src system kernel disk_device_manager ; 194SubInclude HAIKU_TOP src system kernel fs ; 195SubInclude HAIKU_TOP src system kernel lib ; 196SubInclude HAIKU_TOP src system kernel messaging ; 197SubInclude HAIKU_TOP src system kernel posix ; 198SubInclude HAIKU_TOP src system kernel slab ; 199SubInclude HAIKU_TOP src system kernel util ; 200SubInclude HAIKU_TOP src system kernel vm ; 201 202if $(TARGET_KERNEL_PLATFORM) { 203 SubInclude HAIKU_TOP src system kernel platform $(TARGET_KERNEL_PLATFORM) ; 204} 205