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) locks ] ; 14SEARCH_SOURCE += [ FDirName $(SUBDIR) scheduler ] ; 15 16UsePrivateHeaders libroot ; 17UsePrivateHeaders shared ; 18UsePrivateHeaders runtime_loader ; 19 20AddResources kernel_$(TARGET_ARCH) : kernel.rdef ; 21 22SetVersionScript kernel_$(TARGET_ARCH) : kernel_versions ; 23SetVersionScript kernel.so : kernel_versions ; 24 25KernelMergeObject kernel_core.o : 26 boot_item.cpp 27 boot_splash.cpp 28 commpage.cpp 29 condition_variable.cpp 30 convertutf.cpp 31 cpu.cpp 32 DPC.cpp 33 elf.cpp 34 guarded_heap.cpp 35 heap.cpp 36 image.cpp 37 int.cpp 38 kernel_daemon.cpp 39 linkhack.c 40 listeners.cpp 41 low_resource_manager.cpp 42 main.cpp 43 module.cpp 44 Notifications.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 wait_for_objects.cpp 60 61 # locks 62 lock.cpp 63 user_mutex.cpp 64 65 # scheduler 66 low_latency.cpp 67 power_saving.cpp 68 scheduler.cpp 69 scheduler_cpu.cpp 70 scheduler_profiler.cpp 71 scheduler_thread.cpp 72 scheduler_tracing.cpp 73 scheduling_analysis.cpp 74 75 : $(TARGET_KERNEL_PIC_CCFLAGS) 76; 77 78# Generate the header defining macros for C++ structure sizes. 79local kernelC++StructSizesHeader = [ FGristFiles kernel_c++_struct_sizes.h ] ; 80TARGET_HDRS_$(TARGET_PACKAGING_ARCH) on $(kernelC++StructSizesHeader) 81 = [ on $(kernelC++StructSizesHeader) 82 return $(TARGET_HDRS_$(TARGET_PACKAGING_ARCH)) ] 83 $(TARGET_PRIVATE_KERNEL_HEADERS) ; 84CreateAsmStructOffsetsHeader $(kernelC++StructSizesHeader) 85 : kernel_c++_structs.cpp ; 86 87# We need to specify the dependency on the generated syscalls files explicitly. 88Includes [ FGristFiles syscalls.cpp ] 89 : 90 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_dispatcher.h 91 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_table.h 92 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_numbers.h 93; 94 95# TODO: fix or update binutils for ppc, in the meantime this should get things going. 96local linkHackLdFlags ; 97if $(TARGET_ARCH) = ppc { 98 linkHackLdFlags = -Bdynamic ; 99} else { 100 linkHackLdFlags = -shared -Bdynamic ; 101} 102 103KernelLd linkhack.so : 104 <$(SOURCE_GRIST)>linkhack.o 105 : 106 : 107 $(linkHackLdFlags) 108; 109 110KernelLd kernel_$(TARGET_ARCH) : 111 kernel_cache.o 112 kernel_core.o 113 kernel_debug.o 114 kernel_device_manager.o 115 kernel_disk_device_manager.o 116 kernel_fs.o 117 kernel_messaging.o 118 kernel_posix.o 119 kernel_slab.o 120 kernel_util.o 121 kernel_vm.o 122 123 kernel_arch_$(TARGET_KERNEL_ARCH).o 124 kernel_platform_$(TARGET_BOOT_PLATFORM).o 125 126 linkhack.so 127 128 # kernel parts borrowed from libroot and others 129 kernel_os_main.o 130 kernel_os_arch_$(TARGET_ARCH).o 131 kernel_lib_posix.o 132 kernel_lib_posix_arch_$(TARGET_ARCH).o 133 kernel_misc.o 134 135 $(TARGET_KERNEL_LIBSUPC++) 136 137 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld 138 : -Bdynamic -export-dynamic -dynamic-linker /foo/bar 139 $(TARGET_KERNEL_PIC_LINKFLAGS) 140 : 141; 142 143if $(HAIKU_ARCH) in x86_64 arm { 144 # Cannot relink everything as a shared object on x86_64 as shared library 145 # code is required to be position-independent. Instead create a copy of the 146 # executable kernel image and change the ELF header type to DYN. A bit of 147 # a hack, but avoids having to recompile a PIC copy of the kernel code. 148 # kernel.so is only used when linking modules to provide symbol information, 149 # this is sufficient for that purpose. 150 KernelSo kernel.so : kernel_$(TARGET_ARCH) ; 151} else { 152 KernelLd kernel.so : 153 kernel_cache.o 154 kernel_core.o 155 kernel_debug.o 156 kernel_device_manager.o 157 kernel_disk_device_manager.o 158 kernel_fs.o 159 kernel_messaging.o 160 kernel_posix.o 161 kernel_slab.o 162 kernel_util.o 163 kernel_vm.o 164 165 kernel_arch_$(TARGET_KERNEL_ARCH).o 166 kernel_platform_$(TARGET_BOOT_PLATFORM).o 167 168 linkhack.so 169 170 # kernel libroot parts 171 kernel_os_main.o 172 kernel_os_arch_$(TARGET_ARCH).o 173 kernel_lib_posix.o 174 kernel_lib_posix_arch_$(TARGET_ARCH).o 175 kernel_misc.o 176 177 $(TARGET_KERNEL_LIBSUPC++) 178 179 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld 180 : -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar 181 $(TARGET_KERNEL_PIC_LINKFLAGS) 182 ; 183} 184 185NotFile kernel ; 186Depends kernel : kernel_$(TARGET_ARCH) ; 187Depends kernel.so : kernel ; 188 # kernel.so will be rebuilt with the kernel 189 190# propagate the container update variable from kernel to kernel_$(TARGET_ARCH) 191PropagateContainerUpdateTargetFlags kernel_$(TARGET_ARCH) : kernel ; 192 193# Copy kernel and update the copy's revision section. We link everything 194# against the original, but the copy will end up on the disk image (this way 195# we avoid unnecessary dependencies). The copy will be located in a subdirectory. 196if $(TARGET_PLATFORM) = haiku { 197 MakeLocate <revisioned>kernel_$(TARGET_ARCH) 198 : [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ; 199 CopySetHaikuRevision <revisioned>kernel_$(TARGET_ARCH) 200 : kernel_$(TARGET_ARCH) ; 201} 202 203 204SubInclude HAIKU_TOP src system kernel arch ; 205SubInclude HAIKU_TOP src system kernel cache ; 206SubInclude HAIKU_TOP src system kernel device_manager ; 207SubInclude HAIKU_TOP src system kernel debug ; 208SubInclude HAIKU_TOP src system kernel disk_device_manager ; 209SubInclude HAIKU_TOP src system kernel fs ; 210SubInclude HAIKU_TOP src system kernel lib ; 211SubInclude HAIKU_TOP src system kernel messaging ; 212SubInclude HAIKU_TOP src system kernel posix ; 213SubInclude HAIKU_TOP src system kernel slab ; 214SubInclude HAIKU_TOP src system kernel util ; 215SubInclude HAIKU_TOP src system kernel vm ; 216 217if $(TARGET_BOOT_PLATFORM) { 218 SubInclude HAIKU_TOP src system kernel platform $(TARGET_BOOT_PLATFORM) ; 219} 220