加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-add-makefile-used-on-openeuler.patch 2.52 KB
一键复制 编辑 原始数据 按行查看 历史
天宇 提交于 2023-09-14 17:21 . init: add source tar, spec, patch.
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化