/*
* Boot support
*/
-#include <common.h>
#include <bootstage.h>
#include <command.h>
#include <dm.h>
+#include <dm/devres.h>
#include <env.h>
#include <image.h>
#include <log.h>
);
#endif
-
#ifdef CONFIG_CMD_RARP
int do_rarpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
#if defined(CONFIG_CMD_WGET)
static int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
{
+ wget_info = &default_wget_info;
+
return netboot_common(WGET, cmdtp, argc, argv);
}
static void netboot_update_env(void)
{
- char tmp[44];
+ char tmp[46];
if (net_gateway.s_addr) {
ip_to_string(net_gateway, tmp);
if (IS_ENABLED(CONFIG_IPV6)) {
if (!ip6_is_unspecified_addr(&net_ip6) ||
net_prefix_length != 0) {
- sprintf(tmp, "%pI6c", &net_ip6);
if (net_prefix_length != 0)
- sprintf(tmp, "%s/%d", tmp, net_prefix_length);
-
+ snprintf(tmp, sizeof(tmp), "%pI6c/%d", &net_ip6, net_prefix_length);
+ else
+ snprintf(tmp, sizeof(tmp), "%pI6c", &net_ip6);
env_set("ip6addr", tmp);
}
if (!ip6_is_unspecified_addr(&net_server_ip6)) {
- sprintf(tmp, "%pI6c", &net_server_ip6);
+ snprintf(tmp, sizeof(tmp), "%pI6c", &net_server_ip6);
env_set("serverip6", tmp);
}
if (!ip6_is_unspecified_addr(&net_gateway6)) {
- sprintf(tmp, "%pI6c", &net_gateway6);
+ snprintf(tmp, sizeof(tmp), "%pI6c", &net_gateway6);
env_set("gatewayip6", tmp);
}
}
);
#endif /* CONFIG_CMD_LINK_LOCAL */
-
-static int do_net_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
- const struct udevice *current = eth_get_dev();
- unsigned char env_enetaddr[ARP_HLEN];
- const struct udevice *dev;
- struct uclass *uc;
-
- uclass_id_foreach_dev(UCLASS_ETH, dev, uc) {
- eth_env_get_enetaddr_by_index("eth", dev_seq(dev), env_enetaddr);
- printf("eth%d : %s %pM %s\n", dev_seq(dev), dev->name, env_enetaddr,
- current == dev ? "active" : "");
- }
- return CMD_RET_SUCCESS;
-}
-
-static struct cmd_tbl cmd_net[] = {
- U_BOOT_CMD_MKENT(list, 1, 0, do_net_list, "", ""),
-};
-
-static int do_net(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
- struct cmd_tbl *cp;
-
- cp = find_cmd_tbl(argv[1], cmd_net, ARRAY_SIZE(cmd_net));
-
- /* Drop the net command */
- argc--;
- argv++;
-
- if (!cp || argc > cp->maxargs)
- return CMD_RET_USAGE;
- if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp))
- return CMD_RET_SUCCESS;
-
- return cp->cmd(cmdtp, flag, argc, argv);
-}
-
-U_BOOT_CMD(
- net, 2, 1, do_net,
- "NET sub-system",
- "list - list available devices\n"
-);
-
-#if defined(CONFIG_CMD_NCSI)
-static int do_ncsi(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
-{
- if (!phy_interface_is_ncsi() || !ncsi_active()) {
- printf("Device not configured for NC-SI\n");
- return CMD_RET_FAILURE;
- }
-
- if (net_loop(NCSI) < 0)
- return CMD_RET_FAILURE;
-
- return CMD_RET_SUCCESS;
-}
-
-U_BOOT_CMD(
- ncsi, 1, 1, do_ncsi,
- "Configure attached NIC via NC-SI",
- ""
-);
-#endif /* CONFIG_CMD_NCSI */