Skip to contentSkip to conversation

bootstd: Allow PXE boot to be disabled

PATCH In review Tony Dinh 4 participants 17 messages Oct 10, 2025 – Oct 14, 2025

lore
Share & tools
lore

Tony Dinh

author
#0 lore raw

PATCH 1/1 bootstd: Allow PXE boot to be disabled

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.

---

 boot/Kconfig             |  3 +--
 boot/bootmeth_extlinux.c | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)
boot/Kconfig +1 -2
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
boot/bootmeth_extlinux.c +10 -8
index 921d721a27b..ceac41a1370 100644
@@ -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;
 }
Signature · 4 lines
2.47.3

base-commit: 7e1456a5f62fae19012beda3750aab1e21284fbf
branch: master
#1 lore raw

Hi Tony,

Quoted 56 lines · Tony Dinh

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.

---

 boot/Kconfig             |  3 +--
 boot/bootmeth_extlinux.c | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)
boot/Kconfig +1 -2
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
boot/bootmeth_extlinux.c +0 -8
index 921d721a27b..ceac41a1370 100644
@@ -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);

boot/bootmeth_extlinux.c static int extlinux_boot(struct udevice *dev, struct bootflow *bflow) · line 200

Quoted 10 lines
boot/bootmeth_extlinux.c +10 -0
+       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);
+       }

But if you disable that, what use is the extlinux bootmeth?

Quoted 8 lines
boot/bootmeth_extlinux.c +0 -1
        return 0;
 }
--

2.47.3

base-commit: 7e1456a5f62fae19012beda3750aab1e21284fbf
branch: master

Regards,
Simon

#2 lore raw
In reply to Tony Dinh
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 6 lines
boot/Kconfig +0 -0
index 2993cd7f9ba..403ce4c3d46 100644

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 8 lines
boot/Kconfig +1 -1
@@ -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

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Signature · 1 line
Tom
author
#3 lore raw

Hi Tom & Simon,

Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

I'm simply trying to compile out PXE for a board that I'm working on! The only thing I need is booting with scripts on a block device. And it looks like we have to include everything in bootstd to use it. It seems wrong to make the image a lot larger than needed for boards that never use a specific feature.

I would agree about "defaults isn't supposed to be so easy to get out of". But in this case (and similarly in other CMD_x), CMD_PXE brings in all dependencies for PXE including pxe_utils.

All the best,
Tony

Quoted 3 lines

--
Tom

#4 lore raw
Quoted 50 lines · Tony Dinh

Hi Tom & Simon,

Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

I'm simply trying to compile out PXE for a board that I'm working on! The only thing I need is booting with scripts on a block device. And it looks like we have to include everything in bootstd to use it. It seems wrong to make the image a lot larger than needed for boards that never use a specific feature.

Quoted 3 lines

I would agree about "defaults isn't supposed to be so easy to get out of". But in this case (and similarly in other CMD_x), CMD_PXE brings in all dependencies for PXE including pxe_utils.

So, as a preface, it's quite likely that we do need to tweak some of the Kconfig logic here. To help better understand the use case:
- Does this platform have networking devices in U-Boot?
- Are you wanting to support arbitrary off the shelf OS distributions?

Because if you don't have networking at all, then we should indeed be able to bring the library part of PXE (parse extlinux.conf style files) without bringing in all of PXE.

If you don't want to allow arbitrary OS distributions then it should be possible to turn off the CONFIG that brings in everything an arbitrary OS might want (for example, install via network) and still have standard boot available for block devices and scripts and extlinux support.

Signature · 1 line
Tom
author
#5 lore raw

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Tony Dinh

Hi Tom & Simon,

Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

I'm simply trying to compile out PXE for a board that I'm working on! The only thing I need is booting with scripts on a block device. And it looks like we have to include everything in bootstd to use it. It seems wrong to make the image a lot larger than needed for boards that never use a specific feature.

Quoted 8 lines
Quoted 3 lines

I would agree about "defaults isn't supposed to be so easy to get out of". But in this case (and similarly in other CMD_x), CMD_PXE brings in all dependencies for PXE including pxe_utils.

