diff mbox series

[v2,04/27] bootstd: Correct dependencies on CMDLINE

Message ID 20231007231255.277623-5-sjg@chromium.org
State Changes Requested
Delegated to: Tom Rini
Headers show
Series Tidy up use of CONFIG_CMDLINE | expand

Commit Message

Simon Glass Oct. 7, 2023, 11:12 p.m. UTC
With recent changes in boot/Kconfig it is no-longer possible to disable
CMDLINE. It results in various link errors because some options which
require CMDLINE are enabled regardless of whether it is available.

Add the necessary conditions to fix this.

Note that it would be better to have all commands depend on CMDLINE,
but that is extremely difficult at present, since some functions use
CMD_xxx to enable feature xxx. For example networking and environment
have a number of problems to tease apart.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 boot/Kconfig           | 19 ++++++++++++-------
 lib/efi_loader/Kconfig |  1 +
 2 files changed, 13 insertions(+), 7 deletions(-)

Comments

Tom Rini Oct. 7, 2023, 11:32 p.m. UTC | #1
On Sat, Oct 07, 2023 at 05:12:23PM -0600, Simon Glass wrote:

> With recent changes in boot/Kconfig it is no-longer possible to disable
> CMDLINE. It results in various link errors because some options which
> require CMDLINE are enabled regardless of whether it is available.

How "recent" is this problem?
Simon Glass Oct. 7, 2023, 11:45 p.m. UTC | #2
Hi Tom,

On Sat, 7 Oct 2023 at 17:32, Tom Rini <trini@konsulko.com> wrote:
>
> On Sat, Oct 07, 2023 at 05:12:23PM -0600, Simon Glass wrote:
>
> > With recent changes in boot/Kconfig it is no-longer possible to disable
> > CMDLINE. It results in various link errors because some options which
> > require CMDLINE are enabled regardless of whether it is available.
>
> How "recent" is this problem?

Over the last few years, I think. It was definitely in better shape
3-4 years ago.

I just realised that I sent your patches as part of my series, sorry.

Regards,
Simon
Tom Rini Oct. 9, 2023, 2:36 p.m. UTC | #3
On Sat, Oct 07, 2023 at 05:45:17PM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Sat, 7 Oct 2023 at 17:32, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Sat, Oct 07, 2023 at 05:12:23PM -0600, Simon Glass wrote:
> >
> > > With recent changes in boot/Kconfig it is no-longer possible to disable
> > > CMDLINE. It results in various link errors because some options which
> > > require CMDLINE are enabled regardless of whether it is available.
> >
> > How "recent" is this problem?
> 
> Over the last few years, I think. It was definitely in better shape
> 3-4 years ago.

OK, that makes a little more sense.  But still, this is the wrong
approach I think.  I've got a little more specific feedback against v2,
but I want to see things get unwound from CMDLINE that aren't
specifically commands as they're things those other use cases you've
described will also need to enable.
diff mbox series

Patch

diff --git a/boot/Kconfig b/boot/Kconfig
index a01e6cb8aafe..f74ac7e9cc72 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -342,6 +342,7 @@  endif # FIT
 
 config PXE_UTILS
 	bool
+	depends on CMDLINE
 	select MENU
 	help
 	  Utilities for parsing PXE file formats.
@@ -357,7 +358,7 @@  config BOOT_DEFAULTS
 	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_PXE if CMDLINE && CMD_NET
 	select SUPPORT_RAW_INITRD
 	select ENV_VARS_UBOOT_CONFIG
 	select CMD_BOOTI if ARM64
@@ -461,6 +462,7 @@  config BOOTMETH_GLOBAL
 
 config BOOTMETH_CROS
 	bool "Bootdev support for Chromium OS"
+	depends on CMDLINE
 	depends on X86 || ARM || SANDBOX
 	default y if !ARM
 	select EFI_PARTITION
@@ -475,6 +477,7 @@  config BOOTMETH_CROS
 
 config BOOTMETH_EXTLINUX
 	bool "Bootdev support for extlinux boot"
+	depends on CMDLINE
 	select PXE_UTILS
 	default y
 	help
@@ -490,7 +493,7 @@  config BOOTMETH_EXTLINUX
 
 config BOOTMETH_EXTLINUX_PXE
 	bool "Bootdev support for extlinux boot over network"
-	depends on CMD_PXE && CMD_NET && DM_ETH
+	depends on CMDLINE && CMD_PXE && CMD_NET && DM_ETH
 	default y
 	help
 	  Enables support for extlinux boot using bootdevs. This makes the
@@ -504,7 +507,7 @@  config BOOTMETH_EXTLINUX_PXE
 
 config BOOTMETH_EFILOADER
 	bool "Bootdev support for EFI boot"
-	depends on EFI_LOADER
+	depends on EFI_LOADER && CMDLINE
 	default y
 	help
 	  Enables support for EFI boot using bootdevs. This makes the
@@ -536,10 +539,10 @@  config BOOTMETH_VBE
 
 config BOOTMETH_DISTRO
 	bool  # Options needed to boot any distro
-	select BOOTMETH_SCRIPT  # E.g. Armbian uses scripts
-	select BOOTMETH_EXTLINUX  # E.g. Debian uses these
-	select BOOTMETH_EXTLINUX_PXE if CMD_PXE && CMD_NET && DM_ETH
-	select BOOTMETH_EFILOADER if EFI_LOADER # E.g. Ubuntu uses this
+	select BOOTMETH_SCRIPT if CMDLINE # E.g. Armbian uses scripts
+	select BOOTMETH_EXTLINUX if CMDLINE # E.g. Debian uses these
+	select BOOTMETH_EXTLINUX_PXE if CMDLINE && CMD_PXE && CMD_NET && DM_ETH
+	select BOOTMETH_EFILOADER if CMDLINE && EFI_LOADER # E.g. Ubuntu uses this
 
 config SPL_BOOTMETH_VBE
 	bool "Bootdev support for Verified Boot for Embedded (SPL)"
@@ -663,6 +666,7 @@  config BOOTMETH_SANDBOX
 
 config BOOTMETH_SCRIPT
 	bool "Bootdev support for U-Boot scripts"
+	depends on CMDLINE
 	default y if BOOTSTD_FULL
 	select HUSH_PARSER
 	help
@@ -777,6 +781,7 @@  endmenu		# Boot images
 
 config DISTRO_DEFAULTS
 	bool "(deprecated) Script-based booting of Linux distributions"
+	depends on CMDLINE
 	select BOOT_DEFAULTS
 	select AUTO_COMPLETE
 	select CMDLINE_EDITING
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index d20aaab6dba4..621ed5e5b0fb 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -34,6 +34,7 @@  if EFI_LOADER
 
 config CMD_BOOTEFI_BOOTMGR
 	bool "UEFI Boot Manager"
+	depends on CMDLINE
 	default y
 	select BOOTMETH_GLOBAL if BOOTSTD
 	help