From a2a6914f0699cb536fb3d78918ee98ecd5774f30 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Sun, 27 Jul 2014 16:29:57 +0000 Subject: [PATCH] 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. --- sys/boot/i386/libi386/pxe.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c index 93969c23b177..1b255e9f5a21 100644 --- a/sys/boot/i386/libi386/pxe.c +++ b/sys/boot/i386/libi386/pxe.c @@ -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++;