Move each command in cmd/net-lwip.c into its own file (cmd/lwip/${cmd}.c). Suggested-by: Heinrich Schuchardt <xypron.g...@gmx.de> Signed-off-by: Jerome Forissier <jerome.foriss...@linaro.org> ---
Changes in v2: - New patch MAINTAINERS | 1 + cmd/Makefile | 2 +- cmd/lwip/Makefile | 5 +++++ cmd/lwip/dhcp.c | 9 +++++++++ cmd/lwip/dns.c | 8 ++++++++ cmd/lwip/ping.c | 8 ++++++++ cmd/lwip/tftp.c | 9 +++++++++ cmd/{net-lwip.c => lwip/wget.c} | 26 +------------------------- 8 files changed, 42 insertions(+), 26 deletions(-) create mode 100644 cmd/lwip/Makefile create mode 100644 cmd/lwip/dhcp.c create mode 100644 cmd/lwip/dns.c create mode 100644 cmd/lwip/ping.c create mode 100644 cmd/lwip/tftp.c rename cmd/{net-lwip.c => lwip/wget.c} (51%) diff --git a/MAINTAINERS b/MAINTAINERS index d62dd35a385..e8f644fc75b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1409,6 +1409,7 @@ F: net/ NETWORK (LWIP) M: Jerome Forissier <jerome.foriss...@linaro.org> S: Maintained +F: cmd/lwip/ F: cmd/net-lwip.c F: configs/qemu_arm64_lwip_defconfig F: drivers/net/sandbox-lwip.c diff --git a/cmd/Makefile b/cmd/Makefile index 80cf70b7fe8..2c6b13ffc5c 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) += lwip/ net-common.o endif obj-$(CONFIG_ENV_SUPPORT) += nvedit.o obj-$(CONFIG_CMD_NVEDIT_EFI) += nvedit_efi.o diff --git a/cmd/lwip/Makefile b/cmd/lwip/Makefile new file mode 100644 index 00000000000..4c28d2b28e5 --- /dev/null +++ b/cmd/lwip/Makefile @@ -0,0 +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 <command.h> +#include <net.h> + +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 new file mode 100644 index 00000000000..31642b864af --- /dev/null +++ b/cmd/lwip/dns.c @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024-2025 Linaro Ltd. */ + +#include <command.h> +#include <net.h> + +U_BOOT_CMD(dns, 3, 1, do_dns, "lookup the IP of a hostname", + "hostname [envvar]"); diff --git a/cmd/lwip/ping.c b/cmd/lwip/ping.c new file mode 100644 index 00000000000..af5c022f55f --- /dev/null +++ b/cmd/lwip/ping.c @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024-2025 Linaro Ltd. */ + +#include <command.h> +#include <net.h> + +U_BOOT_CMD(ping, 2, 1, do_ping, "send ICMP ECHO_REQUEST to network host", + "pingAddress"); 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 <command.h> +#include <net.h> + +U_BOOT_CMD(tftpboot, 3, 0, do_tftpb, + "boot image via network using TFTP protocol", + "[loadAddress] [[hostIPaddr:]bootfilename]"); diff --git a/cmd/net-lwip.c b/cmd/lwip/wget.c similarity index 51% rename from cmd/net-lwip.c rename to cmd/lwip/wget.c index cecf8d02555..3f5b9952c93 100644 --- a/cmd/net-lwip.c +++ b/cmd/lwip/wget.c @@ -1,32 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ -/* Copyright (C) 2024 Linaro Ltd. */ +/* Copyright (C) 2024-2025 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 - -#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) @@ -47,4 +24,3 @@ U_BOOT_CMD(wget, 4, 1, do_wget, #endif #endif ); -#endif -- 2.43.0