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 | |
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')
-rw-r--r-- | meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs | 48 | ||||
-rw-r--r-- | meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 7 |
2 files changed, 55 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 | |||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb index 75d965f069..6337b998ac 100644 --- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | |||
@@ -9,6 +9,7 @@ inherit allarch | |||
9 | 9 | ||
10 | SRC_URI = "file://init \ | 10 | SRC_URI = "file://init \ |
11 | file://exec \ | 11 | file://exec \ |
12 | file://nfsrootfs \ | ||
12 | file://rootfs \ | 13 | file://rootfs \ |
13 | file://finish \ | 14 | file://finish \ |
14 | file://mdev \ | 15 | file://mdev \ |
@@ -24,6 +25,7 @@ do_install() { | |||
24 | 25 | ||
25 | # base | 26 | # base |
26 | install -m 0755 ${WORKDIR}/init ${D}/init | 27 | install -m 0755 ${WORKDIR}/init ${D}/init |
28 | install -m 0755 ${WORKDIR}/nfsrootfs ${D}/init.d/85-nfsrootfs | ||
27 | install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs | 29 | install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs |
28 | install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish | 30 | install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish |
29 | 31 | ||
@@ -53,6 +55,7 @@ PACKAGES = "${PN}-base \ | |||
53 | initramfs-module-mdev \ | 55 | initramfs-module-mdev \ |
54 | initramfs-module-udev \ | 56 | initramfs-module-udev \ |
55 | initramfs-module-e2fs \ | 57 | initramfs-module-e2fs \ |
58 | initramfs-module-nfsrootfs \ | ||
56 | initramfs-module-rootfs \ | 59 | initramfs-module-rootfs \ |
57 | initramfs-module-debug \ | 60 | initramfs-module-debug \ |
58 | " | 61 | " |
@@ -83,6 +86,10 @@ SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystem | |||
83 | RDEPENDS_initramfs-module-e2fs = "${PN}-base" | 86 | RDEPENDS_initramfs-module-e2fs = "${PN}-base" |
84 | FILES_initramfs-module-e2fs = "/init.d/10-e2fs" | 87 | FILES_initramfs-module-e2fs = "/init.d/10-e2fs" |
85 | 88 | ||
89 | SUMMARY_initramfs-module-nfsrootfs = "initramfs support for locating and mounting the root partition via nfs" | ||
90 | RDEPENDS_initramfs-module-nfsrootfs = "${PN}-base" | ||
91 | FILES_initramfs-module-nfsrootfs = "/init.d/85-nfsrootfs" | ||
92 | |||
86 | SUMMARY_initramfs-module-rootfs = "initramfs support for locating and mounting the root partition" | 93 | SUMMARY_initramfs-module-rootfs = "initramfs support for locating and mounting the root partition" |
87 | RDEPENDS_initramfs-module-rootfs = "${PN}-base" | 94 | RDEPENDS_initramfs-module-rootfs = "${PN}-base" |
88 | FILES_initramfs-module-rootfs = "/init.d/90-rootfs" | 95 | FILES_initramfs-module-rootfs = "/init.d/90-rootfs" |