Skip to contentSkip to conversation

Add NFSv4 config option for nfs-utils

Buildroot New Martin Hicks 1 participant 4 messages Mar 1, 2011

lore
Share & tools
lore
#0 lore raw

This set of three patches adds a config option to enable NFSv4 in nfs-utils. There is an extra library dependency that I had to add as a new package, and an additional skeleton config file that is installed into /etc on the target.

I did find out that the "comment" block in Config.in stops Kconfig from properly indenting BR2_PACKAGE_<FOO>_<SUBOPTION> from being intended properly, so I moved it to the end of the file. It still appears correctly when one of the toolchain dependencies is not available.

Please let me know if there are any changes you'd like me to do.

#1 lore raw

PATCH 1/1 Add package libnfsidmap

Needed for NFSv4 support in nfs-utils

---
 package/Config.in                  |    1 +
 package/libnfsidmap/Config.in      |    6 ++++++
 package/libnfsidmap/libnfsidmap.mk |   11 +++++++++++
 3 files changed, 18 insertions(+), 0 deletions(-)
 create mode 100644 package/libnfsidmap/Config.in
 create mode 100644 package/libnfsidmap/libnfsidmap.mk
package/Config.in +1 -0
index 1b8eace..8690d95 100644
@@ -314,6 +314,7 @@ source "package/libeXosip2/Config.in"
 source "package/libidn/Config.in"
 source "package/libmicrohttpd/Config.in"
 source "package/neon/Config.in"
+source "package/libnfsidmap/Config.in"
 source "package/libnl/Config.in"
 source "package/libpcap/Config.in"
 source "package/libosip2/Config.in"
package/libnfsidmap/Config.in new file +6 -0
new file mode 100644
index 0000000..686401e
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_LIBNFSIDMAP
+	bool "libnfsidmap"
+	help
+	  Library used by the NFSv4 server to do userid mapping.
+
+	  http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap/
package/libnfsidmap/libnfsidmap.mk new file +11 -0
new file mode 100644
index 0000000..bbdd65d
@@ -0,0 +1,11 @@
+#
+# libnfsidmap
+#
+LIBNFSIDMAP_VERSION = 0.24
+LIBNFSIDMAP_SOURCE = libnfsidmap-$(LIBNFSIDMAP_VERSION).tar.gz
+LIBNFSIDMAP_SITE = http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap
+
+LIBNFSIDMAP_INSTALL_TARGET = YES
+LIBNFSIDMAP_INSTALL_STAGING = YES
+
+$(eval $(call AUTOTARGETS,package,libnfsidmap))
Signature · 1 line
1.5.6.5
#2 lore raw

PATCH 1/1 nfs-utils: Add a Config option to enable NFSv4 support

I moved the Kconfig 'comment' block for nfs-utils to the end of the file so indentation would work properly for the items dependent on BR2_PACKAGE_NFS_UTILS

---
 package/nfs-utils/Config.in    |   17 ++++++++++++++---
 package/nfs-utils/nfs-utils.mk |    7 ++++++-
 2 files changed, 20 insertions(+), 4 deletions(-)
package/nfs-utils/Config.in +14 -3
index 774395b..753bdf5 100644
@@ -9,9 +9,6 @@ config BR2_PACKAGE_NFS_UTILS
 
 	  http://sourceforge.net/projects/nfs
 
-comment "nfs-utils requires a toolchain with RPC and LARGEFILE support"
-	depends on !BR2_INET_RPC || !BR2_LARGEFILE
-
 menu "NFS utilities selection"
 	depends on BR2_PACKAGE_NFS_UTILS
 
@@ -34,3 +31,17 @@ config BR2_PACKAGE_NFS_UTILS_RPC_RQUOTAD
 	  NFS remote quota server
 
 endmenu
+
+config BR2_PACKAGE_NFS_UTILS_NFS4
+	bool "NFSv4 support"
+	depends on BR2_PACKAGE_NFS_UTILS
+	select BR2_PACKAGE_LIBEVENT
+	select BR2_PACKAGE_LIBNFSIDMAP
+	help
+	  Support for NFSv4.  Don't forget to enable the kernel facility
+	  also.
+
+
+comment "nfs-utils requires a toolchain with RPC and LARGEFILE support"
+	depends on !BR2_INET_RPC || !BR2_LARGEFILE
+
package/nfs-utils/nfs-utils.mk +6 -1
index 382676c..e82c2b0 100644
@@ -10,13 +10,18 @@ NFS_UTILS_SITE = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge
 NFS_UTILS_CONF_ENV = knfsd_cv_bsd_signals=no
 
 NFS_UTILS_CONF_OPT = \
-		--disable-nfsv4 \
 		--disable-gss \
 		--disable-tirpc \
 		--disable-uuid \
 		--without-tcp-wrappers \
 		--with-rpcgen=internal
 
