svn commit: r269154 - head/sys/boot/i386/libi386

Marcel Moolenaar marcel at FreeBSD.org
Sun Jul 27 16:29:57 UTC 2014


Author: marcel
Date: Sun Jul 27 16:29:57 2014
New Revision: 269154
URL: http://svnweb.freebsd.org/changeset/base/269154

Log:
  1.  Suppress output for the TFTP-based PXE loader, but leave it in
      place for the NFS-based PXE loader. Information like rootpath
      or rootip aren't that useful for TFTP and the gateway IP is
      typically already printed by the firmware.
  2.  Only set boot.nfsroot.* environment variables for NFS. This
      makes it possible for the OS to work either way by checking
      for the presence or absence of environment variables.
  3.  Set boot.netif.server when using TFTP so that the OS can fetch
      files as well. A typical use case for this is network-based
      installations with the installation process implemented on
      top of FreeBSD.
  4.  The pxelinux loader has a set of alternative names it tries
      for configuration files. Make it easier to do something
      similar in Forth by providing the IP address as a 32-bit hex
      number in the pxeboot.ip variable and the MAC address with
      dashes in the pxeboot.hwaddr environment variable.
  
  Obtained from:	Juniper Networks, Inc.

Modified:
  head/sys/boot/i386/libi386/pxe.c

Modified: head/sys/boot/i386/libi386/pxe.c
==============================================================================
--- head/sys/boot/i386/libi386/pxe.c	Sun Jul 27 16:12:51 2014	(r269153)
+++ head/sys/boot/i386/libi386/pxe.c	Sun Jul 27 16:29:57 2014	(r269154)
@@ -301,10 +301,6 @@ pxe_open(struct open_file *f, ...)
 			bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1);
 			bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1);
 		}
-		printf("pxe_open: server addr: %s\n", inet_ntoa(rootip));
-		printf("pxe_open: server path: %s\n", rootpath);
-		printf("pxe_open: gateway ip:  %s\n", inet_ntoa(gateip));
-
 		setenv("boot.netif.ip", inet_ntoa(myip), 1);
 		setenv("boot.netif.netmask", intoa(netmask), 1);
 		setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
@@ -312,9 +308,24 @@ pxe_open(struct open_file *f, ...)
 		    sprintf(temp, "%6D", bootplayer.CAddr, ":");
 		    setenv("boot.netif.hwaddr", temp, 1);
 		}
+#ifdef LOADER_NFS_SUPPORT
+		printf("pxe_open: server addr: %s\n", inet_ntoa(rootip));
+		printf("pxe_open: server path: %s\n", rootpath);
+		printf("pxe_open: gateway ip:  %s\n", inet_ntoa(gateip));
+
 		setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
 		setenv("boot.nfsroot.path", rootpath, 1);
+#else
+		setenv("boot.netif.server", inet_ntoa(rootip), 1);
+#endif
 		setenv("dhcp.host-name", hostname, 1);
+
+		sprintf(temp, "%08X", ntohl(myip.s_addr));
+		setenv("pxeboot.ip", temp, 1);
+		if (bootplayer.Hardware == ETHER_TYPE) {
+		    sprintf(temp, "%6D", bootplayer.CAddr, "-");
+		    setenv("pxeboot.hwaddr", temp, 1);
+		}
 	}
     }
     pxe_opens++;


More information about the svn-src-head mailing list