So, as a preface, it's quite likely that we do need to tweak some of the Kconfig logic here. To help better understand the use case:
- Does this platform have networking devices in U-Boot?
- Are you wanting to support arbitrary off the shelf OS distributions?

Yes to both. Networking is enabled in U-Boot, but not used for booting. And it should boot various off-the-shell OS. U-Boot is on a 512KB partition on SPI flash (why I want to keep u-boot image as small as possible).

Thanks for your reply!
Tony

Quoted 12 lines

Because if you don't have networking at all, then we should indeed be able to bring the library part of PXE (parse extlinux.conf style files) without bringing in all of PXE.

If you don't want to allow arbitrary OS distributions then it should be possible to turn off the CONFIG that brings in everything an arbitrary OS might want (for example, install via network) and still have standard boot available for block devices and scripts and extlinux support.

--
Tom

#6 lore raw
Quoted 64 lines · Tony Dinh

Hi Tom,

Quoted 52 lines · Tom Rini
Quoted 50 lines · Tony Dinh

Hi Tom & Simon,

Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

I'm simply trying to compile out PXE for a board that I'm working on! The only thing I need is booting with scripts on a block device. And it looks like we have to include everything in bootstd to use it. It seems wrong to make the image a lot larger than needed for boards that never use a specific feature.

Quoted 8 lines
Quoted 3 lines

I would agree about "defaults isn't supposed to be so easy to get out of". But in this case (and similarly in other CMD_x), CMD_PXE brings in all dependencies for PXE including pxe_utils.

So, as a preface, it's quite likely that we do need to tweak some of the Kconfig logic here. To help better understand the use case:
- Does this platform have networking devices in U-Boot?
- Are you wanting to support arbitrary off the shelf OS distributions?

Quoted 4 lines

Yes to both. Networking is enabled in U-Boot, but not used for booting. And it should boot various off-the-shell OS. U-Boot is on a 512KB partition on SPI flash (why I want to keep u-boot image as small as possible).

This is the hard case then. The point of the options is that if you enable them, all of the common cases like network booting work. Without knowing the device itself, I'm unsure why no one would ever use the network to install the OS.

I suspect you need to look for where you can change "select something-boot-standard" to "imply something-boot-standard" and then turn it off for your platform, and turn on what you want to support for it. It's taking the Kconfig change you proposed to start with one step further.

Signature · 1 line
Tom
#7 lore raw
In reply to Tom Rini
Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

Peter

#8 lore raw
Quoted 42 lines · Peter Robinson
Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Quoted 7 lines

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

And in the world where we also can't just remove ATAGS support because distros (Debian at least) still boots some modern platforms via ATAGS + appended device tree, the high level options for "boot this anywhere" need to perhaps be different from "very modern requirements only distro". I'm not objecting to be clear.

Signature · 1 line
Tom
author
#9 lore raw
Quoted 44 lines · Tom Rini
Quoted 42 lines · Peter Robinson
Quoted 40 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 6 lines
boot/Kconfig +0 -0
index 2993cd7f9ba..403ce4c3d46 100644

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 8 lines
boot/Kconfig +1 -1
@@ -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

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Quoted 7 lines
Quoted 7 lines

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

Glad to hear :)

Quoted 6 lines

And in the world where we also can't just remove ATAGS support because distros (Debian at least) still boots some modern platforms via ATAGS + appended device tree, the high level options for "boot this anywhere" need to perhaps be different from "very modern requirements only distro". I'm not objecting to be clear.

As Tom suggested previously, perhaps looking from a different angle. We can disable BOOTSTD_FULL and then try adding only options that are needed for a board. Unfortunately this approach did not work when I tried it in the past. It seems for bootstd to work well, we need to take the whole thing by enabling BOOTSTD_FULL.

All the best,
Tony

Quoted 3 lines

--
Tom

#10 lore raw

Hi Tony,

Quoted 28 lines · Tony Dinh
Quoted 26 lines · Tom Rini
Quoted 24 lines · Peter Robinson
Quoted 23 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 1 line
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
boot/Kconfig +0 -0
index 2993cd7f9ba..403ce4c3d46 100644
@@ -421,10 +421,10 @@ config BOOT_DEFAULTS_CMDS
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 8 lines
boot/Kconfig +1 -1
      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

