Skip to contentSkip to conversation

net: Kconfig: add CONFIG_WGET symbol

PATCH Superseded Adriano Cordova 3 participants 3 messages Nov 6, 2024 – Nov 8, 2024 Networking

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 net: Kconfig: add CONFIG_WGET symbol

Let net/wget.c and net/lwip/wget.c depend on CONFIG_WGET, and cmd/wget.c depend on CONFIG_CMD_WGET. This way, the wget code can be used regardless of whether the wget command is available.

---
 cmd/Kconfig       | 5 +----
 net/Kconfig       | 9 +++++++++
 net/Makefile      | 2 +-
 net/lwip/Makefile | 2 +-
 4 files changed, 12 insertions(+), 6 deletions(-)
cmd/Kconfig +1 -4
index 636833646f..8f3ad94089 100644
@@ -2115,11 +2115,8 @@ config CMD_TFTPBOOT
 
 config CMD_WGET
 	bool "wget"
-	depends on CMD_NET
 	default y if SANDBOX
-	select PROT_TCP if NET
-	select PROT_TCP_LWIP if NET_LWIP
-	select PROT_DNS_LWIP if NET_LWIP
+	select WGET
 	help
 	  wget is a simple command to download kernel, or other files,
 	  from a http server over TCP.
net/Kconfig +9 -0
index 76ab7d91ee..b4bb68dd61 100644
@@ -244,6 +244,15 @@ config NET_RANDOM_ETHADDR
 	  generated. It will be saved to the appropriate environment variable,
 	  too.
 
+config WGET
+	bool "Enable wget"
+	select PROT_TCP if NET
+	select PROT_TCP_LWIP if NET_LWIP
+	select PROT_DNS_LWIP if NET_LWIP
+	help
+	  Selecting this will enable wget, an interface to send HTTP requests
+	  via the network stack.
+
 config TFTP_BLOCKSIZE
 	int "TFTP block size"
 	default 1468
net/Makefile +1 -1
index 209377aeb2..7c917b318c 100644
@@ -29,7 +29,7 @@ obj-$(CONFIG_$(PHASE_)TCP_FUNCTION_FASTBOOT)  += fastboot_tcp.o
 obj-$(CONFIG_CMD_WOL)  += wol.o
 obj-$(CONFIG_PROT_UDP) += udp.o
 obj-$(CONFIG_PROT_TCP) += tcp.o
-obj-$(CONFIG_CMD_WGET) += wget.o
+obj-$(CONFIG_WGET) += wget.o
 
 # Disable this warning as it is triggered by:
 # sprintf(buf, index ? "foo%d" : "foo", index)
net/lwip/Makefile +1 -1
index f2558f8763..79dd6b3fb5 100644
@@ -5,4 +5,4 @@ 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
+obj-$(CONFIG_WGET) += wget.o
Signature · 1 line
2.43.0
Reviewed-by on v1 1/7
#1 lore raw
Quoted 67 lines · Adriano Cordova

Let net/wget.c and net/lwip/wget.c depend on CONFIG_WGET, and cmd/wget.c depend on CONFIG_CMD_WGET. This way, the wget code can be used regardless of whether the wget command is available.

---
 cmd/Kconfig       | 5 +----
 net/Kconfig       | 9 +++++++++
 net/Makefile      | 2 +-
 net/lwip/Makefile | 2 +-
 4 files changed, 12 insertions(+), 6 deletions(-)
cmd/Kconfig +1 -4
index 636833646f..8f3ad94089 100644
@@ -2115,11 +2115,8 @@ config CMD_TFTPBOOT
 
 config CMD_WGET
 	bool "wget"
-	depends on CMD_NET
 	default y if SANDBOX
-	select PROT_TCP if NET
-	select PROT_TCP_LWIP if NET_LWIP
-	select PROT_DNS_LWIP if NET_LWIP
+	select WGET
 	help
 	  wget is a simple command to download kernel, or other files,
 	  from a http server over TCP.
net/Kconfig +9 -0
index 76ab7d91ee..b4bb68dd61 100644
@@ -244,6 +244,15 @@ config NET_RANDOM_ETHADDR
 	  generated. It will be saved to the appropriate environment variable,
 	  too.
 
