diff mbox series

nfsrootfs: disable warning message if bootargs root parameter have not been defined

Message ID 20250616074341.32477-1-jimmy.ho@sifive.com
State Accepted, archived
Commit d50e12e5ae6a72535cacd0f767b1be1f89278f79
Headers show
Series nfsrootfs: disable warning message if bootargs root parameter have not been defined | expand

Commit Message

Jimmy Ho June 16, 2025, 7:43 a.m. UTC
Signed-off-by: Jimmy Ho <jimmy.ho@sifive.com>
---
 meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Kanavin June 16, 2025, 1:52 p.m. UTC | #1
On Mon, 16 Jun 2025 at 13:56, Jimmy Ho via lists.openembedded.org
<jimmy.ho=sifive.com@lists.openembedded.org> wrote:
>  nfsrootfs_enabled() {
> -       if [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then
> +       if [ -z ${bootparam_root} ] || [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then
>                 return 1
>         fi
>         return 0

This needs a bit more explanation. What is the warning message, why
does it need to be disabled, and how does the above change achieve it?

Alex
Jimmy Ho June 19, 2025, 6:12 a.m. UTC | #2
hi Alexander:
in one of our use case, we don't define root in bootargs,
if [ ${bootparam_root} != "/dev/nfs" ] will output /init.d/85-nfsrootfs:
line 4: [: !=: unary operator expected
by checking   if [-z ${bootparam_root} ] can clear this warning message
thanks
best regards
jimmy ho

On Mon, Jun 16, 2025 at 9:52 PM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> On Mon, 16 Jun 2025 at 13:56, Jimmy Ho via lists.openembedded.org
> <jimmy.ho=sifive.com@lists.openembedded.org> wrote:
> >  nfsrootfs_enabled() {
> > -       if [ ${bootparam_root} != "/dev/nfs" ] || [ -z
> ${bootparam_nfsroot} ]; then
> > +       if [ -z ${bootparam_root} ] || [ ${bootparam_root} != "/dev/nfs"
> ] || [ -z ${bootparam_nfsroot} ]; then
> >                 return 1
> >         fi
> >         return 0
>
> This needs a bit more explanation. What is the warning message, why
> does it need to be disabled, and how does the above change achieve it?
>
> Alex
>
Alexander Kanavin June 19, 2025, 7:22 a.m. UTC | #3
On Thu, 19 Jun 2025 at 08:12, Jimmy Ho <jimmy.ho@sifive.com> wrote:
>
> hi Alexander:
> in one of our use case, we don't define root in bootargs,
> if [ ${bootparam_root} != "/dev/nfs" ] will output /init.d/85-nfsrootfs: line 4: [: !=: unary operator expected
> by checking   if [-z ${bootparam_root} ] can clear this warning message

Thanks, makese sense. Can you resend the patch with this information
in the commit message?

Alex
diff mbox series

Patch

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
index e67ee4c25d..1e76258ce1 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
@@ -1,7 +1,7 @@ 
 #!/bin/sh
 
 nfsrootfs_enabled() {
-	if [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then
+	if [ -z ${bootparam_root} ] || [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then
 		return 1
 	fi
 	return 0