[U-Boot] [PATCH v3 0/22] Improvements to memory, hashing functions for sandbox

Simon Glass sjg at chromium.org
Mon Feb 25 04:33:10 CET 2013


This series aims to get all the memory functions running correctly
on sandbox.

There was some discussion about this a while ago, and a commit was
added to show a possible approach:

355a8357 sandbox: Change md command to use map_physmem

This commit was subsequently reverted because it used map_physmem()
instead of the NOP that most architectures need for the memory functions.

This series introduces map_sysmem(), a NOP on all architectures
except sandbox. It allows us to use a ram buffer to which all U-Boot
addresses are relative. The memory commands (including hashing) are
updated to use this so that sandbox can now use those commands.

Half of the mtest code is behind #ifdefs and there is duplication of
some functions in both versions of the memory test. Several patches
here clean this up a bit and get it working on sandbox.

The numeric setenv_ulong() function is a useful way of avoiding a
'char buf[17]; sprintf(buf, "%ld", ...); setenv("...", buf)' sequence.
There is also setenv_addr(). What is missing is setenv_hex() which sets
a ulong in hex format. Add this function and then make use of it in the
main places: common/ drivers/ and net/.

The recently added and very basic hash instructure can help reduce
code duplication in some cases. The crc32 command is redone to use this,
and crc32 is now available through the 'hash' command. Also a few bugs were
found in hashing with verify disabled - the arg count was not checked and
a variable declaration was missing.

To permit the memory tester to run on sandbox, we need ctrl-C to work.
To achieve this, add a proper implementation of sandbox's tstc(), with a
simple FIFO for character input. An os_usleep() is added to ensure that
U-Boot does not consume infinite CPU when setting at the command prompt.

Changes in v3:
- Rebase mtest indent patch on top of mainline to resolve conflicts
- Use spaces instead of tabs for indent in cmd_fdoc.c
- Change incorrect commit title from drivers: to fs:
- Fix 'it ia' typo
- Fix 'bahviour' typo
- Make sha1 code dependent on CONFIG_CMD_SHA1, for code size reasons

Changes in v2:
- Add new patch to control saving hashes in the environment
- Rewrite crc32 support in hash to improve code size
- Rebase on top of earlier patches

Simon Glass (21):
  Tidy up error checking and fix bug in hash command
  Update print_buffer() to use const
  sandbox: Add un/map_sysmen() to deal with sandbox's ram_buf
  sandbox: Change memory commands to use map_physmem
  Split out the memory tests into separate functions
  Use common mtest iteration counting
  Fix mtest indenting
  Bring mtest putc() into common code
  Reduce casting in mtest
  Update set_working_fdt_addr() to use setenv_addr()
  common: Use new numeric setenv functions
  fs: Use new numeric setenv functions
  net: Use new numeric setenv functions
  image: Use crc header file instead of C prototypes
  hash: Add a flag to support saving hashes in the environment
  Roll crc32 into hash infrastructure
  sandbox: config: Enable hash functions and mtest
  Move CONFIG_SYS_MEMTEST_SCRATCH #ifdef to top of file
  sandbox: Update mtest to fix crashes
  sandbox: Allow hash functions to work correctly
  hash: Use lower case for hash algorithm names

Taylor Hutt (1):
  sandbox: Improve sandbox serial port keyboard interface

 README                        |   9 +
 arch/sandbox/config.mk        |   1 +
 arch/sandbox/cpu/os.c         |   8 +
 arch/sandbox/include/asm/io.h |  10 +
 common/cmd_bootm.c            |  11 +-
 common/cmd_cbfs.c             |   4 +-
 common/cmd_cramfs.c           |   4 +-
 common/cmd_fdos.c             |   4 +-
 common/cmd_fdt.c              |  11 +-
 common/cmd_hash.c             |  14 +-
 common/cmd_jffs2.c            |   4 +-
 common/cmd_load.c             |  12 +-
 common/cmd_mem.c              | 798 +++++++++++++++++++++---------------------
 common/cmd_mtdparts.c         |   4 +-
 common/cmd_nand.c             |  12 +-
 common/cmd_nvedit.c           |  11 +-
 common/cmd_reiser.c           |   4 +-
 common/cmd_setexpr.c          |  39 ++-
 common/cmd_sha1sum.c          |   6 +-
 common/cmd_unzip.c            |   4 +-
 common/cmd_ximg.c             |   7 +-
 common/cmd_zfs.c              |   3 +-
 common/cmd_zip.c              |   4 +-
 common/hash.c                 | 194 +++++++---
 common/image.c                |   4 +-
 drivers/net/fm/fm.c           |   4 +-
 drivers/serial/sandbox.c      |  44 ++-
 fs/fs.c                       |   4 +-
 fs/ubifs/ubifs.c              |   4 +-
 include/common.h              |  29 +-
 include/configs/sandbox.h     |   9 +-
 include/hash.h                |  13 +-
 include/os.h                  |  10 +
 include/u-boot/crc.h          |  11 +
 lib/crc32.c                   |   9 +
 lib/display_options.c         |   3 +-
 net/net.c                     |   8 +-
 37 files changed, 747 insertions(+), 583 deletions(-)

-- 
1.8.1.3



More information about the U-Boot mailing list