Some enhancements for nfsroot

Swen Thuemmler (swen@uni-paderborn.de)
Mon, 15 Apr 1996 18:09:59 +0200 (MET DST)


-----BEGIN PGP SIGNED MESSAGE-----

Hi,

I've made some enhancements for nfsroot. The attached patches allow a
commandline like
nfsroot=3D,rsize=3D8192,wsize=3D8192 nfsaddrs=3Dbootp

i.E. setting the root directory from bootp, but still allowing setting =
the
mount options. Additionally, setting the NIS domainname via bootp is fi=
xed
(it was falsely assumed that dommainname is the DNS domain), and the du=
mmy
device is skipped for bootp requests.

Hope you find this useful, master

Greetings, Swen

- --- linux/init/main.c.orig Mon Apr 15 18:01:27 1996
+++ linux/init/main.c Mon Apr 15 18:02:21 1996
@@ -521,7 +521,7 @@
int n;
line +=3D 8;
ROOT_DEV =3D MKDEV(UNNAMED_MAJOR, 255);
- - if (line[0] =3D=3D '/' || (line[0] >=3D '0' && line[0] <=3D '9'))=
{
+ if (line[0] =3D=3D '/' || line[0] =3D=3D ',' || (line[0] >=3D '0' &=
& line[0] <=3D '9')) {
strncpy(nfs_root_name, line, sizeof(nfs_root_name));
nfs_root_name[sizeof(nfs_root_name)-1] =3D '\0';
continue;
- --- linux/fs/nfs/nfsroot.c.orig Mon Apr 15 17:58:39 1996
+++ linux/fs/nfs/nfsroot.c Mon Apr 15 18:01:02 1996
@@ -47,6 +47,10 @@
* from being used (thanks to Leo Spiekman)
* Andy Walker : Allow to specify the NFS server in nfs_root
* without giving a path name
+ * Swen Th=FCmmler : Allow to specify the NFS options in nfs_root
+ * without giving a path name. Fix BOOTP request
+ * for domainname (domainname is NIS domain, not
+ * DNS domain!). Skip dummy devices for BOOTP.
*
*/

@@ -168,6 +172,7 @@
if (dev->type < ARPHRD_SLIP &&
dev->family =3D=3D AF_INET &&
!(dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) &&
+ (0 !=3D strncmp(dev->name, "dummy", 5)) &&
(!user_dev_name[0] || !strcmp(dev->name, user_dev_name))) {
/* First up the interface */
old_flags =3D dev->flags;
@@ -622,7 +627,7 @@
*e++ =3D 12; /* Host name request */
*e++ =3D 32;
e +=3D 32;
- - *e++ =3D 15; /* Domain name request */
+ *e++ =3D 40; /* NIS Domain name request */
*e++ =3D 32;
e +=3D 32;
*e++ =3D 17; /* Boot path */
@@ -756,7 +761,6 @@
static void root_do_bootp_ext(u8 *ext)
{
u8 *c;
- - static int got_bootp_domain =3D 0;

#ifdef NFSROOT_BOOTP_DEBUG
printk("BOOTP: Got extension %02x",*ext);
@@ -775,20 +779,9 @@
memcpy(&gateway.sin_addr.s_addr, ext+1, 4);
break;
case 12: /* Host name */
- - if (root_bootp_string(system_utsname.nodename, ext+1, *ext, __NEW=
_UTS_LEN)) {
- - c =3D strchr(system_utsname.nodename, '.');
- - if (c) {
- - *c++ =3D 0;
- - if (!system_utsname.domainname[0]) {
- - strcpy(system_utsname.domainname, c);
- - got_bootp_domain =3D 1;
- - }
- - }
- - }
+ root_bootp_string(system_utsname.nodename, ext+1, *ext, __NEW_UTS_L=
EN);
break;
- - case 15: /* Domain name */
- - if (got_bootp_domain && *ext && ext[1])
- - system_utsname.domainname[0] =3D '\0';
+ case 40: /* NIS Domain name */
root_bootp_string(system_utsname.domainname, ext+1, *ext, __NEW_UTS=
_LEN);
break;
case 17: /* Root path */
@@ -1094,7 +1087,9 @@
printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n=
");
return -1;
}
- - sprintf(nfs_path, buf, cp);
+ /* update nfs_path with path from nfsroot=3D... command line paramete=
r */
+ if (*buf)
+ sprintf(nfs_path, buf, cp);

/* Set some default values */
nfs_port =3D -1;

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i

iQCVAwUBMXJ04UTyQF8U8wFLAQGfXwP/RITXXscjz/qtuTz0nbOR/IXTORGE0PvC
XSgss+jPB6dSmMaUTaJ5+y2qv7xr0X4bhLESWSXI03/esnNNgVbTwDF5VXIzAFoP
E86DtKHL29JxLhGLzuQjsDKIwTM8JgU5pGiuGDU84WK211OmJ1SMiAXQZU0X0MnG
Nse/W1HJBGc=3D
=3DsBZE
-----END PGP SIGNATURE-----