If you only want scripts, then perhaps you can enable just what you need, e.g. BOOTMETH_SCRIPT? You may need to disable BOOT_DEFAULTS and choose your own options.

Quoted 22 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Quoted 7 lines
Quoted 7 lines

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

Glad to hear :)

Quoted 6 lines

And in the world where we also can't just remove ATAGS support because distros (Debian at least) still boots some modern platforms via ATAGS + appended device tree, the high level options for "boot this anywhere" need to perhaps be different from "very modern requirements only distro". I'm not objecting to be clear.

Quoted 5 lines

As Tom suggested previously, perhaps looking from a different angle. We can disable BOOTSTD_FULL and then try adding only options that are needed for a board. Unfortunately this approach did not work when I tried it in the past. It seems for bootstd to work well, we need to take the whole thing by enabling BOOTSTD_FULL.

If you end up trying it again, please give a few details here as we might be able to improve this. When bootstd was first introduced we had very tight code-size constraints, so quite a few features are only provided if BOOTSTD_FULL is enabled. Tom has suggested enabling more features in the base implementation but we haven't really figured out which.

Regards,
Simon

author
#11 lore raw

Hi Simon,

Quoted 41 lines · Simon Glass

Hi Tony,

Quoted 37 lines · Tony Dinh
Quoted 35 lines · Tom Rini
Quoted 33 lines · Peter Robinson
Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

If you only want scripts, then perhaps you can enable just what you need, e.g. BOOTMETH_SCRIPT? You may need to disable BOOT_DEFAULTS and choose your own options.

Indeed, that was a missing config when I tried with BOOTSTD_FULL disabled. But there is more, please see below.

Quoted 29 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Quoted 7 lines
Quoted 7 lines

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

Glad to hear :)

Quoted 6 lines

And in the world where we also can't just remove ATAGS support because distros (Debian at least) still boots some modern platforms via ATAGS + appended device tree, the high level options for "boot this anywhere" need to perhaps be different from "very modern requirements only distro". I'm not objecting to be clear.

Quoted 5 lines

As Tom suggested previously, perhaps looking from a different angle. We can disable BOOTSTD_FULL and then try adding only options that are needed for a board. Unfortunately this approach did not work when I tried it in the past. It seems for bootstd to work well, we need to take the whole thing by enabling BOOTSTD_FULL.

Quoted 6 lines

If you end up trying it again, please give a few details here as we might be able to improve this. When bootstd was first introduced we had very tight code-size constraints, so quite a few features are only provided if BOOTSTD_FULL is enabled. Tom has suggested enabling more features in the base implementation but we haven't really figured out which.

The problem is when a board already has enabled BOOTSTD_FULL or has been updated with Distro Boot (CONFIG_DISTRO_DEFAULTS), all the necessary configurations such as ext2, ext4, efi partition,... are implied, therefore were removed from board defconfig. They must be added back.

I actually tried this just now and it does work booting a script from USB drive with this combination:

CONFIG_BOOTMETH_SCRIPT=y
CONFIG_DISTRO_DEFAULTS=y (this also selects CMD_PXE, but it's OK
for this test)
# CONFIG_BOOTSTD_FULL is not set

I think it's quite cumbersome to add each of the necessary configs back to the board defconfig. Not as easy as removing CMD_PXE, or other CMD_x to remove a capability.

All the best,
Tony

Quoted 3 lines

Regards,
Simon

#12 lore raw

Hi Tony,

Quoted 102 lines · Tony Dinh

Hi Simon,

Quoted 41 lines · Simon Glass

Hi Tony,

Quoted 37 lines · Tony Dinh
Quoted 35 lines · Tom Rini
Quoted 33 lines · Peter Robinson
Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

If you only want scripts, then perhaps you can enable just what you need, e.g. BOOTMETH_SCRIPT? You may need to disable BOOT_DEFAULTS and choose your own options.

Indeed, that was a missing config when I tried with BOOTSTD_FULL disabled. But there is more, please see below.

Quoted 29 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Quoted 7 lines
Quoted 7 lines

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

Glad to hear :)

Quoted 6 lines

And in the world where we also can't just remove ATAGS support because distros (Debian at least) still boots some modern platforms via ATAGS + appended device tree, the high level options for "boot this anywhere" need to perhaps be different from "very modern requirements only distro". I'm not objecting to be clear.

