[U-Boot] [PATCH v2 0/9] Add CONFIG_CMDLINE to allow removal of all commands

Simon Glass sjg at chromium.org
Mon Mar 14 02:07:26 CET 2016


A large chunk of the U-Boot code is its wide variety of commands. For some
applications this is not needed, since the boot can be controlled by a
board-specific hard-coded boot procedure.

Any attempt to use commands, such as running script, will result in an
error. U-Boot acts as if it supports commands in general, but there are no
actual commands to run.

This saves a significant amount of space.

For example on snow this saves 300KB of code space, with the code size
dropping from 505KB to 202KB. BSS drops from 238KB to 4KB. The size of
u-boot.bin (which includes the device tree) drops from 541KB to 228KB.

If LCD and USB support is disabled on this platform, code size drops to
139KB.

This makes U-Boot proper look a little more like SPL in terms of size.

The CONFIG_CMDLINE setting is enabled by default, but can be disabled by
boards as needed.

Note: I hopefully have addressed the comments on v1. I've run the series
through buildman to check for bisectability.

Changes in v2:
- Move the board_run_command() prototype into this patch
- Use panic() instead of hang()

Simon Glass (9):
  cbfs: Update a function to be static
  Add an option to enable the command line
  arm: x86: Drop command-line code when CONFIG_CMDLINE is disabled
  sandbox: Avoid calling commands when not available
  Drop command-processing code when CONFIG_CMDLINE is disabled
  Panic when no command line processing can be performed
  Allow command code to compile to nothing
  Allow command-line files to be dropped
  Drop various features when the command line is not available

 README                     |  8 ++++++++
 arch/arm/cpu/u-boot.lds    |  3 +++
 arch/sandbox/cpu/start.c   | 10 +++++++++-
 arch/x86/cpu/u-boot.lds    |  4 ++++
 cmd/Kconfig                | 12 ++++++++++++
 cmd/cbfs.c                 | 12 ++++++++----
 cmd/help.c                 |  4 ++++
 common/Makefile            |  4 ++--
 common/cli.c               | 17 +++++++++++++++-
 common/command.c           |  6 ++++++
 common/main.c              |  1 +
 include/command.h          | 49 ++++++++++++++++++++++++++++++++++++++++++----
 include/config_fallbacks.h | 10 ++++++++++
 13 files changed, 128 insertions(+), 12 deletions(-)

-- 
2.7.0.rc3.207.g0ac5344



More information about the U-Boot mailing list