From 25d63ecc6d75cf2d8e8fd4a503744fbd4981c864 Mon Sep 17 00:00:00 2001 From: Cheng Renquan Date: Fri, 12 Feb 2010 03:37:58 +0800 Subject: [PATCH 3/3] integrate unifiedkernel into kernel build system original idea from carbonjiao: http://www.longene.org/forum/viewtopic.php?f=17&t=4068 Signed-off-by: Cheng Renquan --- Makefile | 4 ++ init/Kconfig | 4 +-- unifiedkernel/Kconfig | 27 ++++++++++++++++ unifiedkernel/Makefile | 68 +++++++++++++--------------------------- unifiedkernel/device/Makefile | 14 -------- unifiedkernel/fs/Makefile | 14 -------- unifiedkernel/io/Makefile | 10 ------ unifiedkernel/ke/Makefile | 22 ------------- unifiedkernel/mm/Makefile | 12 ------- unifiedkernel/msg/Makefile | 14 -------- unifiedkernel/ob/Makefile | 14 -------- unifiedkernel/ps/Makefile | 15 --------- unifiedkernel/pub/Makefile | 11 ------ unifiedkernel/reg/Makefile | 7 ---- unifiedkernel/sock/Makefile | 7 ---- 15 files changed, 54 insertions(+), 189 deletions(-) create mode 100644 unifiedkernel/Kconfig delete mode 100644 unifiedkernel/device/Makefile delete mode 100644 unifiedkernel/fs/Makefile delete mode 100644 unifiedkernel/io/Makefile delete mode 100644 unifiedkernel/ke/Makefile delete mode 100644 unifiedkernel/mm/Makefile delete mode 100644 unifiedkernel/msg/Makefile delete mode 100644 unifiedkernel/ob/Makefile delete mode 100644 unifiedkernel/ps/Makefile delete mode 100644 unifiedkernel/pub/Makefile delete mode 100644 unifiedkernel/reg/Makefile delete mode 100644 unifiedkernel/sock/Makefile diff --git a/Makefile b/Makefile index 03373bb..76ba5bd 100644 --- a/Makefile +++ b/Makefile @@ -648,6 +648,10 @@ export mod_strip_cmd ifeq ($(KBUILD_EXTMOD),) core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ +ifdef CONFIG_UNIFIED_KERNEL_MODULE +core-y += unifiedkernel/ +endif + vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ $(net-y) $(net-m) $(libs-y) $(libs-m))) diff --git a/init/Kconfig b/init/Kconfig index ea6266a..adaadab 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1042,9 +1042,7 @@ config SLOW_WORK See Documentation/slow-work.txt. -config UNIFIED_KERNEL - bool "Unified kernel support" - default 0 +source "unifiedkernel/Kconfig" endmenu # General setup diff --git a/unifiedkernel/Kconfig b/unifiedkernel/Kconfig new file mode 100644 index 0000000..fb03296 --- /dev/null +++ b/unifiedkernel/Kconfig @@ -0,0 +1,27 @@ +# +# unified kernel module configuration +# + +config UNIFIED_KERNEL + bool "Unified kernel support" + default y + select EMBEDDED + select KALLSYMS + select KALLSYMS_EXTRA_PASS + select COMPAT_BRK + select NLS_CODEPAGE_936 + ---help--- + Say Y if you want to unified kernel module support + + See http://www.longene.org/ for detail. + +if UNIFIED_KERNEL +config UNIFIED_KERNEL_MODULE + tristate "Unified kernel module" + depends on UNIFIED_KERNEL + ---help--- + Say Y if you want to use unified kernel module + + See http://www.longene.org/ for detail. + +endif diff --git a/unifiedkernel/Makefile b/unifiedkernel/Makefile index 4d2e489..cb25a41 100644 --- a/unifiedkernel/Makefile +++ b/unifiedkernel/Makefile @@ -1,49 +1,25 @@ # -# Makefile for unified kernel module in the top level directory -# - -SUB_DIRS:= ke/ \ - io/ \ - ob/ \ - ps/ \ - mm/ \ - pub/ \ - reg/ \ - msg/ \ - fs/ \ - sock/ \ - device/ - -MODULE = unifiedkernel -MOD_O = $(MODULE).o -MOD_KO = $(MODULE).ko -MOD_MOD = $(MODULE).mod -KERNEL_VER = `uname -r` -MKFILES = $(addprefix $(PWD)/, $(addsuffix Makefile, $(SUB_DIRS))) - -ifneq ($(KERNELRELEASE),) -include $(MKFILES) - obj-m := $(MODULE).o -else - KDIR := /lib/modules/$(KERNEL_VER)/build - PWD := `pwd` - - -default: - $(MAKE) -Wall -C $(KDIR) SUBDIRS=$(PWD) EXTRA_CFLAGS="-I$(PWD)/include" modules - -clean: - @echo CLEANING: Module files - @rm -rf $(MOD_O) .$(MOD_O).cmd \ - $(MOD_KO) .$(MOD_KO).cmd \ - $(MOD_MOD).c $(MOD_MOD).o .$(MOD_MOD).o.cmd\ - .tmp_versions Module.* modules.* - - @echo CLEANING: object files - @rm -f $(addsuffix *.o, $(SUB_DIRS)) - @rm -f $(addsuffix *.ko, $(SUB_DIRS)) - @rm -f $(addsuffix .*.o.cmd, $(SUB_DIRS)) - @echo make clean done! +# Makefile for the unified kernel module. +# -endif +subdir-ccflags-y := -Iunifiedkernel/include/ +obj-$(CONFIG_UNIFIED_KERNEL_MODULE) += unifiedkernel.o +unifiedkernel-y := ke/wait.o ke/misc.o ke/binfmt_pe.o ke/binfmt_exeso.o \ + ke/apc.o ke/unistr.o ke/wcstr.o ke/switch.o ke/w32syscall.o \ + ke/w32entry.o ke/w32init.o ke/sysdll.o ke/event.o \ + ke/mutex.o ke/semaphore.o ke/proc.o \ + io/io.o io/file.o io/dosdriver.o io/symlink.o \ + ob/wait.o ob/dirobj.o ob/display.o ob/handle.o ob/namespc.o \ + ob/object.o ob/symlink.o ob/ntobj.o \ + ps/process.o ps/kill.o ps/token.o ps/suspend.o ps/thread.o \ + ps/psmgr.o ps/query.o ps/cid.o ps/flush.o \ + mm/attach.o mm/process.o mm/section.o mm/virtual.o mm/datasection.o mm/imagesection.o \ + pub/request.o pub/casemap.o pub/uk_lib.o pub/info.o pub/error.o \ + reg/reg.o \ + msg/queue.o msg/window.o msg/winstation.o msg/region.o msg/atom.o \ + msg/hook.o msg/class.o msg/user.o \ + fs/fd.o fs/file.o fs/directory.o fs/change.o fs/completion.o fs/mapping.o fs/symlink.o fs/async.o \ + sock/sock.o \ + device/clipboard.o device/console.o device/named_pipe.o device/mailslot.o \ + device/device.o device/timer.o device/snapshot.o device/serial.o diff --git a/unifiedkernel/device/Makefile b/unifiedkernel/device/Makefile deleted file mode 100644 index da45f43..0000000 --- a/unifiedkernel/device/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# -# Makefile for device management -# - -DEVICE_OBJS := clipboard.o \ - console.o \ - named_pipe.o \ - mailslot.o \ - device.o \ - timer.o \ - snapshot.o \ - serial.o - -$(MODULE)-objs += $(addprefix device/, $(DEVICE_OBJS)) diff --git a/unifiedkernel/fs/Makefile b/unifiedkernel/fs/Makefile deleted file mode 100644 index d7f1f36..0000000 --- a/unifiedkernel/fs/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# -# Makefile for fs management -# - -FS_OBJS := fd.o \ - file.o \ - directory.o \ - change.o \ - completion.o \ - mapping.o \ - symlink.o \ - async.o - -$(MODULE)-objs += $(addprefix fs/, $(FS_OBJS)) diff --git a/unifiedkernel/io/Makefile b/unifiedkernel/io/Makefile deleted file mode 100644 index 3554beb..0000000 --- a/unifiedkernel/io/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# -# Makefile for io operations -# - -IO_OBJS += io.o \ - file.o \ - dosdriver.o \ - symlink.o - -$(MODULE)-objs += $(addprefix io/, $(IO_OBJS)) diff --git a/unifiedkernel/ke/Makefile b/unifiedkernel/ke/Makefile deleted file mode 100644 index a700e22..0000000 --- a/unifiedkernel/ke/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# -# Makefile for kernel execute -# - -KE_OBJS += wait.o \ - misc.o \ - binfmt_pe.o \ - binfmt_exeso.o \ - apc.o \ - unistr.o \ - wcstr.o \ - switch.o \ - w32syscall.o \ - w32entry.o \ - w32init.o \ - sysdll.o \ - event.o \ - mutex.o \ - semaphore.o \ - proc.o - -$(MODULE)-objs += $(addprefix ke/, $(KE_OBJS)) diff --git a/unifiedkernel/mm/Makefile b/unifiedkernel/mm/Makefile deleted file mode 100644 index 886d0af..0000000 --- a/unifiedkernel/mm/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# -# Makefile for memory management -# - -MM_OBJS := attach.o \ - process.o \ - section.o \ - virtual.o \ - datasection.o \ - imagesection.o - -$(MODULE)-objs += $(addprefix mm/, $(MM_OBJS)) diff --git a/unifiedkernel/msg/Makefile b/unifiedkernel/msg/Makefile deleted file mode 100644 index 0c73fe3..0000000 --- a/unifiedkernel/msg/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# -# Makefile for msg management -# - -MSG_OBJS := queue.o \ - window.o \ - winstation.o \ - region.o \ - atom.o \ - hook.o \ - class.o \ - user.o - -$(MODULE)-objs += $(addprefix msg/, $(MSG_OBJS)) diff --git a/unifiedkernel/ob/Makefile b/unifiedkernel/ob/Makefile deleted file mode 100644 index 2b437cd..0000000 --- a/unifiedkernel/ob/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# -# Makefile for object management -# - -OB_OBJS += wait.o \ - dirobj.o \ - display.o \ - handle.o \ - namespc.o \ - object.o \ - symlink.o \ - ntobj.o - -$(MODULE)-objs += $(addprefix ob/, $(OB_OBJS)) diff --git a/unifiedkernel/ps/Makefile b/unifiedkernel/ps/Makefile deleted file mode 100644 index c75f76a..0000000 --- a/unifiedkernel/ps/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# -# Makefile for process structure -# - -PS_OBJS = process.o \ - kill.o \ - token.o \ - suspend.o \ - thread.o \ - psmgr.o \ - query.o \ - cid.o \ - flush.o - -$(MODULE)-objs += $(addprefix ps/, $(PS_OBJS)) diff --git a/unifiedkernel/pub/Makefile b/unifiedkernel/pub/Makefile deleted file mode 100644 index ab4661b..0000000 --- a/unifiedkernel/pub/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# -# Makefile for pub -# - -PUB_OBJS := request.o \ - casemap.o \ - uk_lib.o \ - info.o \ - error.o - -$(MODULE)-objs += $(addprefix pub/, $(PUB_OBJS)) diff --git a/unifiedkernel/reg/Makefile b/unifiedkernel/reg/Makefile deleted file mode 100644 index b52b17d..0000000 --- a/unifiedkernel/reg/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Makefile for registry management -# - -REG_OBJS := reg.o - -$(MODULE)-objs += $(addprefix reg/, $(REG_OBJS)) diff --git a/unifiedkernel/sock/Makefile b/unifiedkernel/sock/Makefile deleted file mode 100644 index 2cdd136..0000000 --- a/unifiedkernel/sock/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Makefile for socket -# - -SOCK_OBJS := sock.o \ - -$(MODULE)-objs += $(addprefix sock/, $(SOCK_OBJS)) -- 1.6.4.2