From 3c007f28f42f80cd436338337fcb848b5baa4290 Mon Sep 17 00:00:00 2001 From: Kari Hormi Date: Wed, 7 Jun 2017 15:04:30 +0300 Subject: Jetson-TX1: Add ability to mount root via NFS Added new init script that can also mount NFS root. The original init script from meta-tegra layer can only mount from local disk partitions, so an enhanced version of the script was written. While primarily written for RTA testing, end users may find the ability to mount from NFS useful. Task-number: QTBUG-61190 Change-Id: I76af558f2a528862ca1f88dcb4958a5686b508f5 Reviewed-by: Samuli Piippo --- .../initscripts/tegra210-minimal-init/init-boot.sh | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 meta-tegra-extras/recipes/initscripts/tegra210-minimal-init/init-boot.sh (limited to 'meta-tegra-extras/recipes/initscripts/tegra210-minimal-init/init-boot.sh') diff --git a/meta-tegra-extras/recipes/initscripts/tegra210-minimal-init/init-boot.sh b/meta-tegra-extras/recipes/initscripts/tegra210-minimal-init/init-boot.sh new file mode 100644 index 0000000..3e43b60 --- /dev/null +++ b/meta-tegra-extras/recipes/initscripts/tegra210-minimal-init/init-boot.sh @@ -0,0 +1,44 @@ +#!/bin/sh +PATH=/sbin:/bin:/usr/sbin:/usr/bin +mount -t proc proc /proc +mount -t devtmpfs none /dev +mount -t sysfs sysfs /sys + +rootdev="" +opt="rw" +wait="" +nfsroot="" +nfsopts="" +for bootarg in `cat /proc/cmdline`; do + case "$bootarg" in + root=*) rootdev="${bootarg##root=}" ;; + nfsroot=*) + nfsroot=$(echo ${bootarg##nfsroot=} | cut -d ',' -f 1) + nfsopts=$(echo ${bootarg##nfsroot=} | cut -d ',' -f 2-) + nfsopts=${nfsopts##${nfsroot}} + ;; + ro) opt="ro" ;; + rootwait) wait="yes" ;; + esac +done +if [ -n "$wait" -a ! -b "${rootdev}" ]; then + echo "Waiting for ${rootdev}..." + count=0 + while [ $count -lt 25 ]; do + test -b "${rootdev}" && break + sleep 0.1 + count=`expr $count + 1` + done +fi +echo "Mounting ${rootdev}..." +if [ "$rootdev" = "/dev/nfs" ]; then + echo "Using NFS to boot..." + mount -t nfs -o "${opt},${nfsopts}" "${nfsroot}" /mnt || exec sh +else + mount -t ext4 -o "$opt" "${rootdev}" /mnt || exec sh +fi +echo "Switching to rootfs on ${rootdev}..." +mount --move /sys /mnt/sys +mount --move /proc /mnt/proc +mount --move /dev /mnt/dev +exec switch_root /mnt /sbin/init -- cgit v1.2.3-54-g00ecf