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 : -Bdynamic -export-dynamic -dynamic-linker /foo/bar 124 $(TARGET_KERNEL_PIC_LINKFLAGS) --no-undefined 125 : 126; 127 128if $(HAIKU_ARCH) in x86_64 arm { 129 # Cannot relink everything as a shared object on x86_64 as shared library 130 # code is required to be position-independent. Instead create a copy of the 131 # executable kernel image and change the ELF header type to DYN. A bit of 132 # a hack, but avoids having to recompile a PIC copy of the kernel code. 133 # kernel.so is only used when linking modules to provide symbol information, 134 # this is sufficient for that purpose. 135 KernelSo kernel.so : kernel_$(TARGET_ARCH) ; 136} else { 137 KernelLd kernel.so : 138 kernel_cache.o 139 kernel_core.o 140 kernel_debug.o 141 kernel_device_manager.o 142 kernel_disk_device_manager.o 143 kernel_fs.o 144 kernel_messaging.o 145 kernel_posix.o 146 kernel_slab.o 147 kernel_util.o 148 kernel_vm.o 149 150 kernel_arch_$(TARGET_KERNEL_ARCH).o 151 kernel_platform_$(TARGET_KERNEL_PLATFORM).o 152 153 linkhack.so 154 155 # kernel libroot parts 156 kernel_os_main.o 157 kernel_os_arch_$(TARGET_ARCH).o 158 kernel_lib_posix.o 159 kernel_lib_posix_arch_$(TARGET_ARCH).o 160 kernel_misc.o 161 162 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld 163 : -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar 164 $(TARGET_KERNEL_PIC_LINKFLAGS) 165 ; 166} 167 168NotFile kernel ; 169Depends kernel : kernel_$(TARGET_ARCH) ; 170Depends kernel.so : kernel ; 171 # kernel.so will be rebuilt with the kernel 172 173# propagate the container update variable from kernel to kernel_$(TARGET_ARCH) 174PropagateContainerUpdateTargetFlags kernel_$(TARGET_ARCH) : kernel ; 175 176# Copy kernel and update the copy's revision section. We link everything 177# against the original, but the copy will end up on the disk image (this way 178# we avoid unnecessary dependencies). The copy will be located in a subdirectory. 179if $(TARGET_PLATFORM) = haiku { 180 MakeLocate <revisioned>kernel_$(TARGET_ARCH) 181 : [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ; 182 CopySetHaikuRevision <revisioned>kernel_$(TARGET_ARCH) 183 : kernel_$(TARGET_ARCH) ; 184} 185 186 187SubInclude HAIKU_TOP src system kernel arch ; 188SubInclude HAIKU_TOP src system kernel cache ; 189SubInclude HAIKU_TOP src system kernel device_manager ; 190SubInclude HAIKU_TOP src system kernel debug ; 191SubInclude HAIKU_TOP src system kernel disk_device_manager ; 192SubInclude HAIKU_TOP src system kernel fs ; 193SubInclude HAIKU_TOP src system kernel lib ; 194SubInclude HAIKU_TOP src system kernel messaging ; 195SubInclude HAIKU_TOP src system kernel posix ; 196SubInclude HAIKU_TOP src system kernel slab ; 197SubInclude HAIKU_TOP src system kernel util ; 198SubInclude HAIKU_TOP src system kernel vm ; 199 200if $(TARGET_KERNEL_PLATFORM) { 201 SubInclude HAIKU_TOP src system kernel platform $(TARGET_KERNEL_PLATFORM) ; 202} 203