Quoted 5 lines

As Tom suggested previously, perhaps looking from a different angle. We can disable BOOTSTD_FULL and then try adding only options that are needed for a board. Unfortunately this approach did not work when I tried it in the past. It seems for bootstd to work well, we need to take the whole thing by enabling BOOTSTD_FULL.

Quoted 6 lines

If you end up trying it again, please give a few details here as we might be able to improve this. When bootstd was first introduced we had very tight code-size constraints, so quite a few features are only provided if BOOTSTD_FULL is enabled. Tom has suggested enabling more features in the base implementation but we haven't really figured out which.

The problem is when a board already has enabled BOOTSTD_FULL or has been updated with Distro Boot (CONFIG_DISTRO_DEFAULTS), all the necessary configurations such as ext2, ext4, efi partition,... are implied, therefore were removed from board defconfig. They must be added back.

I actually tried this just now and it does work booting a script from USB drive with this combination:

Quoted 8 lines

CONFIG_BOOTMETH_SCRIPT=y
CONFIG_DISTRO_DEFAULTS=y (this also selects CMD_PXE, but it's OK
for this test)
# CONFIG_BOOTSTD_FULL is not set

I think it's quite cumbersome to add each of the necessary configs back to the board defconfig. Not as easy as removing CMD_PXE, or other CMD_x to remove a capability.

Yes I agree, it is cumbersome.

The problem is that if you don't enable building pxe_setup_ctx() then it really doesn't make sense to enable bootmeth_extlinux since you cannot actually boot.

Changing from imply to select seems OK to me as it provides flexibility. As you say it allows disabling things piecemeal rather than starting from scratch and having to enable many individual options to get back to a booting system.

But there are disadvantages too. There was quite a lot of discussion leading to the way it is now, e.g. [1]

I think we should wait for Tom to weigh in again here.

Regards,
Simon

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/#3063438

#13 lore raw
In reply to Tony Dinh
Quoted 101 lines · Tony Dinh

Hi Simon,

Quoted 41 lines · Simon Glass

Hi Tony,

Quoted 37 lines · Tony Dinh
Quoted 35 lines · Tom Rini
Quoted 33 lines · Peter Robinson
Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

If you only want scripts, then perhaps you can enable just what you need, e.g. BOOTMETH_SCRIPT? You may need to disable BOOT_DEFAULTS and choose your own options.

Indeed, that was a missing config when I tried with BOOTSTD_FULL disabled. But there is more, please see below.

Quoted 29 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Quoted 7 lines
Quoted 7 lines

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

Glad to hear :)

Quoted 6 lines

And in the world where we also can't just remove ATAGS support because distros (Debian at least) still boots some modern platforms via ATAGS + appended device tree, the high level options for "boot this anywhere" need to perhaps be different from "very modern requirements only distro". I'm not objecting to be clear.

Quoted 5 lines

As Tom suggested previously, perhaps looking from a different angle. We can disable BOOTSTD_FULL and then try adding only options that are needed for a board. Unfortunately this approach did not work when I tried it in the past. It seems for bootstd to work well, we need to take the whole thing by enabling BOOTSTD_FULL.

Quoted 6 lines

If you end up trying it again, please give a few details here as we might be able to improve this. When bootstd was first introduced we had very tight code-size constraints, so quite a few features are only provided if BOOTSTD_FULL is enabled. Tom has suggested enabling more features in the base implementation but we haven't really figured out which.

The problem is when a board already has enabled BOOTSTD_FULL or has been updated with Distro Boot (CONFIG_DISTRO_DEFAULTS), all the necessary configurations such as ext2, ext4, efi partition,... are implied, therefore were removed from board defconfig. They must be added back.

I actually tried this just now and it does work booting a script from USB drive with this combination:

Quoted 8 lines

CONFIG_BOOTMETH_SCRIPT=y
CONFIG_DISTRO_DEFAULTS=y (this also selects CMD_PXE, but it's OK
for this test)
# CONFIG_BOOTSTD_FULL is not set

I think it's quite cumbersome to add each of the necessary configs back to the board defconfig. Not as easy as removing CMD_PXE, or other CMD_x to remove a capability.

