All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] initramfs-framework: add nfsrootfs module
@ 2018-05-25 13:56 Oleksii Konoplitskyi
  2018-06-15 15:42 ` Oleksii Konoplitskyi
  0 siblings, 1 reply; 3+ messages in thread
From: Oleksii Konoplitskyi @ 2018-05-25 13:56 UTC (permalink / raw)
  To: openembedded-core, xe-linux-external

nfsrootfs module mounts rootfs via nfs parsing "nfsroot" and "ip" cmdline options.

Signed-off-by: Oleksii Konoplitskyi <okonopli@cisco.com>
---
 .../initrdscripts/initramfs-framework/nfsrootfs    | 48 ++++++++++++++++++++++
 .../initrdscripts/initramfs-framework_1.0.bb       |  7 ++++
 2 files changed, 55 insertions(+)
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
new file mode 100644
index 0000000..e67ee4c
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+nfsrootfs_enabled() {
+	if [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then
+		return 1
+	fi
+	return 0
+}
+
+nfsrootfs_run() {
+	local nfs_opts
+	local location
+	local flags
+	local server_ip
+
+	nfs_opts=""
+	if [ "${bootparam_nfsroot#*,}" != "${bootparam_nfsroot}" ]; then
+		nfs_opts="-o ${bootparam_nfsroot#*,}"
+	fi
+
+	location="${bootparam_nfsroot%%,*}"
+	if [ "${location#*:}" = "${location}" ]; then
+		# server-ip not given. Get server ip from ip option
+		server_ip=""
+		if [ "${bootparam_ip#*:}" != "${bootparam_ip}" ]; then
+			server_ip=$(echo "$bootparam_ip" | cut -d: -f2)
+		fi
+
+		if [ -z "$server_ip" ]; then
+			fatal "Server IP is not set. Update ip or nfsroot options."
+		fi
+		location=${server_ip}:${location}
+	fi
+
+	flags="-o nolock"
+	if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then
+		if [  -n "$bootparam_rootflags" ]; then
+			bootparam_rootflags="$bootparam_rootflags,"
+		fi
+		bootparam_rootflags="${bootparam_rootflags}ro"
+	fi
+	if [ -n "$bootparam_rootflags" ]; then
+		flags="$flags -o $bootparam_rootflags"
+	fi
+
+	mount -t nfs ${flags} ${nfs_opts} ${location} ${ROOTFS_DIR}
+}
+
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 75d965f..6337b99 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
 
 SRC_URI = "file://init \
            file://exec \
+           file://nfsrootfs \
            file://rootfs \
            file://finish \
            file://mdev \
@@ -24,6 +25,7 @@ do_install() {
 
     # base
     install -m 0755 ${WORKDIR}/init ${D}/init
+    install -m 0755 ${WORKDIR}/nfsrootfs ${D}/init.d/85-nfsrootfs
     install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs
     install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish
 
@@ -53,6 +55,7 @@ PACKAGES = "${PN}-base \
             initramfs-module-mdev \
             initramfs-module-udev \
             initramfs-module-e2fs \
+            initramfs-module-nfsrootfs \
             initramfs-module-rootfs \
             initramfs-module-debug \
            "
@@ -83,6 +86,10 @@ SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystem
 RDEPENDS_initramfs-module-e2fs = "${PN}-base"
 FILES_initramfs-module-e2fs = "/init.d/10-e2fs"
 
+SUMMARY_initramfs-module-nfsrootfs = "initramfs support for locating and mounting the root partition via nfs"
+RDEPENDS_initramfs-module-nfsrootfs = "${PN}-base"
+FILES_initramfs-module-nfsrootfs = "/init.d/85-nfsrootfs"
+
 SUMMARY_initramfs-module-rootfs = "initramfs support for locating and mounting the root partition"
 RDEPENDS_initramfs-module-rootfs = "${PN}-base"
 FILES_initramfs-module-rootfs = "/init.d/90-rootfs"
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] initramfs-framework: add nfsrootfs module
  2018-05-25 13:56 [PATCH] initramfs-framework: add nfsrootfs module Oleksii Konoplitskyi
@ 2018-06-15 15:42 ` Oleksii Konoplitskyi
  2018-07-06 10:24   ` Oleksii Konoplitskyi
  0 siblings, 1 reply; 3+ messages in thread
From: Oleksii Konoplitskyi @ 2018-06-15 15:42 UTC (permalink / raw)
  To: openembedded-core, xe-linux-external, André Draszik

Hi Andre,


Could you, please, check if all the features that we discussed in 
https://patchwork.openembedded.org/patch/149212/ are implemented in this 
patch?


Best regards,

Oleksii


On 25.05.18 16:56, Oleksii Konoplitskyi wrote:
> nfsrootfs module mounts rootfs via nfs parsing "nfsroot" and "ip" cmdline options.
>
> Signed-off-by: Oleksii Konoplitskyi <okonopli@cisco.com>
> ---
>   .../initrdscripts/initramfs-framework/nfsrootfs    | 48 ++++++++++++++++++++++
>   .../initrdscripts/initramfs-framework_1.0.bb       |  7 ++++
>   2 files changed, 55 insertions(+)
>   create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
>
> diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
> new file mode 100644
> index 0000000..e67ee4c
> --- /dev/null
> +++ b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
> @@ -0,0 +1,48 @@
> +#!/bin/sh
> +
> +nfsrootfs_enabled() {
> +	if [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then
> +		return 1
> +	fi
> +	return 0
> +}
> +
> +nfsrootfs_run() {
> +	local nfs_opts
> +	local location
> +	local flags
> +	local server_ip
> +
> +	nfs_opts=""
> +	if [ "${bootparam_nfsroot#*,}" != "${bootparam_nfsroot}" ]; then
> +		nfs_opts="-o ${bootparam_nfsroot#*,}"
> +	fi
> +
> +	location="${bootparam_nfsroot%%,*}"
> +	if [ "${location#*:}" = "${location}" ]; then
> +		# server-ip not given. Get server ip from ip option
> +		server_ip=""
> +		if [ "${bootparam_ip#*:}" != "${bootparam_ip}" ]; then
> +			server_ip=$(echo "$bootparam_ip" | cut -d: -f2)
> +		fi
> +
> +		if [ -z "$server_ip" ]; then
> +			fatal "Server IP is not set. Update ip or nfsroot options."
> +		fi
> +		location=${server_ip}:${location}
> +	fi
> +
> +	flags="-o nolock"
> +	if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then
> +		if [  -n "$bootparam_rootflags" ]; then
> +			bootparam_rootflags="$bootparam_rootflags,"
> +		fi
> +		bootparam_rootflags="${bootparam_rootflags}ro"
> +	fi
> +	if [ -n "$bootparam_rootflags" ]; then
> +		flags="$flags -o $bootparam_rootflags"
> +	fi
> +
> +	mount -t nfs ${flags} ${nfs_opts} ${location} ${ROOTFS_DIR}
> +}
> +
> diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
> index 75d965f..6337b99 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
>   
>   SRC_URI = "file://init \
>              file://exec \
> +           file://nfsrootfs \
>              file://rootfs \
>              file://finish \
>              file://mdev \
> @@ -24,6 +25,7 @@ do_install() {
>   
>       # base
>       install -m 0755 ${WORKDIR}/init ${D}/init
> +    install -m 0755 ${WORKDIR}/nfsrootfs ${D}/init.d/85-nfsrootfs
>       install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs
>       install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish
>   
> @@ -53,6 +55,7 @@ PACKAGES = "${PN}-base \
>               initramfs-module-mdev \
>               initramfs-module-udev \
>               initramfs-module-e2fs \
> +            initramfs-module-nfsrootfs \
>               initramfs-module-rootfs \
>               initramfs-module-debug \
>              "
> @@ -83,6 +86,10 @@ SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystem
>   RDEPENDS_initramfs-module-e2fs = "${PN}-base"
>   FILES_initramfs-module-e2fs = "/init.d/10-e2fs"
>   
> +SUMMARY_initramfs-module-nfsrootfs = "initramfs support for locating and mounting the root partition via nfs"
> +RDEPENDS_initramfs-module-nfsrootfs = "${PN}-base"
> +FILES_initramfs-module-nfsrootfs = "/init.d/85-nfsrootfs"
> +
>   SUMMARY_initramfs-module-rootfs = "initramfs support for locating and mounting the root partition"
>   RDEPENDS_initramfs-module-rootfs = "${PN}-base"
>   FILES_initramfs-module-rootfs = "/init.d/90-rootfs"



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] initramfs-framework: add nfsrootfs module
  2018-06-15 15:42 ` Oleksii Konoplitskyi
