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 ++++++++++++++++++++++ .../initscripts/tegra210-minimal-init_%.bbappend | 33 ++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 meta-tegra-extras/recipes/initscripts/tegra210-minimal-init/init-boot.sh create mode 100644 meta-tegra-extras/recipes/initscripts/tegra210-minimal-init_%.bbappend 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 diff --git a/meta-tegra-extras/recipes/initscripts/tegra210-minimal-init_%.bbappend b/meta-tegra-extras/recipes/initscripts/tegra210-minimal-init_%.bbappend new file mode 100644 index 0000000..788524a --- /dev/null +++ b/meta-tegra-extras/recipes/initscripts/tegra210-minimal-init_%.bbappend @@ -0,0 +1,33 @@ +############################################################################ +## +## Copyright (C) 2017 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the Boot to Qt meta layer. +## +## $QT_BEGIN_LICENSE:GPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 or (at your option) any later version +## approved by the KDE Free Qt Foundation. The licenses are as published by +## the Free Software Foundation and appearing in the file LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################ + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI += "\ + file://init-boot.sh \ + " -- cgit v1.2.3-54-g00ecf