summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJerome Forissier <[email protected]>2024-10-16 12:04:03 +0200
committerTom Rini <[email protected]>2024-10-16 11:11:56 -0600
commit98ad145db61a51308abb9de3212d4e3078d145c0 (patch)
tree6a7cef76b36dca65a3ba6e0daadaa930592b1bf5 /cmd
parent1c41a7afaa15dded7cc4c42be61fa811e034e97b (diff)
net: lwip: add DHCP support and dhcp commmand
Add what it takes to enable NETDEVICES with NET_LWIP and enable DHCP as well as the dhcp command. CMD_TFTPBOOT is selected by BOOTMETH_EFI due to this code having an implicit dependency on do_tftpb(). Note that PXE is likely non-fonctional with NET_LWIP (or at least not 100% functional) because DHCP option 209 is not supported by the lwIP library. Therefore, BOOTP_PXE_DHCP_OPTION cannot be enabled. Signed-off-by: Jerome Forissier <[email protected]> Tested-by: Ilias Apalodimas <[email protected]> Acked-by: Ilias Apalodimas <[email protected]>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig100
-rw-r--r--cmd/Makefile6
-rw-r--r--cmd/elf.c2
-rw-r--r--cmd/net-lwip.c13
4 files changed, 76 insertions, 45 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 6d20d7597cb..211be398937 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1789,12 +1789,16 @@ config CMD_AB_SELECT
endmenu
-if NET
+if NET || NET_LWIP
menuconfig CMD_NET
bool "Network commands"
default y
+endif
+
+if NET
+
if CMD_NET
config CMD_BOOTP
@@ -1803,12 +1807,6 @@ config CMD_BOOTP
help
bootp - boot image via network using BOOTP/TFTP protocol
-config CMD_DHCP
- bool "dhcp"
- depends on CMD_BOOTP
- help
- Boot image via network using DHCP/TFTP protocol
-
config CMD_DHCP6
bool "dhcp6"
depends on IPV6
@@ -1952,12 +1950,6 @@ config BOOTP_VCI_STRING
default "U-Boot.arm" if ARM
default "U-Boot"
-config CMD_TFTPBOOT
- bool "tftpboot"
- default y
- help
- tftpboot - load file via network using TFTP protocol
-
config CMD_TFTPPUT
bool "tftp put"
depends on CMD_TFTPBOOT
@@ -2017,29 +2009,6 @@ config CMD_WGET
wget is a simple command to download kernel, or other files,
from a http server over TCP.
-config CMD_MII
- bool "mii"
- imply CMD_MDIO
- help
- If set, allows 802.3(clause 22) MII Management functions interface access
- The management interface specified in Clause 22 provides
- a simple, two signal, serial interface to connect a
- Station Management entity and a managed PHY for providing access
- to management parameters and services.
- The interface is referred to as the MII management interface.
-
-config MII_INIT
- bool "Call mii_init() in the mii command"
- depends on CMD_MII && (MPC8XX_FEC || FSLDMAFE || MCFFEC)
-
-config CMD_MDIO
- bool "mdio"
- depends on PHYLIB
- help
- If set, allows Enable 802.3(clause 45) MDIO interface registers access
- The MDIO interface is orthogonal to the MII interface and extends
- it by adding access to more registers through indirect addressing.
-
config CMD_PING
bool "ping"
help
@@ -2088,7 +2057,7 @@ config IPV6_ROUTER_DISCOVERY
help
Will automatically perform router solicitation on first IPv6
network operation
-endif
+endif # if CMD_NET
config CMD_ETHSW
bool "ethsw"
@@ -2098,6 +2067,56 @@ config CMD_ETHSW
operations such as enabling / disabling a port and
viewing/maintaining the filtering database (FDB)
+config CMD_WOL
+ bool "wol"
+ help
+ Wait for wake-on-lan Magic Packet
+
+endif # if NET
+
+if NET || NET_LWIP
+
+if CMD_NET
+
+config CMD_DHCP
+ bool "dhcp"
+ select PROT_DHCP_LWIP if NET_LWIP
+ help
+ Boot image via network using DHCP/TFTP protocol
+
+config CMD_MII
+ bool "mii"
+ imply CMD_MDIO
+ help
+ If set, allows 802.3(clause 22) MII Management functions interface access
+ The management interface specified in Clause 22 provides
+ a simple, two signal, serial interface to connect a
+ Station Management entity and a managed PHY for providing access
+ to management parameters and services.
+ The interface is referred to as the MII management interface.
+
+config MII_INIT
+ bool "Call mii_init() in the mii command"
+ depends on CMD_MII && (MPC8XX_FEC || FSLDMAFE || MCFFEC)
+
+config CMD_MDIO
+ bool "mdio"
+ depends on PHYLIB
+ help
+ If set, allows Enable 802.3(clause 45) MDIO interface registers access
+ The MDIO interface is orthogonal to the MII interface and extends
+ it by adding access to more registers through indirect addressing.
+
+config CMD_TFTPBOOT
+ bool "tftp"
+ select PROT_UDP_LWIP if NET_LWIP
+ default n
+ help
+ tftpboot - load file via network using TFTP protocol
+ Currently a placeholder (not implemented) when NET_LWIP=y.
+
+endif # if CMD_NET
+
config CMD_PXE
bool "pxe"
select PXE_UTILS
@@ -2105,12 +2124,7 @@ 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
+endif # if NET || NET_LWIP
menu "Misc commands"
diff --git a/cmd/Makefile b/cmd/Makefile
index 21d376309b9..94a3df41c6f 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -127,7 +127,11 @@ obj-y += legacy-mtd-utils.o
endif
obj-$(CONFIG_CMD_MUX) += mux.o
obj-$(CONFIG_CMD_NAND) += nand.o
-obj-$(CONFIG_CMD_NET) += net.o
+ifdef CONFIG_CMD_NET
+obj-$(CONFIG_NET) += net.o
+obj-$(CONFIG_NET_LWIP) += net-lwip.o
+CFLAGS_net-lwip.o := -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot
+endif
obj-$(CONFIG_ENV_SUPPORT) += nvedit.o
obj-$(CONFIG_CMD_NVEDIT_EFI) += nvedit_efi.o
obj-$(CONFIG_CMD_ONENAND) += onenand.o
diff --git a/cmd/elf.c b/cmd/elf.c
index 114f2caf7fa..6b49c613703 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -133,7 +133,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
addr = hextoul(argv[1], NULL);
-#if defined(CONFIG_CMD_NET)
+#if defined(CONFIG_CMD_NET) && !defined(CONFIG_NET_LWIP)
/*
* Check to see if we need to tftp the image ourselves
* before starting
diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c
new file mode 100644
index 00000000000..82edb5fd2e6
--- /dev/null
+++ b/cmd/net-lwip.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
+/* Copyright (C) 2024 Linaro Ltd. */
+
+#include <command.h>
+#include <net.h>
+
+#if defined(CONFIG_CMD_DHCP)
+U_BOOT_CMD(
+ dhcp, 3, 1, do_dhcp,
+ "boot image via network using DHCP/TFTP protocol",
+ "[loadAddress] [[hostIPaddr:]bootfilename]"
+);
+#endif