hmdfs/0001-add-makefile-used-on-openeuler.patch
2023-05-16 15:01:12 +08:00

71 lines
2.5 KiB
Diff

From b4d9c6ec4b948c8e3bc0113699b8914f84531215 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 16 May 2023 11:49:24 +0800
Subject: [PATCH 1/2] add makefile used on openeuler, the new makefile could make hmdfs as a kernel object.
---
Kbuild | 17 +++++++++++++++++
Makefile | 25 +++++++++++++------------
2 files changed, 30 insertions(+), 12 deletions(-)
create mode 100644 Kbuild
diff --git a/Kbuild b/Kbuild
new file mode 100644
index 000000000000..cbb7852cb090
--- /dev/null
+++ b/Kbuild
@@ -0,0 +1,17 @@
+obj-$(CONFIG_HMDFS_FS) += hmdfs.o
+ccflags-y += -I$(src) -Werror -Wall
+ccflags-$(CONFIG_HMDFS_FS_ENCRYPTION) += -DCONFIG_HMDFS_FS_ENCRYPTION
+ccflags-$(CONFIG_HMDFS_FS_PERMISSION) += -DCONFIG_HMDFS_FS_PERMISSION
+
+hmdfs-y := main.o super.o inode.o dentry.o inode_root.o file_merge.o
+hmdfs-y += hmdfs_client.o hmdfs_server.o inode_local.o inode_remote.o
+hmdfs-y += inode_merge.o hmdfs_dentryfile.o file_root.o file_remote.o
+hmdfs-y += file_local.o client_writeback.o server_writeback.o stash.o
+hmdfs-y += hmdfs_share.o
+
+hmdfs-y += comm/device_node.o comm/message_verify.o comm/node_cb.o
+hmdfs-y += comm/connection.o comm/socket_adapter.o comm/transport.o
+
+hmdfs-$(CONFIG_HMDFS_FS_ENCRYPTION) += comm/crypto.o
+hmdfs-$(CONFIG_HMDFS_FS_PERMISSION) += authority/authentication.o
+hmdfs-$(CONFIG_HMDFS_FS_PERMISSION) += authority/config.o
diff --git a/Makefile b/Makefile
index 20896e71636a..689db2b9db1e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,16 @@
-obj-$(CONFIG_HMDFS_FS) += hmdfs.o
-ccflags-y += -I$(src)
+ifneq ($(KERNELRELEASE),)
+include Kbuild
-hmdfs-y := main.o super.o inode.o dentry.o inode_root.o file_merge.o
-hmdfs-y += hmdfs_client.o hmdfs_server.o inode_local.o inode_remote.o
-hmdfs-y += inode_merge.o hmdfs_dentryfile.o file_root.o file_remote.o
-hmdfs-y += file_local.o client_writeback.o server_writeback.o stash.o
-hmdfs-y += hmdfs_share.o
+else
+KERNELDIR := /lib/modules/$(shell rpm -aq kernel-devel | cut -d "-" -f 3,4)/build
+$(info KERNELDIR=$(KERNELDIR))
-hmdfs-y += comm/device_node.o comm/message_verify.o comm/node_cb.o
-hmdfs-y += comm/connection.o comm/socket_adapter.o comm/transport.o
+export CONFIG_HMDFS_FS := m
+export CONFIG_HMDFS_FS_ENCRYPTION := y
+export CONFIG_HMDFS_FS_PERMISSION := y
-hmdfs-$(CONFIG_HMDFS_FS_ENCRYPTION) += comm/crypto.o
-hmdfs-$(CONFIG_HMDFS_FS_PERMISSION) += authority/authentication.o
-hmdfs-$(CONFIG_HMDFS_FS_PERMISSION) += authority/config.o
+all:
+ $(MAKE) -C $(KERNELDIR) M=$$PWD modules
+clean:
+ $(MAKE) -C $(KERNELDIR) M=$$PWD clean
+endif
--
2.33.0