From ba814b8b5a74d1bc0cecd3f6031eecb025f28f15 Mon Sep 17 00:00:00 2001 From: Jerome Forissier Date: Wed, 25 Jun 2025 15:19:12 +0200 Subject: lwip: split cmd/net-lwip.c into one file per command Move each command in cmd/net-lwip.c into its own file (cmd/lwip/${cmd}.c). Suggested-by: Heinrich Schuchardt Signed-off-by: Jerome Forissier --- cmd/Makefile | 2 +- cmd/lwip/Makefile | 3 +++ cmd/lwip/dhcp.c | 9 +++++++++ cmd/lwip/dns.c | 3 +++ cmd/lwip/ping.c | 3 +++ cmd/lwip/tftp.c | 9 +++++++++ cmd/lwip/wget.c | 26 ++++++++++++++++++++++++++ cmd/net-lwip.c | 50 -------------------------------------------------- 8 files changed, 54 insertions(+), 51 deletions(-) create mode 100644 cmd/lwip/dhcp.c create mode 100644 cmd/lwip/tftp.c create mode 100644 cmd/lwip/wget.c delete mode 100644 cmd/net-lwip.c (limited to 'cmd') diff --git a/cmd/Makefile b/cmd/Makefile index 9c5bfc91659..34fa73d64fc 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -133,7 +133,7 @@ obj-$(CONFIG_CMD_NAND) += nand.o ifdef CONFIG_NET obj-$(CONFIG_CMD_NET) += net.o net-common.o else ifdef CONFIG_NET_LWIP -obj-$(CONFIG_CMD_NET) += net-lwip.o net-common.o +obj-$(CONFIG_CMD_NET) += net-common.o obj-y += lwip/ endif obj-$(CONFIG_ENV_SUPPORT) += nvedit.o diff --git a/cmd/lwip/Makefile b/cmd/lwip/Makefile index da79b64b5c2..4c28d2b28e5 100644 --- a/cmd/lwip/Makefile +++ b/cmd/lwip/Makefile @@ -1,2 +1,5 @@ +obj-$(CONFIG_CMD_DHCP) += dhcp.o obj-$(CONFIG_CMD_DNS) += dns.o obj-$(CONFIG_CMD_PING) += ping.o +obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o +obj-$(CONFIG_CMD_WGET) += wget.o diff --git a/cmd/lwip/dhcp.c b/cmd/lwip/dhcp.c new file mode 100644 index 00000000000..3894d71f654 --- /dev/null +++ b/cmd/lwip/dhcp.c @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024-2025 Linaro Ltd. */ + +#include +#include + +U_BOOT_CMD(dhcp, 3, 1, do_dhcp, + "boot image via network using DHCP/TFTP protocol", + "[loadAddress] [[hostIPaddr:]bootfilename]"); diff --git a/cmd/lwip/dns.c b/cmd/lwip/dns.c index fe70bdb4828..0af538e18f5 100644 --- a/cmd/lwip/dns.c +++ b/cmd/lwip/dns.c @@ -9,6 +9,9 @@ #include #include +U_BOOT_CMD(dns, 3, 1, do_dns, "lookup the IP of a hostname", + "hostname [envvar]"); + #define DNS_RESEND_MS 1000 #define DNS_TIMEOUT_MS 10000 diff --git a/cmd/lwip/ping.c b/cmd/lwip/ping.c index 1390b914f7d..6996931fa40 100644 --- a/cmd/lwip/ping.c +++ b/cmd/lwip/ping.c @@ -13,6 +13,9 @@ #include #include +U_BOOT_CMD(ping, 2, 1, do_ping, "send ICMP ECHO_REQUEST to network host", + "pingAddress"); + #define PING_DELAY_MS 1000 #define PING_COUNT 5 /* Ping identifier - must fit on a u16_t */ diff --git a/cmd/lwip/tftp.c b/cmd/lwip/tftp.c new file mode 100644 index 00000000000..6bb7a3733a2 --- /dev/null +++ b/cmd/lwip/tftp.c @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024-2025 Linaro Ltd. */ + +#include +#include + +U_BOOT_CMD(tftpboot, 3, 0, do_tftpb, + "boot image via network using TFTP protocol", + "[loadAddress] [[hostIPaddr:]bootfilename]"); diff --git a/cmd/lwip/wget.c b/cmd/lwip/wget.c new file mode 100644 index 00000000000..3f5b9952c93 --- /dev/null +++ b/cmd/lwip/wget.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024-2025 Linaro Ltd. */ + +#include +#include + +U_BOOT_CMD(wget, 4, 1, do_wget, + "boot image via network using HTTP/HTTPS protocol" +#if defined(CONFIG_WGET_CACERT) + "\nwget cacert - configure wget root certificates" +#endif + , + "[loadAddress] url\n" + "wget [loadAddress] [host:]path\n" + " - load file" +#if defined(CONFIG_WGET_CACERT) + "\nwget cacert
\n" + " - provide CA certificates (0 0 to remove current)" + "\nwget cacert none|optional|required\n" + " - set server certificate verification mode (default: optional)" +#if defined(CONFIG_WGET_BUILTIN_CACERT) + "\nwget cacert builtin\n" + " - use the builtin CA certificates" +#endif +#endif +); diff --git a/cmd/net-lwip.c b/cmd/net-lwip.c deleted file mode 100644 index cecf8d02555..00000000000 --- a/cmd/net-lwip.c +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* Copyright (C) 2024 Linaro Ltd. */ - -#include -#include - -#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 - -#if defined(CONFIG_CMD_PING) -U_BOOT_CMD(ping, 2, 1, do_ping, "send ICMP ECHO_REQUEST to network host", - "pingAddress"); -#endif - -#if defined(CONFIG_CMD_TFTPBOOT) -U_BOOT_CMD(tftpboot, 3, 0, do_tftpb, - "boot image via network using TFTP protocol", - "[loadAddress] [[hostIPaddr:]bootfilename]"); -#endif - -#if defined(CONFIG_CMD_DNS) -U_BOOT_CMD(dns, 3, 1, do_dns, "lookup the IP of a hostname", - "hostname [envvar]"); -#endif - -#if defined(CONFIG_CMD_WGET) -U_BOOT_CMD(wget, 4, 1, do_wget, - "boot image via network using HTTP/HTTPS protocol" -#if defined(CONFIG_WGET_CACERT) - "\nwget cacert - configure wget root certificates" -#endif - , - "[loadAddress] url\n" - "wget [loadAddress] [host:]path\n" - " - load file" -#if defined(CONFIG_WGET_CACERT) - "\nwget cacert
\n" - " - provide CA certificates (0 0 to remove current)" - "\nwget cacert none|optional|required\n" - " - set server certificate verification mode (default: optional)" -#if defined(CONFIG_WGET_BUILTIN_CACERT) - "\nwget cacert builtin\n" - " - use the builtin CA certificates" -#endif -#endif -); -#endif -- cgit v1.3.1