nfs: forward filesystem options to the kernel command line
Subsystems (2)
RFC 1/1 nfs: forward filesystem options to the kernel command line
Using NFS in conjunction with boot spec and the feature to let barebox auto generate a kernel command line must keep the options the NFS filesystem was mounted in barebox.
This patch extends the kernel command line parameter on demand if something different than the defaults were used.
The command:
barebox:/ boot nfs://myhost//root
expands to the kernel command line:
nfsroot=myhost:/root,v3,tcp
while the command:
barebox:/ boot nfs://myhost:2049//root
now expands to the kernel command line:
nfsroot=myhost:/root,v3,tcp,mountport=2049,port=2049
Documentation/user/booting-linux.rst +1 -1
@@ -203,7 +203,7 @@ compatible NFS URI string must be passed to the boot command: .. code-block:: sh - boot nfs://nfshost//path/ + boot nfs://nfshost[:port]//path/ Additionally to the options defined in the original spec barebox understands the ``linux-appendroot`` option. This is a boolean value and if set to ``true`` barebox
fs/nfs.c +16 -0
@@ -1324,11 +1324,21 @@ static void nfs_set_rootarg(struct nfs_priv *npriv, struct fs_device_d *fsdev)free (str); } +static void nfs_extend_options (char **opts,const char *ext) +{ +size_t u; + + u =strlen (*opts); + *opts =xrealloc (*opts, u +1 +strlen (ext)); +strcat (*opts + u, ext); +} +static int nfs_probe (struct device_d *dev) {struct fs_device_d *fsdev =dev_to_fs_device (dev);struct nfs_priv *npriv =xzalloc (sizeof (struct nfs_priv ));char *tmp =xstrdup (fsdev->backingstore); +char buf[20 ];char *path;int ret;
@@ -1367,6 +1377,9 @@ static int nfs_probe(struct device_d *dev) goto err2; } npriv->mount_port = ret; + }else { +snprintf (buf,sizeof (buf),",mountport=%d" , npriv->mount_port); +nfs_extend_options (&rootnfsopts, buf); }debug ("mount port: %hu\n" , npriv->mount_port);
@@ -1378,6 +1391,9 @@ static int nfs_probe(struct device_d *dev) goto err2; } npriv->nfs_port = ret; + }else { +snprintf (buf,sizeof (buf),",port=%d" , npriv->nfs_port); +nfs_extend_options (&rootnfsopts, buf); }debug ("nfs port: %d\n" , npriv->nfs_port);
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 1/1 nfs: forward filesystem options to the kernel command line
Using NFS in conjunction with boot spec and the feature to let barebox auto generate a kernel command line must keep the options the NFS filesystem was mounted in barebox. This patch extends the kernel command line parameter on demand if something different than the defaults are used.
The command:
barebox:/ boot nfs://myhost//root
expands to the kernel command line:
nfsroot=myhost:/root,v3,tcp
while the command:
barebox:/ boot nfs://myhost:2049//root
expands now to the kernel command line:
nfsroot=myhost:/root,v3,tcp,mountport=2049,port=2049
Documentation/user/booting-linux.rst +1 -1
@@ -203,7 +203,7 @@ compatible NFS URI string must be passed to the boot command: .. code-block:: sh - boot nfs://nfshost//path/ + boot nfs://nfshost[:port]//path/ Additionally to the options defined in the original spec barebox understands the ``linux-appendroot`` option. This is a boolean value and if set to ``true`` barebox
fs/nfs.c +14 -1
@@ -1311,7 +1311,7 @@ static char *rootnfsopts;static void nfs_set_rootarg (struct nfs_priv *npriv,struct fs_device_d *fsdev) { -char *str; +char *str, *tmp;const char *ip; ip =ip_to_string (npriv->server);
@@ -1319,6 +1319,19 @@ static void nfs_set_rootarg(struct nfs_priv *npriv, struct fs_device_d *fsdev) ip, npriv->path, rootnfsopts[0 ] ?"," :"" , rootnfsopts); +/* forward specific mount options on demand */ +if (npriv->nfs_port !=PROG_NFS ) { + tmp =asprintf ("%s,port=%hu" , str, npriv->nfs_port); +free (str); + str = tmp; + } + +if (npriv->mount_port !=PROG_MOUNT ) { + tmp =asprintf ("%s,mountport=%hu" , str, npriv->mount_port); +free (str); + str = tmp; + } +fsdev_set_linux_rootarg (fsdev, str);free (str);
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedDocumentation/user/booting-linux.rst
Quoted 27 lines · Juergen Borleis
Using NFS in conjunction with boot spec and the feature to let barebox auto generate a kernel command line must keep the options the NFS filesystem was mounted in barebox. This patch extends the kernel command line parameter on demand if something different than the defaults are used.
The command:
barebox:/ boot nfs://myhost//root
expands to the kernel command line:
nfsroot=myhost:/root,v3,tcp
while the command:
barebox:/ boot nfs://myhost:2049//root
expands now to the kernel command line:
nfsroot=myhost:/root,v3,tcp,mountport=2049,port=2049
Signed-off-by Juergen Borleis <[email protected]>Documentation/user/booting-linux.rst +0
-0
Applied, thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox