diff options
author | Oleksii Konoplitskyi <okonopli@cisco.com> | 2018-05-25 16:56:48 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-09 22:48:39 +0100 |
commit | f94c0c8e6fd2e730ead43c553bffe8014dec7710 (patch) | |
tree | 64298cfb1b4b50964afaf97026eec39f7f48ff32 /meta/recipes-core/initrdscripts/initramfs-framework | |
parent | cfd0c39fbf611ed428c0fe8dc39bd61081ff664e (diff) | |
download | poky-f94c0c8e6fd2e730ead43c553bffe8014dec7710.tar.gz |
initramfs-framework: add nfsrootfs module
nfsrootfs module mounts rootfs via nfs parsing "nfsroot" and "ip" cmdline options.
(From OE-Core rev: d1737f2dabac5e338061863c78a91b4c115365c7)
Signed-off-by: Oleksii Konoplitskyi <okonopli@cisco.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initrdscripts/initramfs-framework')
-rw-r--r-- | meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs new file mode 100644 index 0000000000..e67ee4c25d --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs | |||
@@ -0,0 +1,48 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | nfsrootfs_enabled() { | ||
4 | if [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then | ||
5 | return 1 | ||
6 | fi | ||
7 | return 0 | ||
8 | } | ||
9 | |||
10 | nfsrootfs_run() { | ||
11 | local nfs_opts | ||
12 | local location | ||
13 | local flags | ||
14 | local server_ip | ||
15 | |||
16 | nfs_opts="" | ||
17 | if [ "${bootparam_nfsroot#*,}" != "${bootparam_nfsroot}" ]; then | ||
18 | nfs_opts="-o ${bootparam_nfsroot#*,}" | ||
19 | fi | ||
20 | |||
21 | location="${bootparam_nfsroot%%,*}" | ||
22 | if [ "${location#*:}" = "${location}" ]; then | ||
23 | # server-ip not given. Get server ip from ip option | ||
24 | server_ip="" | ||
25 | if [ "${bootparam_ip#*:}" != "${bootparam_ip}" ]; then | ||
26 | server_ip=$(echo "$bootparam_ip" | cut -d: -f2) | ||
27 | fi | ||
28 | |||
29 | if [ -z "$server_ip" ]; then | ||
30 | fatal "Server IP is not set. Update ip or nfsroot options." | ||
31 | fi | ||
32 | location=${server_ip}:${location} | ||
33 | fi | ||
34 | |||
35 | flags="-o nolock" | ||
36 | if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then | ||
37 | if [ -n "$bootparam_rootflags" ]; then | ||
38 | bootparam_rootflags="$bootparam_rootflags," | ||
39 | fi | ||
40 | bootparam_rootflags="${bootparam_rootflags}ro" | ||
41 | fi | ||
42 | if [ -n "$bootparam_rootflags" ]; then | ||
43 | flags="$flags -o $bootparam_rootflags" | ||
44 | fi | ||
45 | |||
46 | mount -t nfs ${flags} ${nfs_opts} ${location} ${ROOTFS_DIR} | ||
47 | } | ||
48 | |||