[PATCH] bootstd: Allow PXE boot to be disabled

Tony Dinh mibodhi at gmail.com
Fri Oct 10 07:29:17 CEST 2025


Make it possible to disable CMD_PXE.
Remove unnecessary PXE_UTILS selection in BOOTMETH_EXTLINUX config.
In extlinux_boot(), invoke pxe utils only when
CONFIG_BOOTMETH_EXTLINUX_PXE is enabled.

This patch results in about 9K reduction in image size when
PXE boot is disabled.

Signed-off-by: Tony Dinh <mibodhi at gmail.com>
---

 boot/Kconfig             |  3 +--
 boot/bootmeth_extlinux.c | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/boot/Kconfig b/boot/Kconfig
index 2993cd7f9ba..403ce4c3d46 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -421,10 +421,10 @@ config BOOT_DEFAULTS_CMDS
 	select CMD_PART if PARTITIONS
 	select CMD_DHCP if CMD_NET
 	select CMD_PING if CMD_NET
-	select CMD_PXE if CMD_NET
 	select CMD_BOOTI if ARM64
 	select CMD_BOOTZ if ARM && !ARM64
 	imply CMD_MII if NET
+	imply CMD_PXE if CMD_NET
 
 config BOOT_DEFAULTS
 	bool  # Common defaults for standard boot and distroboot
@@ -575,7 +575,6 @@ config BOOTMETH_CROS
 
 config BOOTMETH_EXTLINUX
 	bool "Bootdev support for extlinux boot"
-	select PXE_UTILS
 	default y
 	help
 	  Enables support for extlinux boot using bootdevs. This makes the
diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c
index 921d721a27b..ceac41a1370 100644
--- a/boot/bootmeth_extlinux.c
+++ b/boot/bootmeth_extlinux.c
@@ -188,14 +188,16 @@ static int extlinux_boot(struct udevice *dev, struct bootflow *bflow)
 
 	plat = dev_get_plat(dev);
 
-	ret = pxe_setup_ctx(&ctx, &cmdtp, extlinux_getfile, &info, true,
-			    bflow->fname, false, plat->use_fallback);
-	if (ret)
-		return log_msg_ret("ctx", -EINVAL);
-
-	ret = pxe_process(&ctx, addr, false);
-	if (ret)
-		return log_msg_ret("bread", -EINVAL);
+	if (IS_ENABLED(CONFIG_BOOTMETH_EXTLINUX_PXE)) {
+		ret = pxe_setup_ctx(&ctx, &cmdtp, extlinux_getfile, &info, true,
+				    bflow->fname, false, plat->use_fallback);
+		if (ret)
+			return log_msg_ret("ctx", -EINVAL);
+
+		ret = pxe_process(&ctx, addr, false);
+		if (ret)
+			return log_msg_ret("bread", -EINVAL);
+	}
 
 	return 0;
 }
-- 
2.47.3

base-commit: 7e1456a5f62fae19012beda3750aab1e21284fbf
branch: master


More information about the U-Boot mailing list