There's two parts to this. In turns of changing the defconfig to start with, you shouldn't need to "add back", if you do:

$ make foo_defconfig
$ make menuconfig # Disable full, etc
$ make savedefconfig
$ cp defconfig configs/foo_defconfig

But the second part is that yes, it's at least currently intentional to be cumbersome to break the "all stock distributions work in all expected use cases" option. If you have networking, networking works in U-Boot, but you're not allowing users to install distros over the network like they should be able to expect to, it shouldn't be easy.

I am open to splitting the current option up in to multiple parts, along the lines of legacy options, modern options, disk options, network options since as Peter noted earlier in this thread, PXE is going away in favour of HTTP(s) boot. But we still have lots of legacy boards and distros to support.

Signature · 1 line
Tom
author
#14 lore raw

Hi Tom,

Quoted 112 lines · Tom Rini
Quoted 101 lines · Tony Dinh

Hi Simon,

Quoted 41 lines · Simon Glass

Hi Tony,

Quoted 37 lines · Tony Dinh
Quoted 35 lines · Tom Rini
Quoted 33 lines · Peter Robinson
Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

If you only want scripts, then perhaps you can enable just what you need, e.g. BOOTMETH_SCRIPT? You may need to disable BOOT_DEFAULTS and choose your own options.

Indeed, that was a missing config when I tried with BOOTSTD_FULL disabled. But there is more, please see below.

Quoted 29 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Quoted 7 lines
Quoted 7 lines

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

Glad to hear :)

Quoted 6 lines

And in the world where we also can't just remove ATAGS support because distros (Debian at least) still boots some modern platforms via ATAGS + appended device tree, the high level options for "boot this anywhere" need to perhaps be different from "very modern requirements only distro". I'm not objecting to be clear.

Quoted 5 lines

As Tom suggested previously, perhaps looking from a different angle. We can disable BOOTSTD_FULL and then try adding only options that are needed for a board. Unfortunately this approach did not work when I tried it in the past. It seems for bootstd to work well, we need to take the whole thing by enabling BOOTSTD_FULL.

Quoted 6 lines

If you end up trying it again, please give a few details here as we might be able to improve this. When bootstd was first introduced we had very tight code-size constraints, so quite a few features are only provided if BOOTSTD_FULL is enabled. Tom has suggested enabling more features in the base implementation but we haven't really figured out which.

The problem is when a board already has enabled BOOTSTD_FULL or has been updated with Distro Boot (CONFIG_DISTRO_DEFAULTS), all the necessary configurations such as ext2, ext4, efi partition,... are implied, therefore were removed from board defconfig. They must be added back.

I actually tried this just now and it does work booting a script from USB drive with this combination:

Quoted 8 lines

CONFIG_BOOTMETH_SCRIPT=y
CONFIG_DISTRO_DEFAULTS=y (this also selects CMD_PXE, but it's OK
for this test)
# CONFIG_BOOTSTD_FULL is not set

I think it's quite cumbersome to add each of the necessary configs back to the board defconfig. Not as easy as removing CMD_PXE, or other CMD_x to remove a capability.

Quoted 6 lines

There's two parts to this. In turns of changing the defconfig to start with, you shouldn't need to "add back", if you do:

$ make foo_defconfig
$ make menuconfig # Disable full, etc
$ make savedefconfig
$ cp defconfig configs/foo_defconfig

Of course you're right! "make menuconfig" works as described above.

Thanks,
Tony

Quoted 15 lines

But the second part is that yes, it's at least currently intentional to be cumbersome to break the "all stock distributions work in all expected use cases" option. If you have networking, networking works in U-Boot, but you're not allowing users to install distros over the network like they should be able to expect to, it shouldn't be easy.

I am open to splitting the current option up in to multiple parts, along the lines of legacy options, modern options, disk options, network options since as Peter noted earlier in this thread, PXE is going away in favour of HTTP(s) boot. But we still have lots of legacy boards and distros to support.

--
Tom

author
#15 lore raw

Hi all,

Quoted 123 lines · Tony Dinh

Hi Tom,

Quoted 112 lines · Tom Rini
Quoted 101 lines · Tony Dinh

