[U-Boot] [PATCH] cmd: move CMD_PXE to Kconfig

Yann E. MORIN yann.morin.1998 at free.fr
Sun Nov 13 21:59:52 CET 2016


Currently, CMD_PXE is forcibly enabled in config_distro_defaults.h, so
that general purpose distributions can rely on it being defined. This
header is included, under conditions or not, by various archs or
famillies of archs / SoCs.

However, it is very possible that boards based on those SoCs will not
have a physical ethernet connector at all, even if the have a MAC; for
example, the Nanopi Neo AIR (sunxi H3) does not. It is also possible
that network booting is absolutely not necessary for a device.

However, it is not possible to disable the PXE command, as it is
forcibly enabled and is non-configurable.

But it turns out we already have a config option to build a distro-ready
image, in the name of DISTRO_DEFAULTS.

Move CMD_PXE out of the hard-coded config_distro_defaults.h into a
Kconfig option, that gets selected by DISTRO_DEFAULTS when it is set.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at free.fr>
Cc: Joe Hershberger <joe.hershberger at ni.com>
---
 Kconfig                          | 1 +
 cmd/Kconfig                      | 5 +++++
 include/config_distro_defaults.h | 2 --
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Kconfig b/Kconfig
index 1263d0b..5421cd3 100644
--- a/Kconfig
+++ b/Kconfig
@@ -60,6 +60,7 @@ config DISTRO_DEFAULTS
 	select CMD_BOOTZ if ARM && !ARM64
 	select CMD_BOOTI if ARM64
 	select CMD_DHCP
+	select CMD_PXE
 	select CMD_EXT2
 	select CMD_EXT4
 	select CMD_FAT
diff --git a/cmd/Kconfig b/cmd/Kconfig
index e339d86..95f5ce6 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -496,6 +496,11 @@ config CMD_DHCP
 	help
 	  Boot image via network using DHCP/TFTP protocol
 
+config CMD_PXE
+	bool "pxe"
+	help
+	  Boot image via network using PXE protocol
+
 config CMD_NFS
 	bool "nfs"
 	default y
diff --git a/include/config_distro_defaults.h b/include/config_distro_defaults.h
index b5efab5..01cd6d9 100644
--- a/include/config_distro_defaults.h
+++ b/include/config_distro_defaults.h
@@ -20,8 +20,6 @@
 #define CONFIG_BOOTP_PXE
 #define CONFIG_BOOTP_SUBNETMASK
 
-#define CONFIG_CMD_PXE
-
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_SYS_LONGHELP
-- 
2.7.4



More information about the U-Boot mailing list