[U-Boot] [PATCH 0/14] Split out code from the enormous main.c
Simon Glass
sjg at chromium.org
Fri Apr 11 04:01:22 CEST 2014
A previous series created a way of using if () instead of #ifdef for
controlling feature inclusion in U-Boot. The primary target of that series
was common/main.c which is full of #ifdefs. That work was put on hold while
the kbuild work was in progress.
Since kbuild is now complete, it is time to take another look. However, in
the meantime main.c has not improved. It seems like a good idea to try to
split the code out a bit, to make it more obvious what is happening in the
U-Boot start-up.
This series splits main into two main program and a CLI (Command-line
interpreter) parts. There are two CLIs - hush and simple, and each is put
in its own file, with a new cli.c to unify them.
New files are also created for autoboot and bootretry functionality.
Overall this series makes it easier to read what is happening in main.c,
and also clarifies the parser code.
Simon Glass (14):
Remove unnecessary use of hush header file
Rename hush to cli_hush
move CLI prototypes to cli.h and add comments
Split out simple parser and readline into separate files
Add cli_ prefix to readline functions
Move autoboot code to autoboot.c
Move command line API into cli.c
Move bootretry code into bootretry.c and clean up
Rename bootretry functions and remove #ifdefs
m68k: powerpc: Clean up do_mdm_init
Simplify the main loop
main: Hide the hush/simple details inside cli.c
main: Make the execution path a little clearer in main.c
main: Avoid unncessary strdup()/free()
arch/arm/cpu/arm926ejs/kirkwood/cpu.c | 1 -
arch/arm/cpu/arm926ejs/orion5x/cpu.c | 1 -
arch/m68k/lib/board.c | 7 -
arch/powerpc/lib/board.c | 8 -
board/ait/cam_enc_4xx/cam_enc_4xx.c | 4 +-
board/amcc/yucca/cmd_yucca.c | 21 +-
board/eltec/elppc/misc.c | 15 +-
board/eltec/mhpc/mhpc.c | 13 +-
board/hymod/hymod.c | 8 +-
board/hymod/input.c | 14 +-
board/keymile/common/common.c | 2 +-
board/keymile/common/ivm.c | 2 +-
board/mcc200/auto_update.c | 7 +-
common/Makefile | 20 +-
common/autoboot.c | 303 +++++++
common/board_r.c | 14 -
common/bootretry.c | 59 ++
common/cli.c | 194 +++++
common/{hush.c => cli_hush.c} | 17 +-
common/cli_readline.c | 621 ++++++++++++++
common/cli_simple.c | 337 ++++++++
common/cmd_bedbug.c | 29 +-
common/cmd_bootm.c | 4 -
common/cmd_bootmenu.c | 1 -
common/cmd_dcr.c | 3 +-
common/cmd_i2c.c | 17 +-
common/cmd_mem.c | 17 +-
common/cmd_nvedit.c | 5 +-
common/cmd_pci.c | 13 +-
common/main.c | 1527 +--------------------------------
common/menu.c | 6 +-
drivers/ddr/fsl/interactive.c | 8 +-
include/autoboot.h | 47 +
include/bootretry.h | 59 ++
include/cli.h | 149 ++++
include/{hush.h => cli_hush.h} | 4 +-
include/common.h | 7 +-
37 files changed, 1917 insertions(+), 1647 deletions(-)
create mode 100644 common/autoboot.c
create mode 100644 common/bootretry.c
create mode 100644 common/cli.c
rename common/{hush.c => cli_hush.c} (99%)
create mode 100644 common/cli_readline.c
create mode 100644 common/cli_simple.c
create mode 100644 include/autoboot.h
create mode 100644 include/bootretry.h
create mode 100644 include/cli.h
rename include/{hush.h => cli_hush.h} (93%)
--
1.9.1.423.g4596e3a
More information about the U-Boot
mailing list