Hi Simon,

Quoted 41 lines · Simon Glass

Hi Tony,

Quoted 37 lines · Tony Dinh
Quoted 35 lines · Tom Rini
Quoted 33 lines · Peter Robinson
Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

If you only want scripts, then perhaps you can enable just what you need, e.g. BOOTMETH_SCRIPT? You may need to disable BOOT_DEFAULTS and choose your own options.

Indeed, that was a missing config when I tried with BOOTSTD_FULL disabled. But there is more, please see below.

Quoted 29 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Quoted 7 lines
Quoted 7 lines

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

Glad to hear :)

Quoted 6 lines

And in the world where we also can't just remove ATAGS support because distros (Debian at least) still boots some modern platforms via ATAGS + appended device tree, the high level options for "boot this anywhere" need to perhaps be different from "very modern requirements only distro". I'm not objecting to be clear.

Quoted 5 lines

As Tom suggested previously, perhaps looking from a different angle. We can disable BOOTSTD_FULL and then try adding only options that are needed for a board. Unfortunately this approach did not work when I tried it in the past. It seems for bootstd to work well, we need to take the whole thing by enabling BOOTSTD_FULL.

Quoted 6 lines

If you end up trying it again, please give a few details here as we might be able to improve this. When bootstd was first introduced we had very tight code-size constraints, so quite a few features are only provided if BOOTSTD_FULL is enabled. Tom has suggested enabling more features in the base implementation but we haven't really figured out which.

The problem is when a board already has enabled BOOTSTD_FULL or has been updated with Distro Boot (CONFIG_DISTRO_DEFAULTS), all the necessary configurations such as ext2, ext4, efi partition,... are implied, therefore were removed from board defconfig. They must be added back.

I actually tried this just now and it does work booting a script from USB drive with this combination:

Quoted 8 lines

CONFIG_BOOTMETH_SCRIPT=y
CONFIG_DISTRO_DEFAULTS=y (this also selects CMD_PXE, but it's OK
for this test)
# CONFIG_BOOTSTD_FULL is not set

I think it's quite cumbersome to add each of the necessary configs back to the board defconfig. Not as easy as removing CMD_PXE, or other CMD_x to remove a capability.

Quoted 6 lines

There's two parts to this. In turns of changing the defconfig to start with, you shouldn't need to "add back", if you do:

$ make foo_defconfig
$ make menuconfig # Disable full, etc
$ make savedefconfig
$ cp defconfig configs/foo_defconfig
Quoted 18 lines

Of course you're right! "make menuconfig" works as described above.

Thanks,
Tony

Quoted 13 lines

But the second part is that yes, it's at least currently intentional to be cumbersome to break the "all stock distributions work in all expected use cases" option. If you have networking, networking works in U-Boot, but you're not allowing users to install distros over the network like they should be able to expect to, it shouldn't be easy.

I am open to splitting the current option up in to multiple parts, along the lines of legacy options, modern options, disk options, network options since as Peter noted earlier in this thread, PXE is going away in favour of HTTP(s) boot. But we still have lots of legacy boards and distros to support.

I'm withdrawing this patch.

Using the Kconfig approach Tom and Simon have suggested, I was able to remove PXE and include only the BOOTMETH_SCRIPT for block devices in bootstd. My test case using the pogo_v4 board showed a saving of 17K (before: 508K, after 491K).

IMHO, we should still pursue the worthy goal of "splitting the current options up into multiple parts". That will make u-boot configuration much more robust.

For posterity, here is the Kconfig test using board/cloudengines/pogo_v4.

configs/pogo_v4_defconfig +20 -1
index 1c0e0de8d4f..aaaa3fd51f2 100644
@@ -17,15 +17,23 @@ CONFIG_SYS_LOAD_ADDR=0x800000
 CONFIG_IDENT_STRING="\nPogoplug V4"
 CONFIG_PCI=y
 CONFIG_LTO=y
-CONFIG_BOOTSTD_FULL=y
+CONFIG_ENV_VARS_UBOOT_CONFIG=y
+CONFIG_BOOTMETH_SCRIPT=y
+CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOOTSTAGE=y
 CONFIG_SHOW_BOOT_PROGRESS=y
 CONFIG_BOOTDELAY=10
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="bootflow scan"
 CONFIG_USE_PREBOOT=y
 CONFIG_SYS_PBSIZE=1050
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SYS_PROMPT="Pogo_V4> "
 CONFIG_SYS_MAXARGS=32
