2001-02-19 23:12:39

by Benjamin LaHaise

[permalink] [raw]
Subject: [PATCH] make nfsroot accept server addresses from BOOTP root

Hello,

Here's a handy little patch that makes the kernel parse out the ip
address of the nfs server from the bootp root path. Otherwise it's
impossible to boot the kernel without command line options on diskless
workstations (I hate RPL).

-ben

diff -ur v2.4.1-ac18/fs/nfs/nfsroot.c work/fs/nfs/nfsroot.c
--- v2.4.1-ac18/fs/nfs/nfsroot.c Mon Sep 25 16:13:53 2000
+++ work/fs/nfs/nfsroot.c Mon Feb 19 18:05:24 2001
@@ -224,8 +224,7 @@
}
}
if (name[0] && strcmp(name, "default")) {
- strncpy(buf, name, NFS_MAXPATHLEN-1);
- buf[NFS_MAXPATHLEN-1] = 0;
+ root_nfs_parse_addr(name);
}
}



2001-02-20 17:46:06

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] make nfsroot accept server addresses from BOOTP root

On Mon, Feb 19, 2001 at 06:12:12PM -0500, Ben LaHaise wrote:

> Here's a handy little patch that makes the kernel parse out the ip
> address of the nfs server from the bootp root path. Otherwise it's
> impossible to boot the kernel without command line options on diskless
> workstations (I hate RPL).

Er, say that again? Right now, for bootp if you specify "sa=xxx.xxx.xxx.xxx"
Linux uses that as the host for the NFS server (which does have the side
effect of if TFTP server != NFS server, you don't boot). Are you saying
your patch takes "rp=xxx.xxx.xxx.xxx:/foo/root" ? Just curious, since I
don't know, whats the RFC say about this?

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2001-02-20 18:13:45

by Benjamin LaHaise

[permalink] [raw]
Subject: Re: [PATCH] make nfsroot accept server addresses from BOOTP root

On Tue, 20 Feb 2001, Tom Rini wrote:

> Er, say that again? Right now, for bootp if you specify "sa=xxx.xxx.xxx.xxx"
> Linux uses that as the host for the NFS server (which does have the side
> effect of if TFTP server != NFS server, you don't boot). Are you saying
> your patch takes "rp=xxx.xxx.xxx.xxx:/foo/root" ? Just curious, since I
> don't know, whats the RFC say about this?

Yeah, that's the problem I was trying to work around, mostly because the
docs on dhcpd are sufficiently vague and obscure. Personally, I don't
actually need tftp support, so I've just configured the system to now
point at the NFS server. For anyone who cares, the last patch was wrong,
this one is right.

-ben

diff -ur v2.4.1-ac18/fs/nfs/nfsroot.c work/fs/nfs/nfsroot.c
--- v2.4.1-ac18/fs/nfs/nfsroot.c Mon Sep 25 16:13:53 2000
+++ work/fs/nfs/nfsroot.c Tue Feb 20 01:59:32 2001
@@ -226,6 +226,7 @@
if (name[0] && strcmp(name, "default")) {
strncpy(buf, name, NFS_MAXPATHLEN-1);
buf[NFS_MAXPATHLEN-1] = 0;
+ root_nfs_parse_addr(buf);
}
}


2001-02-20 18:22:25

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] make nfsroot accept server addresses from BOOTP root

On Tue, Feb 20, 2001 at 01:12:28PM -0500, Ben LaHaise wrote:
> On Tue, 20 Feb 2001, Tom Rini wrote:
>
> > Er, say that again? Right now, for bootp if you specify "sa=xxx.xxx.xxx.xxx"
> > Linux uses that as the host for the NFS server (which does have the side
> > effect of if TFTP server != NFS server, you don't boot). Are you saying
> > your patch takes "rp=xxx.xxx.xxx.xxx:/foo/root" ? Just curious, since I
> > don't know, whats the RFC say about this?
>
> Yeah, that's the problem I was trying to work around, mostly because the

Er, the problem of having to use sa (which is TFTP server) to specify the
NFS server?

> docs on dhcpd are sufficiently vague and obscure. Personally, I don't
> actually need tftp support, so I've just configured the system to now
> point at the NFS server. For anyone who cares, the last patch was wrong,
> this one is right.

If the RFC doesn't say anything about the format rp= has to be in, this
is probably right. Assuming it works. :)

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2001-02-20 23:05:53

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] make nfsroot accept server addresses from BOOTP root

Ben LaHaise writes:
> Yeah, that's the problem I was trying to work around, mostly because the
> docs on dhcpd are sufficiently vague and obscure. Personally, I don't
> actually need tftp support, so I've just configured the system to now
> point at the NFS server. For anyone who cares, the last patch was wrong,
> this one is right.

This is the dhcp entry for a host that I use to tftp a kernel from a
different machine to that running dhcpd:

host tasslehoff
{
hardware ethernet 00:10:57:00:03:EC;
fixed-address tasslehoff;
next-server raistlin;
filename "/usr/src/k/tasslehoff";
}

The booting host is called "tasslehoff". The tftp server host is called
"raistlin", and the dhcp server is called "flint".

According to Tom, this should also cause Linux to nfs mount from the
"next-server" address, and it is fair that this is not documented by
the dhcp man pages since it appears to be a Linux Kernel quirk.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2001-02-20 23:28:11

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] make nfsroot accept server addresses from BOOTP root

On Tue, Feb 20, 2001 at 11:02:10PM +0000, Russell King wrote:
> Ben LaHaise writes:
> > Yeah, that's the problem I was trying to work around, mostly because the
> > docs on dhcpd are sufficiently vague and obscure. Personally, I don't
> > actually need tftp support, so I've just configured the system to now
> > point at the NFS server. For anyone who cares, the last patch was wrong,
> > this one is right.
>
> This is the dhcp entry for a host that I use to tftp a kernel from a
> different machine to that running dhcpd:
>
> host tasslehoff
> {
> hardware ethernet 00:10:57:00:03:EC;
> fixed-address tasslehoff;
> next-server raistlin;
> filename "/usr/src/k/tasslehoff";
> }
>
> The booting host is called "tasslehoff". The tftp server host is called
> "raistlin", and the dhcp server is called "flint".
>
> According to Tom, this should also cause Linux to nfs mount from the
> "next-server" address, and it is fair that this is not documented by
> the dhcp man pages since it appears to be a Linux Kernel quirk.

Well, assuming next-server gets translated into TFTP server by the
dhcp-doing-bootp bit, yes. I'm using that right now to bootp on
one box and NFS off another.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/