@ 2018-07-06 10:24   ` Oleksii Konoplitskyi
  0 siblings, 0 replies; 3+ messages in thread
From: Oleksii Konoplitskyi @ 2018-07-06 10:24 UTC (permalink / raw)
  To: openembedded-core, xe-linux-external

ping


On 15.06.18 18:42, Oleksii Konoplitskyi wrote:
> Hi Andre,
>
>
> Could you, please, check if all the features that we discussed in 
> https://patchwork.openembedded.org/patch/149212/ are implemented in 
> this patch?
>
>
> Best regards,
>
> Oleksii
>
>
> On 25.05.18 16:56, Oleksii Konoplitskyi wrote:
>> nfsrootfs module mounts rootfs via nfs parsing "nfsroot" and "ip" 
>> cmdline options.
>>
>> Signed-off-by: Oleksii Konoplitskyi <okonopli@cisco.com>
>> ---
>>   .../initrdscripts/initramfs-framework/nfsrootfs    | 48 
>> ++++++++++++++++++++++
>>   .../initrdscripts/initramfs-framework_1.0.bb       |  7 ++++
>>   2 files changed, 55 insertions(+)
>>   create mode 100644 
>> meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
>>
>> diff --git 
>> a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs 
>> b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
>> new file mode 100644
>> index 0000000..e67ee4c
>> --- /dev/null
>> +++ b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
>> @@ -0,0 +1,48 @@
>> +#!/bin/sh
>> +
>> +nfsrootfs_enabled() {
>> +    if [ ${bootparam_root} != "/dev/nfs" ] || [ -z 
>> ${bootparam_nfsroot} ]; then
>> +        return 1
>> +    fi
>> +    return 0
>> +}
>> +
>> +nfsrootfs_run() {
>> +    local nfs_opts
>> +    local location
>> +    local flags
>> +    local server_ip
>> +
>> +    nfs_opts=""
>> +    if [ "${bootparam_nfsroot#*,}" != "${bootparam_nfsroot}" ]; then
>> +        nfs_opts="-o ${bootparam_nfsroot#*,}"
>> +    fi
>> +
>> +    location="${bootparam_nfsroot%%,*}"
>> +    if [ "${location#*:}" = "${location}" ]; then
>> +        # server-ip not given. Get server ip from ip option
>> +        server_ip=""
>> +        if [ "${bootparam_ip#*:}" != "${bootparam_ip}" ]; then
>> +            server_ip=$(echo "$bootparam_ip" | cut -d: -f2)
>> +        fi
>> +
>> +        if [ -z "$server_ip" ]; then
>> +            fatal "Server IP is not set. Update ip or nfsroot options."
>> +        fi
>> +        location=${server_ip}:${location}
>> +    fi
>> +
>> +    flags="-o nolock"
>> +    if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | 
>> grep -w -q "ro"; then
>> +        if [  -n "$bootparam_rootflags" ]; then
>> +            bootparam_rootflags="$bootparam_rootflags,"
>> +        fi
>> +        bootparam_rootflags="${bootparam_rootflags}ro"
>> +    fi
>> +    if [ -n "$bootparam_rootflags" ]; then
>> +        flags="$flags -o $bootparam_rootflags"
>> +    fi
>> +
>> +    mount -t nfs ${flags} ${nfs_opts} ${location} ${ROOTFS_DIR}
>> +}
>> +
>> diff --git 
>> a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb 
>> b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
>> index 75d965f..6337b99 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
>>     SRC_URI = "file://init \
>>              file://exec \
>> +           file://nfsrootfs \
>>              file://rootfs \
>>              file://finish \
>>              file://mdev \
>> @@ -24,6 +25,7 @@ do_install() {
>>         # base
>>       install -m 0755 ${WORKDIR}/init ${D}/init
>> +    install -m 0755 ${WORKDIR}/nfsrootfs ${D}/init.d/85-nfsrootfs
>>       install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs
>>       install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish
>>   @@ -53,6 +55,7 @@ PACKAGES = "${PN}-base \
>>               initramfs-module-mdev \
>>               initramfs-module-udev \
>>               initramfs-module-e2fs \
>> +            initramfs-module-nfsrootfs \
>>               initramfs-module-rootfs \
>>               initramfs-module-debug \
>>              "
>> @@ -83,6 +86,10 @@ SUMMARY_initramfs-module-e2fs = "initramfs support 
>> for ext4/ext3/ext2 filesystem
>>   RDEPENDS_initramfs-module-e2fs = "${PN}-base"
>>   FILES_initramfs-module-e2fs = "/init.d/10-e2fs"
>>   +SUMMARY_initramfs-module-nfsrootfs = "initramfs support for 
>> locating and mounting the root partition via nfs"
>> +RDEPENDS_initramfs-module-nfsrootfs = "${PN}-base"
>> +FILES_initramfs-module-nfsrootfs = "/init.d/85-nfsrootfs"
>> +
>>   SUMMARY_initramfs-module-rootfs = "initramfs support for locating 
>> and mounting the root partition"
>>   RDEPENDS_initramfs-module-rootfs = "${PN}-base"
>>   FILES_initramfs-module-rootfs = "/init.d/90-rootfs"
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-06 10:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-25 13:56 [PATCH] initramfs-framework: add nfsrootfs module Oleksii Konoplitskyi
2018-06-15 15:42 ` Oleksii Konoplitskyi
2018-07-06 10:24   ` Oleksii Konoplitskyi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.