+CONFIG_CMD_BOOTDEV=y
+CONFIG_CMD_BOOTMETH=y
+CONFIG_CMD_BOOTSTD=y
+CONFIG_CMD_BOOTZ=y
 # CONFIG_BOOTM_PLAN9 is not set
 # CONFIG_BOOTM_RTEMS is not set
 # CONFIG_BOOTM_VXWORKS is not set
@@ -35,16 +43,26 @@ CONFIG_SYS_MAXARGS=32
 CONFIG_CMD_MMC=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_SATA=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_DHCP=y
 CONFIG_CMD_DNS=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 CONFIG_CMD_SNTP=y
 # CONFIG_CMD_BLOCK_CACHE is not set
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)"
 CONFIG_CMD_UBI=y
+CONFIG_ISO_PARTITION=y
+CONFIG_EFI_PARTITION=y
 CONFIG_PARTITION_TYPE_GUID=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
@@ -72,4 +90,5 @@ CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_PCI=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_STORAGE=y
 CONFIG_UBIFS_SILENCE_MSG=y

All the best,
Tony

author
#16 lore raw
Quoted 139 lines · Tony Dinh

Hi all,

Quoted 135 lines · Tony Dinh

Hi Tom,

Quoted 112 lines · Tom Rini
Quoted 101 lines · Tony Dinh

Hi Simon,

Quoted 41 lines · Simon Glass

Hi Tony,

Quoted 37 lines · Tony Dinh
Quoted 35 lines · Tom Rini
Quoted 33 lines · Peter Robinson
Quoted 32 lines · Tom Rini
Quoted 8 lines · Tony Dinh

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.

Quoted 6 lines

---

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

Is some part of the symbol logic here wrong? A challenge is that "PXE" is also where the logic to parse extlinux.conf style files came from, and I thought we had split those two out. And then there's this:

Quoted 10 lines
boot/Kconfig +0 -1
index 2993cd7f9ba..403ce4c3d46 100644
@@ -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
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

boot/Kconfig config BOOT_DEFAULTS_CMDS · line 427

Quoted 4 lines
boot/Kconfig +1 -0
      select CMD_BOOTI if ARM64
      select CMD_BOOTZ if ARM && !ARM64
      imply CMD_MII if NET
+     imply CMD_PXE if CMD_NET

If you only want scripts, then perhaps you can enable just what you need, e.g. BOOTMETH_SCRIPT? You may need to disable BOOT_DEFAULTS and choose your own options.

Indeed, that was a missing config when I tried with BOOTSTD_FULL disabled. But there is more, please see below.

Quoted 29 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

This is one of the things where defaults isn't supposed to be so easy to get out of. How many platforms are you wanting to then disable CMD_PXE on to save space?

Quoted 7 lines
Quoted 7 lines

PXE is generally being removed in a lot of cases as it's not considered secure and now we have HTTP Boot there are other means of doing network booting so I think we'll see more and more situations where we want to disable PXE.

This is actually something I've been meaning to look at so it's something I would love to see :)

Glad to hear :)

Quoted 6 lines

And in the world where we also can't just remove ATAGS support because distros (Debian at least) still boots some modern platforms via ATAGS + appended device tree, the high level options for "boot this anywhere" need to perhaps be different from "very modern requirements only distro". I'm not objecting to be clear.

Quoted 5 lines

As Tom suggested previously, perhaps looking from a different angle. We can disable BOOTSTD_FULL and then try adding only options that are needed for a board. Unfortunately this approach did not work when I tried it in the past. It seems for bootstd to work well, we need to take the whole thing by enabling BOOTSTD_FULL.

Quoted 6 lines

If you end up trying it again, please give a few details here as we might be able to improve this. When bootstd was first introduced we had very tight code-size constraints, so quite a few features are only provided if BOOTSTD_FULL is enabled. Tom has suggested enabling more features in the base implementation but we haven't really figured out which.

