Author: mmel Date: Sat Nov 28 09:06:51 2020 New Revision: 368121 URL: https://svnweb.freebsd.org/changeset/base/368121
Log: MFC r366700: Add 'netserver' command to EFI loader. Modified: stable/12/stand/efi/loader/main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/loader/main.c ============================================================================== --- stable/12/stand/efi/loader/main.c Sat Nov 28 08:07:55 2020 (r368120) +++ stable/12/stand/efi/loader/main.c Sat Nov 28 09:06:51 2020 (r368121) @@ -37,10 +37,14 @@ __FBSDID("$FreeBSD$"); #include <sys/reboot.h> #include <sys/boot.h> #include <paths.h> +#include <netinet/in.h> +#include <netinet/in_systm.h> #include <stdint.h> #include <string.h> #include <setjmp.h> #include <disk.h> +#include <dev_net.h> +#include <net.h> #include <efi.h> #include <efilib.h> @@ -1565,3 +1569,34 @@ command_chain(int argc, char *argv[]) } COMMAND_SET(chain, "chain", "chain load file", command_chain); + +extern struct in_addr servip; +static int +command_netserver(int argc, char *argv[]) +{ + char *proto; + n_long rootaddr; + + if (argc > 2) { + command_errmsg = "wrong number of arguments"; + return (CMD_ERROR); + } + if (argc < 2) { + proto = netproto == NET_TFTP ? "tftp://" : "nfs://"; + printf("Netserver URI: %s%s%s\n", proto, intoa(rootip.s_addr), + rootpath); + return (CMD_OK); + } + if (argc == 2) { + strncpy(rootpath, argv[1], sizeof(rootpath)); + rootpath[sizeof(rootpath) -1] = '\0'; + if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) + servip.s_addr = rootip.s_addr = rootaddr; + return (CMD_OK); + } + return (CMD_ERROR); /* not reached */ + +} + +COMMAND_SET(netserver, "netserver", "change or display netserver URI", + command_netserver); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"