diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/Kconfig | 15 | ||||
| -rw-r--r-- | cmd/Makefile | 1 | ||||
| -rw-r--r-- | cmd/net.c | 10 | ||||
| -rw-r--r-- | cmd/wol.c | 33 |
4 files changed, 57 insertions, 2 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index 45c83359add..aec209006db 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1121,6 +1121,16 @@ config BOOTP_HOSTNAME help The name may or may not be qualified with the local domain name. +config BOOTP_PREFER_SERVERIP + bool "serverip variable takes precedent over DHCP server IP." + depends on CMD_BOOTP + help + By default a BOOTP/DHCP reply will overwrite the 'serverip' variable. + + With this option enabled, the 'serverip' variable in the environment + takes precedence over DHCP server IP and will only be set by the DHCP + server if not already set in the environment. + config BOOTP_SUBNETMASK bool "Request & store 'netmask' from BOOTP/DHCP server" default y @@ -1239,6 +1249,11 @@ config CMD_PXE help Boot image via network using PXE protocol +config CMD_WOL + bool "wol" + help + Wait for wake-on-lan Magic Packet + endif menu "Misc commands" diff --git a/cmd/Makefile b/cmd/Makefile index 13cf7bf6c20..323f1fd2c77 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -100,6 +100,7 @@ obj-$(CONFIG_CMD_PCI) += pci.o endif obj-y += pcmcia.o obj-$(CONFIG_CMD_PXE) += pxe.o +obj-$(CONFIG_CMD_WOL) += wol.o obj-$(CONFIG_CMD_QFW) += qfw.o obj-$(CONFIG_CMD_READ) += read.o obj-$(CONFIG_CMD_REGINFO) += reginfo.o diff --git a/cmd/net.c b/cmd/net.c index f83839c35ec..eca6dd8918e 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -183,6 +183,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, int size; ulong addr; + net_boot_file_name_explicit = false; + /* pre-set load_addr */ s = env_get("loadaddr"); if (s != NULL) @@ -199,15 +201,18 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, * mis-interpreted as a valid number. */ addr = simple_strtoul(argv[1], &end, 16); - if (end == (argv[1] + strlen(argv[1]))) + if (end == (argv[1] + strlen(argv[1]))) { load_addr = addr; - else + } else { + net_boot_file_name_explicit = true; copy_filename(net_boot_file_name, argv[1], sizeof(net_boot_file_name)); + } break; case 3: load_addr = simple_strtoul(argv[1], NULL, 16); + net_boot_file_name_explicit = true; copy_filename(net_boot_file_name, argv[2], sizeof(net_boot_file_name)); @@ -220,6 +225,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, printf("Invalid address/size\n"); return CMD_RET_USAGE; } + net_boot_file_name_explicit = true; copy_filename(net_boot_file_name, argv[3], sizeof(net_boot_file_name)); break; diff --git a/cmd/wol.c b/cmd/wol.c new file mode 100644 index 00000000000..8a756f373c8 --- /dev/null +++ b/cmd/wol.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2018 + * Lothar Felte, [email protected] + */ + +/* + * Wake-on-LAN support + */ +#include <common.h> +#include <command.h> +#include <net.h> + +#if defined(CONFIG_CMD_WOL) +void wol_set_timeout(ulong); + +int do_wol(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + /* Validate arguments */ + if (argc < 2) + return CMD_RET_USAGE; + wol_set_timeout(simple_strtol(argv[1], NULL, 10) * 1000); + if (net_loop(WOL) < 0) + return CMD_RET_FAILURE; + return CMD_RET_SUCCESS; +} + +U_BOOT_CMD( + wol, 2, 1, do_wol, + "wait for an incoming wake-on-lan packet", + "Timeout" +); +#endif |