+config WGET
+	bool "Enable wget"
+	select PROT_TCP if NET
+	select PROT_TCP_LWIP if NET_LWIP
+	select PROT_DNS_LWIP if NET_LWIP
+	help
+	  Selecting this will enable wget, an interface to send HTTP requests
+	  via the network stack.
+
 config TFTP_BLOCKSIZE
 	int "TFTP block size"
 	default 1468
net/Makefile +1 -1
index 209377aeb2..7c917b318c 100644
@@ -29,7 +29,7 @@ obj-$(CONFIG_$(PHASE_)TCP_FUNCTION_FASTBOOT)  += fastboot_tcp.o
 obj-$(CONFIG_CMD_WOL)  += wol.o
 obj-$(CONFIG_PROT_UDP) += udp.o
 obj-$(CONFIG_PROT_TCP) += tcp.o
-obj-$(CONFIG_CMD_WGET) += wget.o
+obj-$(CONFIG_WGET) += wget.o
 
 # Disable this warning as it is triggered by:
 # sprintf(buf, index ? "foo%d" : "foo", index)
net/lwip/Makefile +0 -0
index f2558f8763..79dd6b3fb5 100644

net/lwip/Makefile obj-$(CONFIG_CMD_DHCP) += dhcp.o · line 8

Quoted 5 lines
net/lwip/Makefile +1 -1
@@ -5,4 +5,4 @@ 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
+obj-$(CONFIG_WGET) += wget.o

Thanks,

Signature · 1 line
Jerome
Reviewed-by on v1 1/7
#2 lore raw
In reply to Adriano Cordova
Quoted 5 lines · Adriano Cordova

Let net/wget.c and net/lwip/wget.c depend on CONFIG_WGET, and cmd/wget.c depend on CONFIG_CMD_WGET. This way, the wget code can be used regardless of whether the wget command is available.

Quoted 67 lines
---
  cmd/Kconfig       | 5 +----
  net/Kconfig       | 9 +++++++++
  net/Makefile      | 2 +-
  net/lwip/Makefile | 2 +-
  4 files changed, 12 insertions(+), 6 deletions(-)
cmd/Kconfig +1 -4
index 636833646f..8f3ad94089 100644
@@ -2115,11 +2115,8 @@ config CMD_TFTPBOOT
 
  config CMD_WGET
  	bool "wget"
-	depends on CMD_NET
  	default y if SANDBOX
-	select PROT_TCP if NET
-	select PROT_TCP_LWIP if NET_LWIP
-	select PROT_DNS_LWIP if NET_LWIP
+	select WGET
  	help
  	  wget is a simple command to download kernel, or other files,
  	  from a http server over TCP.
net/Kconfig +9 -0
index 76ab7d91ee..b4bb68dd61 100644
@@ -244,6 +244,15 @@ config NET_RANDOM_ETHADDR
  	  generated. It will be saved to the appropriate environment variable,
  	  too.
 
+config WGET
+	bool "Enable wget"
+	select PROT_TCP if NET
+	select PROT_TCP_LWIP if NET_LWIP
+	select PROT_DNS_LWIP if NET_LWIP
+	help
+	  Selecting this will enable wget, an interface to send HTTP requests
+	  via the network stack.
+
  config TFTP_BLOCKSIZE
  	int "TFTP block size"
  	default 1468
net/Makefile +1 -1
index 209377aeb2..7c917b318c 100644
@@ -29,7 +29,7 @@ obj-$(CONFIG_$(PHASE_)TCP_FUNCTION_FASTBOOT)  += fastboot_tcp.o
  obj-$(CONFIG_CMD_WOL)  += wol.o
  obj-$(CONFIG_PROT_UDP) += udp.o
  obj-$(CONFIG_PROT_TCP) += tcp.o
-obj-$(CONFIG_CMD_WGET) += wget.o
+obj-$(CONFIG_WGET) += wget.o
 
  # Disable this warning as it is triggered by:
  # sprintf(buf, index ? "foo%d" : "foo", index)
net/lwip/Makefile +1 -1
index f2558f8763..79dd6b3fb5 100644
@@ -5,4 +5,4 @@ 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
+obj-$(CONFIG_WGET) += wget.o