Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Sep 2003 02:36:53 +0200 (MEST)
From:      Per Kristian Hove <Per.Hove@math.ntnu.no>
To:        freebsd-sparc64@freebsd.org
Subject:   Re: sparc64 loader gets confused when netbooting
Message-ID:  <Pine.GSO.4.52.0309270226440.27298@abel.math.ntnu.no>
In-Reply-To: <Pine.GSO.4.52.0309241925080.3847@abel.math.ntnu.no>
References:  <Pine.GSO.4.52.0309241925080.3847@abel.math.ntnu.no>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
[Per Kristian Hove, 2003-09-24]

|  When netbooting, the sparc64 loader tries to download the kernel from
|  the wrong server address.

On further investigation, the cure is quite trivial (and not sparc64-
specific). The attached patch to /sys/boot/common/dev_net.c fixes this
problem.

Should I open a PR?


-- 
Per Kristian Hove
Dept. of Mathematical Sciences
Norwegian University of Science and Technology
[-- Attachment #2 --]
--- dev_net.c.orig	Tue Aug 26 01:30:41 2003
+++ dev_net.c	Sat Sep 27 00:50:29 2003
@@ -270,22 +270,23 @@
 	return (EIO);
     }
  exit:
-    printf("net_open: server addr: %s\n", inet_ntoa(rootip));
-
     /*  
      * If present, strip the server's address off of the rootpath
      * before passing it along.  This allows us to be compatible with
      * the kernel's diskless (BOOTP_NFSROOT) booting conventions
      */
 
-    for(i=0; i<FNAME_SIZE; i++)
+    for(i=0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
 	    if(rootpath[i] == ':')
 		    break;
-    if(i && i != FNAME_SIZE) {
-	    i++;
+    if(i && i != FNAME_SIZE && rootpath[i] == ':') {
+	    rootpath[i++] = '\0';
+	    if (inet_addr(&rootpath[0]) != INADDR_NONE)
+		    rootip.s_addr = inet_addr(&rootpath[0]);
 	    bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1);
 	    bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1);	    
     }
+    printf("net_open: server addr: %s\n", inet_ntoa(rootip));
     printf("net_open: server path: %s\n", rootpath);	    
 
     d = socktodesc(sock);
@@ -294,6 +295,8 @@
     setenv("boot.netif.netmask", intoa(netmask), 1);
     setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
     setenv("boot.netif.hwaddr", temp, 1);
+    setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
+    setenv("boot.nfsroot.path", rootpath, 1);
 
     return (0);
 }

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.52.0309270226440.27298>