[openwrt/openwrt] ksmbd: add out-of-tree module

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 19 11:15:29 PST 2022


chunkeey pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/fbb8e1ef45fa3ebb10e653cdb14465508541350d

commit fbb8e1ef45fa3ebb10e653cdb14465508541350d
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Mon Dec 20 17:58:38 2021 -0800

    ksmbd: add out-of-tree module
    
    ksmbd is an upstream linux alternative to Samba which is lighterweight
    and more performant, especially on underpowered devices.
    
    Moving it here from the packages feed as it is now an upstream kernel
    module. Also easier to update as version updates can be coordinated better
    
    The next LTS kernel (5.15) has this included. A depend on kernel < 5.15
    will need to be added later.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 package/kernel/ksmbd/Makefile                      | 73 ++++++++++++++++++++++
 .../ksmbd/patches/01-keep_kmod_metadata.patch      | 11 ++++
 2 files changed, 84 insertions(+)

diff --git a/package/kernel/ksmbd/Makefile b/package/kernel/ksmbd/Makefile
new file mode 100644
index 0000000000..842a22c82a
--- /dev/null
+++ b/package/kernel/ksmbd/Makefile
@@ -0,0 +1,73 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ksmbd
+PKG_VERSION:=3.4.3
+PKG_RELEASE:=$(AUTORELEASE)
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/cifsd-team/cifsd/tar.gz/$(PKG_VERSION)?
+PKG_HASH:=a910c55d9e6924775e00504eddd00b49788603af29d0772cb9fb6722c189f628
+
+PKG_LICENSE:=GPL-2.0-or-later
+PKG_LICENSE_FILES:=COPYING
+
+include $(INCLUDE_DIR)/kernel.mk
+include $(INCLUDE_DIR)/package.mk
+
+TAR_OPTIONS+= --strip-components 1
+TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
+
+define KernelPackage/fs-ksmbd
+	SUBMENU:=Filesystems
+	TITLE:=SMB kernel server support
+	URL:=https://github.com/cifsd-team/cifsd
+	FILES:=$(PKG_BUILD_DIR)/ksmbd.ko
+	DEPENDS:= \
+		+kmod-nls-base \
+		+kmod-nls-utf8 \
+		+kmod-crypto-md4 \
+		+kmod-crypto-md5 \
+		+kmod-crypto-hmac \
+		+kmod-crypto-ecb \
+		+kmod-crypto-des \
+		+kmod-crypto-sha256 \
+		+kmod-crypto-cmac \
+		+kmod-crypto-sha512 \
+		+kmod-crypto-aead \
+		+kmod-crypto-ccm \
+		+kmod-crypto-gcm \
+		+kmod-asn1-decoder \
+		+kmod-oid-registry
+endef
+
+# The last two DEPENDS are hacks in order to get CONFIG_ASN1 and CONFIG_OID_REGISTRY
+# which it seems can't be selected independently. Some bug in either base or upstream.
+
+define KernelPackage/fs-ksmbd/description
+  Ksmbd is an In-kernel SMBv(1)2/3 fileserver.
+  It's an implementation of the SMB protocol in kernel space for sharing files and IPC services over network.
+endef
+
+define KernelPackage/fs-ksmbd/config
+config KSMBD_SMB_INSECURE_SERVER
+	bool "Support for insecure SMB1/CIFS and SMB2.0 protocols"
+	depends on PACKAGE_kmod-fs-ksmbd
+	help
+		This enables deprecated insecure protocols dialects: SMB1/CIFS and SMB2.0.
+	default y
+endef
+
+ifeq ($(CONFIG_KSMBD_SMB_INSECURE_SERVER),y)
+PKG_EXTRA_KCONFIG:=CONFIG_SMB_INSECURE_SERVER=y
+EXTRA_CFLAGS += -DCONFIG_SMB_INSECURE_SERVER=1
+endif
+
+define Build/Compile
+	$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" \
+	EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
+	$(PKG_EXTRA_KCONFIG) \
+	CONFIG_SMB_SERVER=m \
+	modules
+endef
+
+$(eval $(call KernelPackage,fs-ksmbd))
diff --git a/package/kernel/ksmbd/patches/01-keep_kmod_metadata.patch b/package/kernel/ksmbd/patches/01-keep_kmod_metadata.patch
new file mode 100644
index 0000000000..b2c6687d06
--- /dev/null
+++ b/package/kernel/ksmbd/patches/01-keep_kmod_metadata.patch
@@ -0,0 +1,11 @@
+--- a/glob.h
++++ b/glob.h
+@@ -7,6 +7,8 @@
+ #ifndef __KSMBD_GLOB_H
+ #define __KSMBD_GLOB_H
+ 
++#undef CONFIG_MODULE_STRIPPED
++
+ #include <linux/ctype.h>
+ 
+ #include "unicode.h"



More information about the lede-commits mailing list