mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 6/8] net: fix build with CONFIG_SHELL_NONE
Date: Fri, 17 May 2024 15:26:54 +0200	[thread overview]
Message-ID: <20240517132656.3151273-7-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240517132656.3151273-1-a.fatoum@pengutronix.de>

Some common networking code like fastboot over UDP calls ifup_all(0) to
bring up all interfaces. ifup_all(0) in turn runs commands to execute
interface discovery scripts and source network configurations.

This leads to a link error, because run_command is not defined in a
CONFIG_SHELL_NONE build as it lacks CONFIG_COMMAND_SUPPORT.

Fix this by adding inline stubs that fail for run_command and friends.
This way ifup_all(0) will either fail if there is a script that should
be run, but couldn't or just succeed if there are no applicable scripts
anyway.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/command.h | 8 ++++++++
 net/Kconfig       | 1 -
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/command.h b/include/command.h
index 9226756cc00b..26e06077b071 100644
--- a/include/command.h
+++ b/include/command.h
@@ -15,6 +15,7 @@
 #include <linux/compiler_types.h>
 #include <linux/stddef.h>
 #include <string.h>
+#include <errno.h>
 
 #ifndef	__ASSEMBLY__
 
@@ -49,10 +50,17 @@ extern struct command * const __barebox_cmd_end[];
 
 
 /* common/command.c */
+#ifdef CONFIG_COMMAND_SUPPORT
 struct command *find_cmd(const char *cmd);
 int execute_command(int argc, char **argv);
 void barebox_cmd_usage(struct command *cmdtp);
 int run_command(const char *cmd);
+#else
+static inline struct command *find_cmd(const char *cmd) { return NULL; }
+static inline int execute_command(int argc, char **argv) { return -ENOSYS; }
+static inline void barebox_cmd_usage(struct command *cmdtp) {}
+static inline int run_command(const char *cmd) { return -ENOSYS; }
+#endif
 
 #define COMMAND_SUCCESS		0
 #define COMMAND_ERROR		1
diff --git a/net/Kconfig b/net/Kconfig
index 07e623670e22..c13ee8bb43d8 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -40,7 +40,6 @@ config NET_RESOLV
 
 config NET_IFUP
 	default y
-	depends on !SHELL_NONE
 	bool
 
 config NET_DHCP
-- 
2.39.2




  parent reply	other threads:[~2024-05-17 13:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 13:26 [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 1/8] test: move common config fragments into common/boards/configs Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 2/8] kconfig: merge_config.sh: sync with Linux v6.9 Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 3/8] kbuild: add support for merged defconfigs Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 4/8] MIPS: make use of " Ahmad Fatoum
2024-05-20 10:23   ` [PATCH] fixup! " Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 5/8] sandbox: stdio: fix ctrlc link error when CONFIG_CONSOLE_NONE=y Ahmad Fatoum
2024-05-17 13:26 ` Ahmad Fatoum [this message]
2024-05-17 13:26 ` [PATCH 7/8] power: reset: reboot-mode: fix link error without globalvar Ahmad Fatoum
2024-05-17 13:26 ` [PATCH 8/8] sandbox: add headless_defconfig Ahmad Fatoum
2024-05-21  6:20 ` [PATCH 0/8] kconfig: cut down on duplication with merged defconfigs Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240517132656.3151273-7-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox