aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabaev <kan@FreeBSD.org>2005-03-12 21:26:53 +0000
committerAlexander Kabaev <kan@FreeBSD.org>2005-03-12 21:26:53 +0000
commit721d5bfe2e0c02692b4587bbeb008508b8d728ef (patch)
tree1bea38ba12920bed826a2baf3e725779e0755901
parentbc8f83f849575b5647efce632593457e8d552fc5 (diff)
downloadsrc-721d5bfe2e0c02692b4587bbeb008508b8d728ef.tar.gz
src-721d5bfe2e0c02692b4587bbeb008508b8d728ef.zip
Allow kernels loaded by pxeboot, which was compiled with LOADER_TFTP_SUPPORT,
to stll be able to mount NFS root as prescribed by DCHP configuration. Since pxeboot is using TFTP to get to the files, pxeboot can not rely on NFS to provide it a root directory hande as a side effect. pxeboot has to make RPC mount call itself.
Notes
Notes: svn path=/head/; revision=143476
-rw-r--r--sys/boot/i386/libi386/pxe.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c
index b78508a98dbf..a0f66a711e80 100644
--- a/sys/boot/i386/libi386/pxe.c
+++ b/sys/boot/i386/libi386/pxe.c
@@ -413,6 +413,22 @@ struct nfs_iodesc {
/* structure truncated here */
};
extern struct nfs_iodesc nfs_root_node;
+extern int rpc_port;
+
+static void
+pxe_rpcmountcall()
+{
+ struct iodesc *d;
+ int error;
+
+ if (!(d = socktodesc(pxe_sock)))
+ return;
+ d->myport = htons(--rpc_port);
+ d->destip = rootip;
+ if ((error = nfs_getrootfh(d, rootpath, nfs_root_node.fh)) != 0)
+ printf("NFS MOUNT RPC error: %d\n", error);
+ nfs_root_node.iodesc = d;
+}
static void
pxe_setnfshandle(char *rootpath)
@@ -421,6 +437,14 @@ pxe_setnfshandle(char *rootpath)
u_char *fh;
char buf[2 * NFS_FHSIZE + 3], *cp;
+ /*
+ * If NFS files were never opened, we need to do mount call
+ * ourselves. Use nfs_root_node.iodesc as flag indicating
+ * previous NFS usage.
+ */
+ if (nfs_root_node.iodesc == NULL)
+ pxe_rpcmountcall();
+
fh = &nfs_root_node.fh[0];
buf[0] = 'X';
cp = &buf[1];