poky/scripts/runqemu-export-rootfs
Alexander Kanavin afa94425a0 unfs: update 0.9.22 -> 0.10.0
This is the first release in 13 years;
I have reviewed the accumulated patches, and dropped some of them
where purpose or issue being fixed is not clear. Specifically:

0001-Add-listen-action-for-a-tcp-socket.patch
0001-daemon.c-Libtirpc-porting-fixes.patch
fixed upstream in
84ab475f93

0001-attr-fix-utime-for-symlink.patch
addresses an open issue in
https://github.com/unfs3/unfs3/issues/4
please rebase and re-submit as a PR if the problem is still present.

alternate_rpc_ports.patch
unnecessary as of
https://git.yoctoproject.org/poky/commit/?id=6bb9860ef7ba9c84fe9bd3a81aa6555f67ebd38e
Command line options introduced by the patch no longer used anywhere.

fix_compile_warning.patch
merged upstream.

fix_pid_race_parent_writes_child_pid.patch
rebased and re-submitted upstream.

no-yywrap.patch
dropped as backport.

relative_max_socket_path_len.patch
needs to be re-submitted by the original author, purpose and reproducer scenario unclear.

rename_fh_cache.patch
merged upstream.

tcp_no_delay.patch
purpose and use case for oe unclear.

unfs3_parallel_build.patch
fixed upstream in
987d32ca12
a39a78995c

Drop -N option from oeqa nfs helper and runqemu helper;
the option was provided by tcp_no_delay.patch
and is not needed for the tests or qemu.

Drop ad hoc libtirpc support; upstream supports it directly now.

Drop the check for portmap/rpcbind, it is unnecessary as of
https://git.yoctoproject.org/poky/commit/?id=6bb9860ef7ba9c84fe9bd3a81aa6555f67ebd38e

(From OE-Core rev: fa2f7cf545137b071db97015bca5b70d77566cd8)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-11-29 10:29:58 +00:00

3.2 KiB
Executable File

#!/bin/bash

Copyright (c) 2005-2009 Wind River Systems, Inc.

SPDX-License-Identifier: GPL-2.0-only

usage() { echo "Usage: $0 {start|stop|restart} " }

if [ $# != 2 ]; then usage exit 1 fi

if ; then echo "Unknown command '$1'" usage exit 1 fi

if [ ! -d "$2" ]; then echo "Error: '$2' does not exist" usage exit 1 fi

Ensure the nfs-export-dir is an absolute path

NFS_EXPORT_DIR=$(cd "$2" && pwd)

SYSROOT_SETUP_SCRIPT=which oe-find-native-sysroot 2> /dev/null if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then echo "Error: Unable to find the oe-find-native-sysroot script" echo "Did you forget to source your build environment setup script?" exit 1 fi . $SYSROOT_SETUP_SCRIPT meta-ide-support

if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/unfsd" ]; then echo "Error: Unable to find unfsd binary in $OECORE_NATIVE_SYSROOT/usr/bin/"

if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then
	echo "Have you run 'bitbake meta-ide-support'?"
else
	echo "This shouldn't happen - something is missing from your toolchain installation"
fi
exit 1

fi

if [ ! -d ~/.runqemu-sdk ]; then mkdir -p ~/.runqemu-sdk fi

NFS_INSTANCE=${NFS_INSTANCE:=0} EXPORTS=~/.runqemu-sdk/exports$NFS_INSTANCE RMTAB=~/.runqemu-sdk/rmtab$NFS_INSTANCE NFSPID=~/.runqemu-sdk/nfs$NFS_INSTANCE.pid MOUNTPID=~/.runqemu-sdk/mount$NFS_INSTANCE.pid

PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr" PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/../$(basename $NFS_EXPORT_DIR).pseudo_state" export PSEUDO_LOCALSTATEDIR

if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then echo "Error: $PSEUDO_LOCALSTATEDIR does not exist." echo "Did you create the export directory using runqemu-extract-sdk?" exit 1 fi

NFS server port number

NFSD_PORT=${NFSD_PORT:=$[ 3049 + 2 * $NFS_INSTANCE ]}

mountd port number

MOUNTD_PORT=${MOUNTD_PORT:=$[ 3048 + 2 * $NFS_INSTANCE ]}

For debugging you would additionally add

--debug all

UNFSD_OPTS="-p -i $NFSPID -e $EXPORTS -n $NFSD_PORT -m $MOUNTD_PORT"

See how we were called.

case "$1" in start) echo "Creating exports file..." echo "$NFS_EXPORT_DIR (rw,no_root_squash,no_all_squash,insecure)" > $EXPORTS

echo "Starting User Mode nfsd"
echo "  $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS"
$PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS
if [ ! $? = 0 ]; then
	echo "Error starting nfsd"
	exit 1
fi
# Check to make sure everything started ok.
if [ ! -f $NFSPID ]; then
	echo "rpc.nfsd did not start correctly"
	exit 1
fi
ps -fp `cat $NFSPID` > /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
	echo "rpc.nfsd did not start correctly"
	exit 1
fi
echo " "
echo "On your target please remember to add the following options for NFS"
echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=3,port=$NFSD_PORT,udp,mountport=$MOUNTD_PORT"
;;

stop) if [ -f "$NFSPID" ]; then echo "Stopping rpc.nfsd" kill cat $NFSPID rm -f $NFSPID else echo "No PID file, not stopping rpc.nfsd" fi if [ -f "$EXPORTS" ]; then echo "Removing exports file" rm -f $EXPORTS fi ;; restart) $0 stop $NFS_EXPORT_DIR $0 start $NFS_EXPORT_DIR if [ ! $? = 0 ]; then exit 1 fi ;; *) echo "$0 {start|stop|restart} " ;; esac

exit 0