Get rid of miggen subdir, use CMake

This commit is contained in:
Lubos Dolezel 2017-04-07 18:21:29 +02:00
parent 4614f61361
commit 8326c4afaa
342 changed files with 149 additions and 83320 deletions

107
CMakeLists.txt Normal file
View File

@ -0,0 +1,107 @@
project(lkm)
add_definitions(
-DKERNEL
-DKERNEL_PRIVATE
-DKERNEL_SERVER=1
-DKERNEL_USER=1
-DMACH_KERNEL_PRIVATE
-DMACH_NOTIFY_SEND_POSSIBLE_EXPECTED
)
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/osfmk)
set(MIG_USER_SOURCE_SUFFIX "_user.c")
set(MIG_SERVER_SOURCE_SUFFIX "_server.c")
set(MIG_SERVER_HEADER_SUFFIX "_server.h")
mig(osfmk/device/device.defs)
mig(osfmk/UserNotification/UNDReply.defs)
mig(osfmk/default_pager/default_pager_alerts.defs)
mig(osfmk/default_pager/default_pager_object.defs)
mig(osfmk/clock_reply.defs)
mig(osfmk/audit_triggers.defs)
mig(osfmk/kextd/kextd_mach.defs)
mig(osfmk/mach/audit_triggers.defs)
mig(osfmk/mach/clock.defs)
mig(osfmk/mach/clock_priv.defs)
mig(osfmk/mach/clock_reply.defs)
mig(osfmk/mach/exc.defs)
mig(osfmk/mach/host_notify_reply.defs)
mig(osfmk/mach/host_priv.defs)
mig(osfmk/mach/host_security.defs)
mig(osfmk/mach/lock_set.defs)
mig(osfmk/mach/mach_exc.defs)
mig(osfmk/mach/mach_host.defs)
mig(osfmk/mach/mach_notify.defs)
mig(osfmk/mach/mach_port.defs)
mig(osfmk/mach/mach_vm.defs)
mig(osfmk/mach/memory_object_control.defs)
mig(osfmk/mach/memory_object_default.defs)
mig(osfmk/mach/memory_object.defs)
mig(osfmk/mach/memory_object_name.defs)
mig(osfmk/mach/processor.defs)
mig(osfmk/mach/processor_set.defs)
mig(osfmk/mach/security.defs)
mig(osfmk/mach/task_access.defs)
mig(osfmk/mach/task.defs)
mig(osfmk/mach/thread_act.defs)
mig(osfmk/mach/upl.defs)
mig(osfmk/mach/vm_map.defs)
mig(osfmk/mach/vm32_map.defs)
mig(osfmk/mach/exc.defs)
mig(osfmk/mach/mach_exc.defs)
mig(osfmk/mach/notify.defs)
mig(osfmk/mach/vm_map.defs)
mig(osfmk/mach/memory_object_default.defs)
mig(osfmk/mach/memory_object_control.defs)
mig(osfmk/mach/memory_object.defs)
mig(osfmk/mach/upl.defs)
mig(osfmk/mach/security.defs)
mig(osfmk/mach/mach_notify.defs)
mig(osfmk/mach/vm32_map.defs)
mig(osfmk/mach/host_notify_reply.defs)
file(RELATIVE_PATH MIGDIR_REL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_target(lkm
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lkm-make MIGDIR=${CMAKE_CURRENT_BINARY_DIR} MIGDIR_REL=${MIGDIR_REL}
COMMENT "Building the Linux kernel module"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/upl.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/host_notify_reply.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/vm32_map_server.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/mach_notify.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/security.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/memory_object_control.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/memory_object_server.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/memory_object_default_server.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/vm_map.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/exc_server.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/mach_exc_server.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/notify_server.h
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/task_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/clock_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/clock_priv_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/processor_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/host_priv_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/host_security_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/lock_set_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/mach_port_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/mach_vm_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/mach_host_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/processor_set_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/memory_object_name_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/thread_act_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/mach/clock_reply_user.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/device/device_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/default_pager/default_pager_object_server.c
${CMAKE_CURRENT_BINARY_DIR}/osfmk/UserNotification/UNDReply_server.c
)
add_custom_target(lkm_install
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lkm-make install && depmod
COMMENT "Installing the Linux kernel module"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")

View File

@ -1,12 +1,19 @@
BUILD_ROOT ?= $(src)
BUILD_ROOT := $(src)
ifndef MIGDIR
$(error Darling's kernel module is now built differently. \
Please run 'make lkm' and 'make lkm_install' inside your CMake build directory)
endif
asflags-y := -D__DARLING__ -D__NO_UNDERSCORES__ \
-I$(BUILD_ROOT)/miggen/osfmk \
-I$(MIGDIR)/osfmk \
-I$(BUILD_ROOT)/osfmk
ccflags-y := -D__DARLING__ -DDARLING_DEBUG \
-I$(BUILD_ROOT)/EXTERNAL_HEADERS \
-I$(BUILD_ROOT)/EXTERNAL_HEADERS/bsd \
-I$(BUILD_ROOT)/duct/defines \
-DPAGE_SIZE_FIXED \
-DCONFIG_SCHED_TRADITIONAL \
-freorder-blocks \
@ -34,7 +41,7 @@ ccflags-y := -D__DARLING__ -DDARLING_DEBUG \
-Wno-maybe-uninitialized \
-D__private_extern__=extern \
-D_MODE_T -D_NLINK_T -DVM32_SUPPORT=1 -DMACH_KERNEL_PRIVATE \
-I$(BUILD_ROOT)/miggen/bsd \
-I$(MIGDIR)/bsd \
-I$(BUILD_ROOT)/bsd \
-I$(BUILD_ROOT)/osfmk \
-I$(BUILD_ROOT)/iokit \
@ -48,7 +55,7 @@ ccflags-y := -D__DARLING__ -DDARLING_DEBUG \
-I$(BUILD_ROOT)/osfmk/mach_debug \
-I$(BUILD_ROOT)/ \
-I$(BUILD_ROOT)/linux \
-I$(BUILD_ROOT)/miggen/osfmk \
-I$(MIGDIR)/osfmk \
-DARCH_PRIVATE \
-DDRIVER_PRIVATE \
-D_KERNEL_BUILD \
@ -243,23 +250,23 @@ ifneq ($(KERNELRELEASE),)
duct/bsd/dummy-sched.o \
libkern/gen/OSAtomicOperations.o \
libkern/x86_64/OSAtomic.o \
miggen/osfmk/mach/task_server.o \
miggen/osfmk/mach/clock_server.o \
miggen/osfmk/mach/clock_priv_server.o \
miggen/osfmk/mach/processor_server.o \
miggen/osfmk/mach/host_priv_server.o \
miggen/osfmk/mach/host_security_server.o \
miggen/osfmk/mach/lock_set_server.o \
miggen/osfmk/mach/mach_port_server.o \
miggen/osfmk/mach/mach_vm_server.o \
miggen/osfmk/mach/mach_host_server.o \
miggen/osfmk/mach/processor_set_server.o \
miggen/osfmk/mach/memory_object_name_server.o \
miggen/osfmk/mach/thread_act_server.o \
miggen/osfmk/mach/clock_reply_user.o \
miggen/osfmk/device/device_server.o \
miggen/osfmk/default_pager/default_pager_object_server.o \
miggen/osfmk/UserNotification/UNDReply_server.o \
$(MIGDIR_REL)/osfmk/mach/task_server.o \
$(MIGDIR_REL)/osfmk/mach/clock_server.o \
$(MIGDIR_REL)/osfmk/mach/clock_priv_server.o \
$(MIGDIR_REL)/osfmk/mach/processor_server.o \
$(MIGDIR_REL)/osfmk/mach/host_priv_server.o \
$(MIGDIR_REL)/osfmk/mach/host_security_server.o \
$(MIGDIR_REL)/osfmk/mach/lock_set_server.o \
$(MIGDIR_REL)/osfmk/mach/mach_port_server.o \
$(MIGDIR_REL)/osfmk/mach/mach_vm_server.o \
$(MIGDIR_REL)/osfmk/mach/mach_host_server.o \
$(MIGDIR_REL)/osfmk/mach/processor_set_server.o \
$(MIGDIR_REL)/osfmk/mach/memory_object_name_server.o \
$(MIGDIR_REL)/osfmk/mach/thread_act_server.o \
$(MIGDIR_REL)/osfmk/mach/clock_reply_user.o \
$(MIGDIR_REL)/osfmk/device/device_server.o \
$(MIGDIR_REL)/osfmk/default_pager/default_pager_object_server.o \
$(MIGDIR_REL)/osfmk/UserNotification/UNDReply_server.o \
pexpert/duct/duct_gen_bootargs.o \
pexpert/duct/duct_pe_kprintf.o \

0
duct/defines/cputypes.h Normal file
View File

0
duct/defines/platforms.h Normal file
View File

8
lkm-make Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# So that the user can see at least some build progress
unset MFLAGS
unset MAKEFLAGS
exec make "$@"

View File

@ -1 +0,0 @@
#define ALLCRYPTO 0

View File

@ -1 +0,0 @@
#define BOND 1

View File

@ -1 +0,0 @@
#define NBPFILTER 4

View File

@ -1 +0,0 @@
#define BRIDGESTP 0

View File

@ -1 +0,0 @@
#define CLASSQ_BLUE 0

View File

@ -1 +0,0 @@
#define CLASSQ_RED 0

View File

@ -1 +0,0 @@
#define CLASSQ_RIO 0

View File

@ -1 +0,0 @@
#define COMPAT_43 0

View File

@ -1 +0,0 @@
#define MAXUSERS 2

View File

@ -1 +0,0 @@
#define CONFIG_AUDIT 1

View File

@ -1 +0,0 @@
#define CONFIG_DTRACE 0

View File

@ -1 +0,0 @@
#define CONFIG_FSE 1

View File

@ -1 +0,0 @@
#define CONFIG_IMAGEBOOT 1

View File

@ -1 +0,0 @@
#define CONFIG_MACF 1

View File

@ -1 +0,0 @@
#define CONFIG_MACF_NET 0

View File

@ -1 +0,0 @@
#define CONFIG_MACF_SOCKET 0

View File

@ -1 +0,0 @@
#define CONFIG_MACF_SOCKET_SUBSET 1

View File

@ -1 +0,0 @@
#define arm 1

View File

@ -1 +0,0 @@
#define CRYPTO 0

View File

@ -1 +0,0 @@
#define DEVELOPMENT 0

View File

@ -1 +0,0 @@
#define DEVFS 1

View File

@ -1 +0,0 @@
#define DIAGNOSTIC 0

View File

@ -1 +0,0 @@
#define DISC 0

View File

@ -1 +0,0 @@
#define DRIVERKIT 1

View File

@ -1 +0,0 @@
#define DUMMYNET 1

View File

@ -1 +0,0 @@
#define EON 0

View File

@ -1 +0,0 @@
#define NETHER 1

View File

@ -1 +0,0 @@
#define FDDI 0

View File

@ -1 +0,0 @@
#define FDESC 1

View File

@ -1 +0,0 @@
#define FFS 0

View File

@ -1 +0,0 @@
#define FIFO 1

View File

@ -1 +0,0 @@
#define GATEWAY 0

View File

@ -1 +0,0 @@
#define GDB 1

View File

@ -1 +0,0 @@
#define NGIF 1

View File

@ -1 +0,0 @@
#define HFS 1

View File

@ -1 +0,0 @@
#define HFS_COMPRESSION 1

View File

@ -1 +0,0 @@
#define HW_AST 0

View File

@ -1 +0,0 @@
#define HW_FOOTPRINT 0

View File

@ -1 +0,0 @@
#define IF_BRIDGE 1

View File

@ -1 +0,0 @@
#define INET 1

View File

@ -1 +0,0 @@
#define INET6 1

View File

@ -1,21 +0,0 @@
#include <dev/busvar.h>
extern int pty_init(int);
extern int ptmx_init(int);
extern int vndevice_init(int);
extern int mdevinit(int);
extern int bpf_init(int);
extern int fsevents_init(int);
extern int random_init(int);
struct pseudo_init pseudo_inits[] = {
{8, pty_init},
{1, ptmx_init},
{2, vndevice_init},
{1, mdevinit},
{4, bpf_init},
{1, fsevents_init},
{1, random_init},
{0, 0},
};

View File

@ -1 +0,0 @@
#define IPDIVERT 1

View File

@ -1 +0,0 @@
#define IPFIREWALL 1

View File

@ -1 +0,0 @@
#define IPFW2 1

View File

@ -1 +0,0 @@
#define IPLMEAS 0

View File

@ -1 +0,0 @@
#define IPV6FIREWALL 1

View File

@ -1 +0,0 @@
#define IPX 0

View File

@ -1 +0,0 @@
#define ISO 0

View File

@ -1 +0,0 @@
#define JOURNALING 1

View File

@ -1 +0,0 @@
#define KERNEL_STACK 1

View File

@ -1 +0,0 @@
#define KERNOBJC 1

View File

@ -1 +0,0 @@
#define KERNREMOTE 0

View File

@ -1 +0,0 @@
#define KERNSERV 1

View File

@ -1 +0,0 @@
#define NKPERF 0

View File

@ -1 +0,0 @@
#define NLOOP 1

View File

@ -1 +0,0 @@
#define MACH_COMPAT 1

View File

@ -1 +0,0 @@
#define MACH_COUNTERS 0

View File

@ -1 +0,0 @@
#define MACH_FASTLINK 1

View File

@ -1 +0,0 @@
#define MACH_FIXPRI 1

View File

@ -1 +0,0 @@
#define MACH_HOST 0

View File

@ -1 +0,0 @@
#define MACH_IPC_COMPAT 1

View File

@ -1 +0,0 @@
#define MACH_LDEBUG 0

View File

@ -1 +0,0 @@
#define MACH_LOAD 0

View File

@ -1 +0,0 @@
#define MACH_NET 0

View File

@ -1 +0,0 @@
#define MACH_NP 0

View File

@ -1 +0,0 @@
#define MACH_OLD_VM_COPY 1

View File

@ -1 +0,0 @@
#define MACH_PAGEMAP 0

View File

@ -1 +0,0 @@
#define MACH_SCTIMES 0

View File

@ -1 +0,0 @@
#define MACH_VM_DEBUG 0

View File

@ -1 +0,0 @@
#define MACH_XP 0

View File

@ -1 +0,0 @@
#define MACH_XP_FPD 0

Some files were not shown because too many files have changed in this diff Show More