+ifneq ($(BR2_PACKAGE_NFS_UTILS_NFS4),y)
+  NFS_UTILS_CONF_OPT += --disable-nfsv4
+else
+  NFS_UTILS_DEPENDENCIES = libevent libnfsidmap
+endif
+
 NFS_UTILS_TARGETS_$(BR2_PACKAGE_NFS_UTILS_RPCDEBUG) += usr/sbin/rpcdebug
 NFS_UTILS_TARGETS_$(BR2_PACKAGE_NFS_UTILS_RPC_LOCKD) += usr/sbin/rpc.lockd
 NFS_UTILS_TARGETS_$(BR2_PACKAGE_NFS_UTILS_RPC_RQUOTAD) += usr/sbin/rpc.rquotad
Signature · 1 line
1.5.6.5
#3 lore raw

PATCH 1/1 nfs-utils: initscript support for nfsv4 and idmapd config file

This adds a variable to enable NFSv4 to the nfs initscript. It mounts additional pseudo filesystems required and starts the idmapd daemon.

---
 package/nfs-utils/S60nfs       |   16 ++++++++++++++++
 package/nfs-utils/idmapd.conf  |   10 ++++++++++
 package/nfs-utils/nfs-utils.mk |    8 ++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 package/nfs-utils/idmapd.conf
package/nfs-utils/S60nfs +16 -0
index 49dab70..fe472f1 100755
@@ -3,10 +3,15 @@
 # nfs           This shell script takes care of starting and stopping
 #               the NFS services. Stolen from RedHat FC5.
 
+ENABLEv4=no
+
 [ -x /usr/sbin/rpc.statd ] || exit 0
 [ -x /usr/sbin/rpc.nfsd ] || exit 0
 [ -x /usr/sbin/rpc.mountd ] || exit 0
 [ -x /usr/sbin/exportfs ] || exit 0
+if [ $ENABLEv4 == "yes" ]; then
+	[ -x /usr/sbin/rpc.idmapd ] || exit 0
+fi
 
 # Don't fail if /etc/exports doesn't exist; create a bare-bones version and continue.
 [ -r /etc/exports ] || \
@@ -20,6 +25,13 @@ touch /var/lib/nfs/etab
 touch /var/lib/nfs/rmtab
 touch /var/lib/nfs/state
 touch /var/lib/nfs/xtab
+if [ $ENABLEv4 == "yes" ]; then
+  [ -d /var/lib/nfs/v4recovery ] || mkdir -p /var/lib/nfs/v4recovery
+  [ -d /var/lib/nfs/rpc_pipefs ] || mkdir -p /var/lib/nfs/rpc_pipefs
+  if ! ( grep -q rpc_pipefs /proc/mounts ); then
+    mount -t rpc_pipefs none /var/lib/nfs/rpc_pipefs
+  fi
+fi
 
 start() {
 	# Start daemons.
@@ -31,6 +43,9 @@ start() {
 	echo -n "Starting NFS services: "
 	/usr/sbin/exportfs -r
 	rpc.statd
+	if [ $ENABLEv4 == "yes" ]; then
+		/usr/sbin/rpc.idmapd
+	fi
 	echo "done"
 
 	echo -n "Starting NFS daemon: "
@@ -57,6 +72,7 @@ stop() {
 	/usr/sbin/exportfs -au
 	rm -f /var/lock/subsys/nfs
 	killall -q rpc.statd
+	killall -q rpc.idmapd
 	echo "done"
 
 	echo -n "Stopping NFS statd: "
package/nfs-utils/idmapd.conf new file +10 -0
new file mode 100644
index 0000000..8325982
@@ -0,0 +1,10 @@
+[General]
+
+Verbosity = 0
+Pipefs-Directory = /var/lib/nfs/rpc_pipefs
+Domain = localdomain
+
+[Mapping]
+
+Nobody-User = nobody
+Nobody-Group = nogroup
package/nfs-utils/nfs-utils.mk +8 -0
index e82c2b0..2673e02 100644
@@ -32,6 +32,14 @@ define NFS_UTILS_INSTALL_FIXUP
 	rm -f $(NFS_UTILS_TARGETS_)
 endef
 
+define NFS_UTILS_INSTALL_IDMAPD_CONF
+	$(INSTALL) -m 0644 package/nfs-utils/idmapd.conf \
+		$(TARGET_DIR)/etc/idmapd.conf
+endef
+
 NFS_UTILS_POST_INSTALL_TARGET_HOOKS += NFS_UTILS_INSTALL_FIXUP
+ifeq ($(BR2_PACKAGE_NFS_UTILS_NFS4),y)
+  NFS_UTILS_POST_INSTALL_TARGET_HOOKS += NFS_UTILS_INSTALL_IDMAPD_CONF
+endif
 
 $(eval $(call AUTOTARGETS,package,nfs-utils))
Signature · 1 line
1.5.6.5