aboutsummaryrefslogtreecommitdiffstats
path: root/meta/COPYING.MIT
blob: fb950dc69feb8afa93493747f33d6e1c02659b55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
copies of the Software, and to permit persons to whom the Software is 
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in 
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE SOFTWARE.
d.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/bin/bash
#
# Copyright (c) 2005-2009 Wind River Systems, Inc.
#
# SPDX-License-Identifier: GPL-2.0-only
#

usage() {
	echo "Usage: $0 {start|stop|restart} <nfs-export-dir>"
}

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

if [[ "$1" != "start" && "$1" != "stop" && "$1" != "restart" ]]; 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 -N -i $NFSPID -e $EXPORTS -n $NFSD_PORT -m $MOUNTD_PORT"

# See how we were called.
case "$1" in
  start)
	PORTMAP_RUNNING=`ps -ef | grep portmap | grep -v grep`
	RPCBIND_RUNNING=`ps -ef | grep rpcbind | grep -v grep`
	if [[ "x$PORTMAP_RUNNING" = "x" && "x$RPCBIND_RUNNING" = "x" ]]; then
		echo "======================================================="
		echo "Error: neither rpcbind nor portmap appear to be running"
		echo "Please install and start one of these services first"
		echo "======================================================="
		echo "Tip: for recent Ubuntu hosts, run:"
		echo "  sudo apt-get install rpcbind"
		echo "Then add OPTIONS=\"-i -w\"  to /etc/default/rpcbind and run"
		echo "  sudo service portmap restart"

		exit 1
	fi

	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} <nfs-export-dir>"
	;;
esac

exit 0