Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
From 2d99ff0aa8a3b4d20558bce742edaaed9d24b3cb Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Tue, 7 Apr 2026 17:23:13 +0200
Subject: [PATCH] fh_key_file: fix missing string.h inclusion
Add #include <string.h> to fix build failure.
Upstream: https://lore.kernel.org/linux-nfs/20260408173535.3992116-1-giulio.benetti@benettiengineering.com/T/#t
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
support/nfs/fh_key_file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/nfs/fh_key_file.c b/support/nfs/fh_key_file.c
index 5f5eafc1..81ea1500 100644
--- a/support/nfs/fh_key_file.c
+++ b/support/nfs/fh_key_file.c
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
+#include <string.h>
#include <uuid/uuid.h>
#include "nfslib.h"
--
2.47.3

View File

@@ -0,0 +1,77 @@
From 218e1b572123f527bd92c17ebb7ac00c2a7e6c01 Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Tue, 7 Apr 2026 17:47:40 +0200
Subject: [PATCH] Introduce compat.h file to deal with old Linux api and fix
build failure due to missing NETLINK_EXT_ACK
In compat.h check if NETLINK_EXT_ACK exists, otherwise define it to fix
build failure and where at the moment <linux/netlink.h> is included
let's include "compat.h"
Upstream: https://lore.kernel.org/linux-nfs/20260408173535.3992116-2-giulio.benetti@benettiengineering.com/T/#u
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
support/export/cache.c | 2 +-
support/export/cache_flush.c | 2 ++
support/include/compat.h | 10 ++++++++++
utils/nfsdctl/nfsdctl.c | 1 +
4 files changed, 14 insertions(+), 1 deletion(-)
create mode 100644 support/include/compat.h
diff --git a/support/export/cache.c b/support/export/cache.c
index 2f128d7d..65008f51 100644
--- a/support/export/cache.c
+++ b/support/export/cache.c
@@ -40,7 +40,7 @@
#include <netlink/genl/ctrl.h>
#include <netlink/msg.h>
#include <netlink/attr.h>
-#include <linux/netlink.h>
+#include "compat.h"
#ifdef USE_SYSTEM_NFSD_NETLINK_H
#include <linux/nfsd_netlink.h>
diff --git a/support/export/cache_flush.c b/support/export/cache_flush.c
index ed7b964f..2a24dec7 100644
--- a/support/export/cache_flush.c
+++ b/support/export/cache_flush.c
@@ -38,6 +38,8 @@ extern int no_netlink;
#include "sunrpc_netlink.h"
#endif
+#include "compat.h"
+
static int nl_send_flush(struct nl_sock *sock, int family, int cmd)
{
struct nl_msg *msg;
diff --git a/support/include/compat.h b/support/include/compat.h
new file mode 100644
index 00000000..83229b65
--- /dev/null
+++ b/support/include/compat.h
@@ -0,0 +1,10 @@
+#ifndef COMPAT_H
+#define COMPAT_H
+
+#include <linux/netlink.h>
+
+#ifndef NETLINK_EXT_ACK
+#define NETLINK_EXT_ACK 11
+#endif
+
+#endif /* COMPAT_H */
diff --git a/utils/nfsdctl/nfsdctl.c b/utils/nfsdctl/nfsdctl.c
index 016dd2eb..c7126748 100644
--- a/utils/nfsdctl/nfsdctl.c
+++ b/utils/nfsdctl/nfsdctl.c
@@ -26,6 +26,7 @@
#include <netlink/msg.h>
#include <netlink/attr.h>
#include <linux/netlink.h>
+#include "compat.h"
#include <readline/readline.h>
#include <readline/history.h>
--
2.47.3

View File

@@ -0,0 +1,30 @@
From dbd44e7d6d4140e5e9d01f0a6daf6f3e45e5acbc Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Wed, 8 Apr 2026 14:28:28 +0200
Subject: [PATCH] support/backend_sqlite.c: fix getrandom() fallback
In old Linux/Glibc versions __NR_getrandom is defined in <sys/random.h>
so let's add it to fix build failure.
Upstream: https://lore.kernel.org/linux-nfs/20260408173535.3992116-3-giulio.benetti@benettiengineering.com/T/#u
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
support/reexport/backend_sqlite.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/support/reexport/backend_sqlite.c b/support/reexport/backend_sqlite.c
index 0eb5ea37..a1e981e4 100644
--- a/support/reexport/backend_sqlite.c
+++ b/support/reexport/backend_sqlite.c
@@ -9,6 +9,8 @@
#include <string.h>
#include <unistd.h>
+#include <sys/syscall.h>
+
#ifdef HAVE_GETRANDOM
# include <sys/random.h>
# if !defined(SYS_getrandom) && defined(__NR_getrandom)
--
2.47.3

View File

@@ -0,0 +1,68 @@
comment "nfs-utils needs a toolchain w/ threads, headers >= 3.17"
depends on BR2_USE_MMU
depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17
config BR2_PACKAGE_NFS_UTILS
bool "nfs-utils"
depends on BR2_TOOLCHAIN_HAS_THREADS # libtirpc, rpcbind
depends on BR2_USE_MMU # fork()
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17 # getrandom()
select BR2_PACKAGE_LIBEVENT
select BR2_PACKAGE_LIBNL
select BR2_PACKAGE_LIBTIRPC # IPv6 requires libtirpc
select BR2_PACKAGE_LIBTIRPC_RPCDB
select BR2_PACKAGE_SQLITE
select BR2_PACKAGE_UTIL_LINUX
select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
select BR2_PACKAGE_UTIL_LINUX_LIBMOUNT
select BR2_PACKAGE_UTIL_LINUX_LIBUUID
help
The NFS Linux kernel server.
Supports NFSv3 and optionally NFSv4 (and later).
http://linux-nfs.org/
if BR2_PACKAGE_NFS_UTILS
config BR2_PACKAGE_NFS_UTILS_NFSV4
bool "NFSv4/NFSv4.1"
depends on !BR2_STATIC_LIBS # keyutils
select BR2_PACKAGE_KEYUTILS
select BR2_PACKAGE_LVM2
help
Enable NFSv4/NFSv4.1/NFSv4.2 support
comment "NFSv4/NFSv4.1 support needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS
config BR2_PACKAGE_NFS_UTILS_GSS
bool "gss"
depends on BR2_PACKAGE_NFS_UTILS_NFSV4
select BR2_PACKAGE_LIBTIRPC_GSS
help
Enable GSS support
config BR2_PACKAGE_NFS_UTILS_RPCDEBUG
bool "rpcdebug"
help
The RPC debugging utility
config BR2_PACKAGE_NFS_UTILS_RPC_LOCKD
bool "rpc.lockd"
help
NFS lock manager for Linux kernels older than 2.4
config BR2_PACKAGE_NFS_UTILS_RPC_NFSD
bool "rpc.nfsd"
default y
select BR2_PACKAGE_RPCBIND # runtime
help
NFS server
config BR2_PACKAGE_NFS_UTILS_RPC_RQUOTAD
bool "rpc.rquotad"
help
NFS remote quota server
endif

83
package/nfs-utils/S60nfs Normal file
View File

@@ -0,0 +1,83 @@
#!/bin/sh
#
# nfs This shell script takes care of starting and stopping
# the NFS services. Stolen from RedHat FC5.
mkdir -p /var/lock/subsys
mkdir -p /run/nfs/sm
mkdir -p /run/nfs/sm.bak
touch /run/nfs/rmtab
CFG_FILE=/etc/default/nfsd
NR_THREADS=2
if [ -f "${CFG_FILE}" ]; then
. "${CFG_FILE}"
fi
start() {
# Start daemons.
printf "Starting NFS statd: "
rpc.statd
[ $? = 0 ] && echo "OK" || echo "FAIL"
touch /var/lock/subsys/nfslock
printf "Starting NFS services: "
/usr/sbin/exportfs -r
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Starting NFS daemon: "
rpc.nfsd ${NR_THREADS}
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Starting NFS mountd: "
rpc.mountd
[ $? = 0 ] && echo "OK" || echo "FAIL"
touch /var/lock/subsys/nfs
}
stop() {
# Stop daemons.
printf "Shutting down NFS mountd: "
killall -q rpc.mountd 2>/dev/null
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Shutting down NFS daemon: "
killall -q nfsd 2>/dev/null
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Shutting down NFS services: "
/usr/sbin/exportfs -au
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Stopping NFS statd: "
killall -q rpc.statd 2>/dev/null
[ $? = 0 ] && echo "OK" || echo "FAIL"
rm -f /var/lock/subsys/nfs
rm -f /var/run/rpc.statd.pid
rm -f /var/lock/subsys/nfslock
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
/usr/sbin/exportfs -r
touch /var/lock/subsys/nfs
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit 0

View File

@@ -0,0 +1,4 @@
# From https://www.kernel.org/pub/linux/utils/nfs-utils/2.9.1/sha256sums.asc
sha256 302846343bf509f8f884c23bdbd0fe853b7f7cbb6572060a9082279d13b21a2c nfs-utils-2.9.1.tar.xz
# Locally computed
sha256 576540abf5e95029ad4ad90e32071385a5e95b2c30708c706116f3eb87b9a3de COPYING

View File

@@ -0,0 +1,127 @@
################################################################################
#
# nfs-utils
#
################################################################################
NFS_UTILS_VERSION = 2.9.1
NFS_UTILS_SOURCE = nfs-utils-$(NFS_UTILS_VERSION).tar.xz
NFS_UTILS_SITE = https://www.kernel.org/pub/linux/utils/nfs-utils/$(NFS_UTILS_VERSION)
NFS_UTILS_LICENSE = GPL-2.0+
NFS_UTILS_LICENSE_FILES = COPYING
NFS_UTILS_DEPENDENCIES = host-nfs-utils host-pkgconf libevent libnl libtirpc sqlite util-linux
NFS_UTILS_CPE_ID_VENDOR = linux-nfs
NFS_UTILS_CONF_ENV = knfsd_cv_bsd_signals=no
NFS_UTILS_CONF_OPTS = \
--enable-tirpc \
--enable-ipv6 \
--disable-junction \
--disable-nfsdctl \
--without-tcp-wrappers \
--with-statedir=/run/nfs \
--with-rpcgen=$(HOST_DIR)/bin/rpcgen
HOST_NFS_UTILS_DEPENDENCIES = host-pkgconf host-libtirpc host-libevent host-libnl host-sqlite host-util-linux
HOST_NFS_UTILS_CONF_OPTS = \
--enable-tirpc \
--disable-nfsv4 \
--disable-blkmapd \
--disable-gss \
--disable-uuid \
--disable-ipv6 \
--disable-junction \
--disable-nfsdctl \
--without-tcp-wrappers \
--with-statedir=/run/nfs \
--disable-caps \
--disable-nfsrahead \
--without-systemd \
--with-rpcgen=internal \
--with-tirpcinclude=$(HOST_DIR)/include/tirpc
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
NFS_UTILS_TARGETS_$(BR2_PACKAGE_NFS_UTILS_RPC_NFSD) += usr/sbin/exportfs \
usr/sbin/rpc.mountd usr/sbin/rpc.nfsd usr/lib/systemd/system/nfs-server.service \
usr/sbin/fsidd usr/lib/systemd/system/fsidd.service
ifeq ($(BR2_PACKAGE_NFS_UTILS_NFSV4),y)
NFS_UTILS_CONF_OPTS += --enable-nfsv4 --enable-blkmapd
NFS_UTILS_DEPENDENCIES += keyutils lvm2
else
NFS_UTILS_CONF_OPTS += --disable-nfsv4 --disable-blkmapd
endif
ifeq ($(BR2_PACKAGE_NFS_UTILS_GSS),y)
NFS_UTILS_CONF_OPTS += \
--enable-gss \
--enable-svcgss \
--with-krb5=$(STAGING_DIR)/usr
NFS_UTILS_DEPENDENCIES += libkrb5
else
NFS_UTILS_CONF_OPTS += --disable-gss --disable-svcgss
endif
ifeq ($(BR2_PACKAGE_LIBCAP),y)
NFS_UTILS_CONF_OPTS += --enable-caps
NFS_UTILS_DEPENDENCIES += libcap
else
NFS_UTILS_CONF_OPTS += --disable-caps
endif
define NFS_UTILS_INSTALL_FIXUP
cd $(TARGET_DIR) && rm -f $(NFS_UTILS_TARGETS_)
touch $(TARGET_DIR)/etc/exports
$(INSTALL) -D -m 644 \
$(@D)/utils/mount/nfsmount.conf $(TARGET_DIR)/etc/nfsmount.conf
endef
NFS_UTILS_POST_INSTALL_TARGET_HOOKS += NFS_UTILS_INSTALL_FIXUP
ifeq ($(BR2_INIT_SYSTEMD),y)
NFS_UTILS_CONF_OPTS += --with-systemd=/usr/lib/systemd/system
NFS_UTILS_DEPENDENCIES += systemd host-systemd
else
NFS_UTILS_CONF_OPTS += --without-systemd
endif
ifeq ($(BR2_PACKAGE_NFS_UTILS_RPC_NFSD),y)
define NFS_UTILS_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_NFSD)
endef
define NFS_UTILS_INSTALL_INIT_SYSV
$(INSTALL) -D -m 0755 package/nfs-utils/S60nfs \
$(TARGET_DIR)/etc/init.d/S60nfs
endef
endif
define NFS_UTILS_INSTALL_INIT_SYSTEMD
$(INSTALL) -D -m 0755 package/nfs-utils/nfs-utils_env.sh \
$(TARGET_DIR)/usr/libexec/nfs-utils/nfs-utils_env.sh
$(INSTALL) -D -m 0644 package/nfs-utils/nfs-utils_tmpfiles.conf \
$(TARGET_DIR)/usr/lib/tmpfiles.d/nfs-utils.conf
endef
define NFS_UTILS_REMOVE_NFSIOSTAT
rm -f $(TARGET_DIR)/usr/sbin/nfsiostat
endef
# nfsiostat is interpreted python, so remove it unless it's in the target
NFS_UTILS_POST_INSTALL_TARGET_HOOKS += $(if $(BR2_PACKAGE_PYTHON3),,NFS_UTILS_REMOVE_NFSIOSTAT)
define HOST_NFS_UTILS_BUILD_CMDS
$(MAKE) -C $(@D)/tools/rpcgen
endef
define HOST_NFS_UTILS_INSTALL_CMDS
$(INSTALL) -D -m 0755 $(@D)/tools/rpcgen/rpcgen $(HOST_DIR)/bin/rpcgen
endef
$(eval $(autotools-package))
$(eval $(host-autotools-package))

View File

@@ -0,0 +1,3 @@
#!/bin/sh
# This script is empty, it simply needs to exist to make the
# nfs-config.service happy.

View File

@@ -0,0 +1,4 @@
d /run/nfs/sm 0700 root root -
d /run/nfs/sm.bak 0700 root root -
f /run/nfs/rmtab 0644 root root -
f /run/nfs/etab 0644 root root -