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.
This commit is contained in:
Marcel Moolenaar 2014-07-27 16:29:57 +00:00
parent 7fe0b4f160
commit a2a6914f06

View File

@ -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++;