The problem is when a board already has enabled BOOTSTD_FULL or has been updated with Distro Boot (CONFIG_DISTRO_DEFAULTS), all the necessary configurations such as ext2, ext4, efi partition,... are implied, therefore were removed from board defconfig. They must be added back.

I actually tried this just now and it does work booting a script from USB drive with this combination:

Quoted 8 lines

CONFIG_BOOTMETH_SCRIPT=y
CONFIG_DISTRO_DEFAULTS=y (this also selects CMD_PXE, but it's OK
for this test)
# CONFIG_BOOTSTD_FULL is not set

I think it's quite cumbersome to add each of the necessary configs back to the board defconfig. Not as easy as removing CMD_PXE, or other CMD_x to remove a capability.

Quoted 6 lines

There's two parts to this. In turns of changing the defconfig to start with, you shouldn't need to "add back", if you do:

$ make foo_defconfig
$ make menuconfig # Disable full, etc
$ make savedefconfig
$ cp defconfig configs/foo_defconfig

Of course you're right! "make menuconfig" works as described above.

Thanks,
Tony

Quoted 7 lines

But the second part is that yes, it's at least currently intentional to be cumbersome to break the "all stock distributions work in all expected use cases" option. If you have networking, networking works in U-Boot, but you're not allowing users to install distros over the network like they should be able to expect to, it shouldn't be easy.

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

I am open to splitting the current option up in to multiple parts, along the lines of legacy options, modern options, disk options, network options since as Peter noted earlier in this thread, PXE is going away in favour of HTTP(s) boot. But we still have lots of legacy boards and distros to support.

I'm withdrawing this patch.

Sorry for forgetting to mention, I will send in a new patch to deal with pxe_utils.

All the best,
Tony

Quoted 76 lines

Using the Kconfig approach Tom and Simon have suggested, I was able to remove PXE and include only the BOOTMETH_SCRIPT for block devices in bootstd. My test case using the pogo_v4 board showed a saving of 17K (before: 508K, after 491K).

IMHO, we should still pursue the worthy goal of "splitting the current options up into multiple parts". That will make u-boot configuration much more robust.

For posterity, here is the Kconfig test using board/cloudengines/pogo_v4.

configs/pogo_v4_defconfig +20 -1
index 1c0e0de8d4f..aaaa3fd51f2 100644
@@ -17,15 +17,23 @@ CONFIG_SYS_LOAD_ADDR=0x800000
 CONFIG_IDENT_STRING="\nPogoplug V4"
 CONFIG_PCI=y
 CONFIG_LTO=y
-CONFIG_BOOTSTD_FULL=y
+CONFIG_ENV_VARS_UBOOT_CONFIG=y
+CONFIG_BOOTMETH_SCRIPT=y
+CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOOTSTAGE=y
 CONFIG_SHOW_BOOT_PROGRESS=y
 CONFIG_BOOTDELAY=10
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="bootflow scan"
 CONFIG_USE_PREBOOT=y
 CONFIG_SYS_PBSIZE=1050
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SYS_PROMPT="Pogo_V4> "
 CONFIG_SYS_MAXARGS=32
+CONFIG_CMD_BOOTDEV=y
+CONFIG_CMD_BOOTMETH=y
+CONFIG_CMD_BOOTSTD=y
+CONFIG_CMD_BOOTZ=y
 # CONFIG_BOOTM_PLAN9 is not set
 # CONFIG_BOOTM_RTEMS is not set
 # CONFIG_BOOTM_VXWORKS is not set
@@ -35,16 +43,26 @@ CONFIG_SYS_MAXARGS=32
 CONFIG_CMD_MMC=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_NAND=y
+CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_SATA=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_DHCP=y
 CONFIG_CMD_DNS=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
 CONFIG_CMD_SNTP=y
 # CONFIG_CMD_BLOCK_CACHE is not set
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)"
 CONFIG_CMD_UBI=y
+CONFIG_ISO_PARTITION=y
+CONFIG_EFI_PARTITION=y
 CONFIG_PARTITION_TYPE_GUID=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
@@ -72,4 +90,5 @@ CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_PCI=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_STORAGE=y
 CONFIG_UBIFS_SILENCE_MSG=y

All the best,
Tony