summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2012-09-12 09:59:44 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2012-09-12 10:28:47 +0200
commit5088c1283a382526a63a881b869ac3321d78211e (patch)
tree609e94408d951aa0bc12563f292d7a18a87583e7
parent023cdbc74b8235740b0cf01b03a994b2f74ea547 (diff)
downloadptxdist-5088c1283a382526a63a881b869ac3321d78211e.tar.gz
ptxdist-5088c1283a382526a63a881b869ac3321d78211e.tar.xz
ptxdist: add command to export the nfsroot with a userspace nfsd
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-xbin/ptxdist5
-rw-r--r--config/boardsetup/Kconfig8
-rw-r--r--rules/post/ptxd_make_nfsd.make15
-rw-r--r--scripts/lib/ptxd_make_nfsd.sh40
4 files changed, 68 insertions, 0 deletions
diff --git a/bin/ptxdist b/bin/ptxdist
index b8b5e995c..ff9dfa499 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -876,6 +876,7 @@ Misc:
test <testname> run tests
newpackage <type> create a new package Makefile in a rules dir
use 'newpackage help' for a longer description
+ nfsroot run a userspace NFS server and export the nfsroot
print <var> print the contents of a variable, in the way
it is known by "make"
bash enter a ptxdist environment bash shell
@@ -1800,6 +1801,10 @@ EOF
ptxd_template_new "${1}"
exit
;;
+ nfsroot)
+ ptxd_make_log ptxd_make_nfsd
+ exit
+ ;;
print)
check_config &&
if [ -z "${1}" ]; then
diff --git a/config/boardsetup/Kconfig b/config/boardsetup/Kconfig
index 1fdcfbdec..82e0629c2 100644
--- a/config/boardsetup/Kconfig
+++ b/config/boardsetup/Kconfig
@@ -62,6 +62,14 @@ config BOARDSETUP_ETH_INTERFACE
If running virtual hardware (simulated by qemu/kvm), qemu needs to know
about a tap interface for virtual networking. Specify it here.
+config BOARDSETUP_NFSPORT
+ int
+ prompt "NFS service port"
+ default 2049
+ help
+ When exporting the rootfs with unfsd, this port will be used as NFS
+ service and MOUNT service port
+
endmenu
menu "Host's Serial Configuration "
diff --git a/rules/post/ptxd_make_nfsd.make b/rules/post/ptxd_make_nfsd.make
new file mode 100644
index 000000000..87ba9fe85
--- /dev/null
+++ b/rules/post/ptxd_make_nfsd.make
@@ -0,0 +1,15 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2012 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ptxd_make_nfsd: $(STATEDIR)/host-unfs3.install.post $(STATEDIR)/world.targetinstall
+ @$(call image/env) \
+ ptxd_make_nfsd
+
+# vim: syntax=make
diff --git a/scripts/lib/ptxd_make_nfsd.sh b/scripts/lib/ptxd_make_nfsd.sh
new file mode 100644
index 000000000..56e50681a
--- /dev/null
+++ b/scripts/lib/ptxd_make_nfsd.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# Copyright (C) 2012 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ptxd_make_nfsd_exec() {
+ local port
+ local root="/$(basename "${ptx_nfsroot}")"
+ local base="$(dirname "${ptx_nfsroot}")"
+
+ if ! port="$(ptxd_get_kconfig "${PTXDIST_BOARDSETUP}" "PTXCONF_BOARDSETUP_NFSPORT")"; then
+ port=2049
+ fi
+
+ echo
+ echo "Mount rootfs with nfsroot=${root},v3,tcp,port=${port},mountport=${port}"
+ echo
+
+ echo "${root} (rw,no_root_squash)" > "${PTXDIST_TEMPDIR}/exports" &&
+ UNFS_BASE="${base}" unfsd -e "${PTXDIST_TEMPDIR}/exports" -n ${port} -m ${port} -p -d
+}
+export -f ptxd_make_nfsd_exec
+
+ptxd_make_nfsd() {
+ ptxd_make_image_init &&
+ ptxd_get_ipkg_files ${image_pkgs_selected_target} &&
+
+ cd "${ptx_nfsroot}" &&
+ {
+ ptxd_dopermissions "${ptxd_reply_perm_files[@]}"
+ echo ptxd_make_nfsd_exec
+ } | fakeroot --
+}
+export -f ptxd_make_nfsd
+