1. 13 5月, 2011 2 次提交
  2. 01 5月, 2011 1 次提交
    • M
      zlib: split up to match original source tree · e89516f0
      Mike Frysinger 提交于
      While looking to upgrade to zlib-1.2.5, the current mondo merge of
      multiple files into a single was making things way more difficult
      than it should have been.  Hard to pick out what has been changed
      to port it to U-Boot, been removed as useless, and bug fixes added
      after the fact.
      
      So split the single file up into the original file names, and merge
      non-essential changes back from the original tree (for some reason,
      style in code in a bunch of places was changed to U-Boot style even
      though this isn't "U-Boot" code).
      
      The original build style is retained -- we have a single zlib.c that
      includes all the other files, and that is the only file we compile.
      Signed-off-by: NMike Frysinger <vapier@gentoo.org>
      e89516f0
  3. 28 4月, 2011 2 次提交
    • K
      common: add a grepenv command · a000b795
      Kim Phillips 提交于
      u-boot environments, esp. when boards are shared across multiple
      users, can get pretty large and time consuming to visually parse.
      The grepenv command this patch adds can be used in lieu of printenv
      to facilitate searching.  grepenv works like printenv but limits
      its output only to environment strings (variable name and value
      pairs) that match the user specified substring.
      
      the following examples are on a board with a 5313 byte environment
      that spans multiple screen pages:
      
      Example 1:  summarize ethernet configuration:
      
      => grepenv eth TSEC
      etact=FM1@DTSEC2
      eth=FM1@DTSEC4
      ethact=FM1@DTSEC2
      eth1addr=00:E0:0C:00:8b:01
      eth2addr=00:E0:0C:00:8b:02
      eth3addr=00:E0:0C:00:8b:03
      eth4addr=00:E0:0C:00:8b:04
      eth5addr=00:E0:0C:00:8b:05
      eth6addr=00:E0:0C:00:8b:06
      eth7addr=00:E0:0C:00:8b:07
      eth8addr=00:E0:0C:00:8b:08
      eth9addr=00:E0:0C:00:8b:09
      ethaddr=00:E0:0C:00:8b:00
      netdev=eth0
      uprcw=setenv ethact $eth;setenv filename p4080ds/R_PPSXX_0xe/rcw_0xe_2sgmii_rev2_high.bin;setenv start 0xe8000000;protect off all;run upimage;protect on all
      upuboot=setenv ethact $eth;setenv filename u-boot.bin;setenv start eff80000;protect off all;run upimage;protect on all
      upucode=setenv ethact $eth;setenv filename fsl_fman_ucode_P4080_101_6.bin;setenv start 0xef000000;protect off all;run upimage;protect on all
      usdboot=setenv ethact $eth;tftp 1000000 $dir/$bootfile;tftp 2000000 $dir/initramfs.cpio.gz.uboot;tftp c00000 $dir/p4080ds-usdpaa.dtb;setenv bootargs root=/dev/ram rw console=ttyS0,115200 $othbootargs;bootm 1000000 2000000 c00000;
      =>
      
      Example 2: detect unused env vars:
      
      => grepenv etact
      etact=FM1@DTSEC2
      =>
      
      Example 3: reveal hardcoded variables; e.g., for fdtaddr:
      
      => grepenv fdtaddr
      fdtaddr=c00000
      nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off console=$consoledev,$baudrate $othbootargs;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr
      ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtaddr
      => grep $fdtaddr
      fdtaddr=c00000
      my_boot=bootm 0x40000000 0x41000000 0x00c00000
      my_dtb=tftp 0x00c00000 $prefix/p4080ds.dtb
      nohvboot=tftp 1000000 $dir/$bootfile;tftp 2000000 $dir/$ramdiskfile;tftp c00000 $dir/$fdtfile;setenv bootargs root=/dev/ram rw ramdisk_size=0x10000000 console=ttyS0,115200;bootm 1000000 2000000 c00000;
      =>
      
      This patch also enables the grepenv command by default on
      corenet_ds based boards (and repositions the DHCP command
      entry to keep the list sorted).
      Signed-off-by: NKim Phillips <kim.phillips@freescale.com>
      Cc: Kumar Gala <kumar.gala@freescale.com>
      Cc: Andy Fleming <afleming@freescale.com>
      a000b795
    • K
      env: fix env var autocompletion · af4d9074
      Kim Phillips 提交于
      commit 560d424b "env: re-add
      support for auto-completion" fell short of its description -
      the 'used' logic in hmatch_r was reversed - 'used' is 0 if
      the hash table entry is not used, or -1 if deleted.  This
      patch makes hmatch_r actually match on valid ('used') entries,
      instead of skipping them and failing to match anything.
      
      typing 'printenv tft' and hitting 'tab' now displays valid
      choices for variable names.
      Signed-off-by: NKim Phillips <kim.phillips@freescale.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Tested-by: NMike Frysinger <vapier@gentoo.org>
      af4d9074
  4. 13 4月, 2011 1 次提交
  5. 23 3月, 2011 2 次提交
  6. 19 1月, 2011 1 次提交
  7. 18 1月, 2011 1 次提交
  8. 10 1月, 2011 2 次提交
  9. 18 12月, 2010 1 次提交
    • M
      hashtable: drop all non-reentrant versions · 2eb1573f
      Mike Frysinger 提交于
      The non-reentrant versions of the hashtable functions operate on a single
      shared hashtable.  So if two different people try using these funcs for
      two different purposes, they'll cause problems for the other.
      
      Avoid this by converting all existing hashtable consumers over to the
      reentrant versions and then punting the non-reentrant ones.
      Signed-off-by: NMike Frysinger <vapier@gentoo.org>
      2eb1573f
  10. 29 11月, 2010 3 次提交
  11. 18 11月, 2010 1 次提交
    • S
      Switch from archive libraries to partial linking · 6d8962e8
      Sebastien Carlier 提交于
      Before this commit, weak symbols were not overridden by non-weak symbols
      found in archive libraries when linking with recent versions of
      binutils.  As stated in the System V ABI, "the link editor does not
      extract archive members to resolve undefined weak symbols".
      
      This commit changes all Makefiles to use partial linking (ld -r) instead
      of creating library archives, which forces all symbols to participate in
      linking, allowing non-weak symbols to override weak symbols as intended.
      This approach is also used by Linux, from which the gmake function
      cmd_link_o_target (defined in config.mk and used in all Makefiles) is
      inspired.
      
      The name of each former library archive is preserved except for
      extensions which change from ".a" to ".o".  This commit updates
      references accordingly where needed, in particular in some linker
      scripts.
      
      This commit reveals board configurations that exclude some features but
      include source files that depend these disabled features in the build,
      resulting in undefined symbols.  Known such cases include:
      - disabling CMD_NET but not CMD_NFS;
      - enabling CONFIG_OF_LIBFDT but not CONFIG_QE.
      Signed-off-by: NSebastien Carlier <sebastien.carlier@gmail.com>
      6d8962e8
  12. 28 10月, 2010 1 次提交
  13. 27 10月, 2010 2 次提交
    • W
      Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value · 25ddd1fb
      Wolfgang Denk 提交于
      CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
      being able to use "sizeof(struct global_data)" in assembler files.
      Recent experience has shown that manual synchronization is not
      reliable enough.  This patch renames CONFIG_SYS_GBL_DATA_SIZE into
      GENERATED_GBL_DATA_SIZE which gets automatically generated by the
      asm-offsets tool.  In the result, all definitions of this value can be
      deleted from the board config files.  We have to make sure that all
      files that reference such data include the new <asm-offsets.h> file.
      
      No other changes have been done yet, but it is obvious that similar
      changes / simplifications can be done for other, related macro
      definitions as well.
      Signed-off-by: NWolfgang Denk <wd@denx.de>
      Acked-by: NKumar Gala <galak@kernel.crashing.org>
      25ddd1fb
    • W
      include/asm-offsets.h: automatically generate assembler constants · 16a354f9
      Wolfgang Denk 提交于
      A recurrent issue is that certain C level constructs like sizeof() or
      offsetof() cannot be used in assembler files, which is inconvenient
      when such constructs are used in the definition of macro names etc.
      
      To avoid duplication of such definitions (and thus another cause of
      problems), we adapt the Linux way to automatically generate the
      respective definitions from the respective C header files.
      
      In Linux, this is implemented in include/linux/kbuild.h, Kbuild, and
      arch/*/kernel/asm-offsets.c; we adapt the code from the Linux v2.6.36
      kernel tree.
      
      We also copy the concept of the include/generated/ directory which can
      be used to hold other automatically generated files as well.
      
      We start with an architecture-independent lib/asm-offsets.c which
      generates include/generated/generic-asm-offsets.h (included by
      include/asm-offsets.h, which is what will be referred to in the actual
      source code).  Later this may be extended by architecture-specific
      arch/*/lib/asm-offsets.c files that will generate a
      include/generated/asm-offsets.h.
      Signed-off-by: NWolfgang Denk <wd@denx.de>
      Acked-by: NKumar Gala <galak@kernel.crashing.org>
      16a354f9
  14. 13 10月, 2010 2 次提交
    • S
      zlib: Add further watchdog reset calls · be4424c7
      Stefan Roese 提交于
      Patch 253cb831 [zlib: add watchdog reset call] added already a few
      watchdog reset calls to the new zlib U-Boot port. But on some boards
      this is not enough. Additional calls are needed on boards with
      short watchdog timeouts.
      
      This was detected and tested on the lwmon5 board with a very short
      watchdog timeout. Without this patch, the board resets during Linux
      kernel decompression. With it, the decompression succeeds.
      Signed-off-by: NStefan Roese <sr@denx.de>
      Cc: Detlev Zundel <dzu@denx.de>
      Acked-by: NDetlev Zundel <dzu@denx.de>
      be4424c7
    • S
      zlib/gunzip: Use WATCHDOG_RESET macro · f8526286
      Stefan Roese 提交于
      As usually done in U-Boot, the watchdog_reset code is called via a
      macro (WATCHDOG_RESET). In zlib.c this was done differently, by using
      a function pointer which is initialized with WATCHDOG_RESET upon watchdog
      usage or with NULL otherwise. This patch now uses the plain
      WATCHDOG_RESET macros to call the function resulting in slightly smaller
      U-Boot images and simpler code.
      
      U-Boot code size reduction:
      
      PowerPC board with watchdog support (lwmon5):
      -> 80 bytes smaller image size
      
      PowerPC board without watchdog support (sequoia):
      -> 112 bytes smaller image size
      Signed-off-by: NStefan Roese <sr@denx.de>
      Cc: Detlev Zundel <dzu@denx.de>
      Cc: Wolfgang Denk <wd@denx.de>
      Acked-by: NDetlev Zundel <dzu@denx.de>
      f8526286
  15. 07 10月, 2010 1 次提交
    • A
      lib/hashtable.c: add CONFIG_ENV_MIN_ENTRIES · fc5fc76b
      Andreas Bießmann 提交于
      This patch adds a new config parameter for adjusting the calculation of
      hash table size when importing a buffer.
      
      When importing a extremely small buffer (e.g. the default_environment)
      the old calculation generated a hash table which could hold at most the
      buffer content but no more entires.
      
      The new calculation add a fixed number of entries to the result to fit
      better for small import buffers. This amount may be configured by the
      user in board file to adjust the behaviour.
      Signed-off-by: NAndreas Bießmann <andreas.devel@googlemail.com>
      fc5fc76b
  16. 20 9月, 2010 4 次提交
    • W
      New implementation for internal handling of environment variables. · ea882baf
      Wolfgang Denk 提交于
      Motivation:
      
      * Old environment code used a pessimizing implementation:
        - variable lookup used linear search => slow
        - changed/added variables were added at the end, i. e. most
          frequently used variables had the slowest access times => slow
        - each setenv() would calculate the CRC32 checksum over the whole
          environment block => slow
      * "redundant" envrionment was locked down to two copies
      * No easy way to implement features like "reset to factory defaults",
        or to select one out of several pre-defined (previously saved) sets
        of environment settings ("profiles")
      * No easy way to import or export environment settings
      
      ======================================================================
      
      API Changes:
      
      - Variable names starting with '#' are no longer allowed
      
        I didn't find any such variable names being used; it is highly
        recommended to follow standard conventions and start variable names
        with an alphanumeric character
      
      - "printenv" will now print a backslash at the end of all but the last
        lines of a multi-line variable value.
      
        Multi-line variables have never been formally defined, allthough
        there is no reason not to use them. Now we define rules how to deal
        with them, allowing for import and export.
      
      - Function forceenv() and the related code in saveenv() was removed.
        At the moment this is causing build problems for the only user of
        this code (schmoogie - which has no entry in MAINTAINERS); may be
        fixed later by implementing the "env set -f" feature.
      
      Inconsistencies:
      
      - "printenv" will '\\'-escape the '\n' in multi-line variables, while
        "printenv var" will not do that.
      
      ======================================================================
      
      Advantages:
      
      - "printenv" output much better readable (sorted)
      - faster!
      - extendable (additional variable properties can be added)
      - new, powerful features like "factory reset" or easy switching
        between several different environment settings ("profiles")
      
      Disadvantages:
      
      - Image size grows by typically 5...7 KiB (might shrink a bit again on
        systems with redundant environment with a following patch series)
      
      ======================================================================
      
      Implemented:
      
      - env command with subcommands:
      
        - env print [arg ...]
      
          same as "printenv": print environment
      
        - env set [-f] name [arg ...]
      
          same as "setenv": set (and delete) environment variables
      
          ["-f" - force setting even for read-only variables - not
          implemented yet.]
      
        - end delete [-f] name
      
          not implemented yet
      
          ["-f" - force delete even for read-only variables]
      
        - env save
      
          same as "saveenv": save environment
      
        - env export [-t | -b | -c] addr [size]
      
          export internal representation (hash table) in formats usable for
          persistent storage or processing:
      
      	-t:	export as text format; if size is given, data will be
      		padded with '\0' bytes; if not, one terminating '\0'
      		will be added (which is included in the "filesize"
      		setting so you can for exmple copy this to flash and
      		keep the termination).
      	-b:	export as binary format (name=value pairs separated by
      		'\0', list end marked by double "\0\0")
      	-c:	export as checksum protected environment format as
      		used for example by "saveenv" command
      	addr:	memory address where environment gets stored
      	size:	size of output buffer
      
      	With "-c" and size is NOT given, then the export command will
      	format the data as currently used for the persistent storage,
      	i. e. it will use CONFIG_ENV_SECT_SIZE as output block size and
      	prepend a valid CRC32 checksum and, in case of resundant
      	environment, a "current" redundancy flag. If size is given, this
      	value will be used instead of CONFIG_ENV_SECT_SIZE; again, CRC32
      	checksum and redundancy flag will be inserted.
      
      	With "-b" and "-t", always only the real data (including a
      	terminating '\0' byte) will be written; here the optional size
      	argument will be used to make sure not to overflow the user
      	provided buffer; the command will abort if the size is not
      	sufficient. Any remainign space will be '\0' padded.
      
              On successful return, the variable "filesize" will be set.
              Note that filesize includes the trailing/terminating '\0'
              byte(s).
      
              Usage szenario: create a text snapshot/backup of the current
      	settings:
      
      		=> env export -t 100000
      		=> era ${backup_addr} +${filesize}
      		=> cp.b 100000 ${backup_addr} ${filesize}
      
      	Re-import this snapshot, deleting all other settings:
      
      		=> env import -d -t ${backup_addr}
      
        - env import [-d] [-t | -b | -c] addr [size]
      
          import external format (text or binary) into hash table,
          optionally deleting existing values:
      
      	-d:	delete existing environment before importing;
      		otherwise overwrite / append to existion definitions
      	-t:	assume text format; either "size" must be given or the
      		text data must be '\0' terminated
      	-b:	assume binary format ('\0' separated, "\0\0" terminated)
      	-c:	assume checksum protected environment format
      	addr:	memory address to read from
      	size:	length of input data; if missing, proper '\0'
      		termination is mandatory
      
        - env default -f
      
          reset default environment: drop all environment settings and load
          default environment
      
        - env ask name [message] [size]
      
          same as "askenv": ask for environment variable
      
        - env edit name
      
          same as "editenv": edit environment variable
      
        - env run
      
          same as "run": run commands in an environment variable
      
      ======================================================================
      
      TODO:
      
      - drop default env as implemented now; provide a text file based
        initialization instead (eventually using several text files to
        incrementally build it from common blocks) and a tool to convert it
        into a binary blob / object file.
      
      - It would be nice if we could add wildcard support for environment
        variables; this is needed for variable name auto-completion,
        but it would also be nice to be able to say "printenv ip*" or
        "printenv *addr*"
      
      - Some boards don't link any more due to the grown code size:
        DU405, canyonlands, sequoia, socrates.
      
      	=> cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>,
      	       Stefan Roese <sr@denx.de>,
      	       Heiko Schocher <hs@denx.de>
      
      - Dropping forceenv() causes build problems on schmoogie
      
      	=> cc: Sergey Kubushyn <ksi@koi8.net>
      
      - Build tested on PPC and ARM only; runtime tested with NOR and NAND
        flash only => needs testing!!
      Signed-off-by: NWolfgang Denk <wd@denx.de>
      Cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>,
      Cc: Stefan Roese <sr@denx.de>,
      Cc: Heiko Schocher <hs@denx.de>
      Cc: Sergey Kubushyn <ksi@koi8.net>
      ea882baf
    • W
      Add hash table support as base for new environment code · a6826fbc
      Wolfgang Denk 提交于
      This implementation is based on code from uClibc-0.9.30.3 but was
      modified and extended for use within U-Boot.
      
      Major modifications and extensions:
      
      * hsearch() [modified / extended]:
        - While the standard version does not make any assumptions about
          the type of the stored data objects at all, this implementation
          works with NUL terminated strings only.
        - Instead of storing just pointers to the original objects, we
          create local copies so the caller does not need to care about the
          data any more.
        - The standard implementation does not provide a way to update an
          existing entry.  This version will create a new entry or update an
          existing one when both "action == ENTER" and "item.data != NULL".
        - hsearch_r(): Instead of returning 1 on success, we return the
          index into the internal hash table, which is also guaranteed to be
          positive.  This allows us direct access to the found hash table
          slot for example for functions like hdelete().
      * hdelete() [added]:
        - The standard implementation of hsearch(3) does not provide any way
          to delete any entries from the hash table.  We extend the code to
          do that.
      * hexport() [added]:
        - Export the data stored in the hash table in linearized form:
          Entries are exported as "name=value" strings, separated by an
          arbitrary (non-NUL, of course) separator character. This allows to
          use this function both when formatting the U-Boot environment for
          external storage (using '\0' as separator), but also when using it
          for the "printenv" command to print all variables, simply by using
          as '\n" as separator. This can also be used for new features like
          exporting the environment data as text file, including the option
          for later re-import.
        - The entries in the result list will be sorted by ascending key
          values.
      * himport() [added]:
        - Import linearized data into hash table.  This is the inverse
          function to hexport(): it takes a linear list of "name=value"
          pairs and creates hash table entries from it.
        - Entries without "value", i. e. consisting of only "name" or
          "name=", will cause this entry to be deleted from the hash table.
        - The "flag" argument can be used to control the behaviour: when
          the H_NOCLEAR bit is set, then an existing hash table will kept,
          i. e. new data will be added to an existing hash table;
          otherwise, old data will be discarded and a new hash table will
          be created.
        - The separator character for the "name=value" pairs can be
          selected, so we both support importing from externally stored
          environment data (separated by NUL characters) and from plain text
          files (entries separated by newline characters).
        - To allow for nicely formatted text input, leading white space
          (sequences of SPACE and TAB chars) is ignored, and entries
          starting (after removal of any leading white space) with a '#'
          character are considered comments and ignored.
        - NOTE: this means that a variable name cannot start with a '#'
          character.
        - When using a non-NUL separator character, backslash is used as
          escape character in the value part, allowing for example fo
          multi-line values.
        - In theory, arbitrary separator characters can be used, but only
          '\0' and '\n' have really been tested.
      Signed-off-by: NWolfgang Denk <wd@denx.de>
      a6826fbc
    • W
      Add qsort - add support for sorting data arrays · 54c6977e
      Wolfgang Denk 提交于
      Code adapted from uClibc-0.9.30.3
      Signed-off-by: NWolfgang Denk <wd@denx.de>
      54c6977e
    • W
      Add basic errno support. · 65cd3fa8
      Wolfgang Denk 提交于
      Needed for hash table support; probably useful in a lot of other
      places as well.
      Signed-off-by: NWolfgang Denk <wd@denx.de>
      65cd3fa8
  17. 13 9月, 2010 1 次提交
  18. 09 8月, 2010 1 次提交
    • M
      print_buffer: optimize & shrink · 64419e47
      Mike Frysinger 提交于
      Applying a little creative format string allows us to shrink the initial
      data read & display loop by only calling printf once.  Re-using the local
      data buffer to generate the string we want to display then allows us to
      output everything with just one printf call instead of multiple calls to
      the putc function.
      
      The local stack buffer needs increasing by 1 byte, but the resulting code
      shrink and speed up is worth it I think.
      Signed-off-by: NMike Frysinger <vapier@gentoo.org>
      64419e47
  19. 05 7月, 2010 1 次提交
    • W
      Make sure that argv[] argument pointers are not modified. · 54841ab5
      Wolfgang Denk 提交于
      The hush shell dynamically allocates (and re-allocates) memory for the
      argument strings in the "char *argv[]" argument vector passed to
      commands.  Any code that modifies these pointers will cause serious
      corruption of the malloc data structures and crash U-Boot, so make
      sure the compiler can check that no such modifications are being done
      by changing the code into "char * const argv[]".
      
      This modification is the result of debugging a strange crash caused
      after adding a new command, which used the following argument
      processing code which has been working perfectly fine in all Unix
      systems since version 6 - but not so in U-Boot:
      
      int main (int argc, char **argv)
      {
      	while (--argc > 0 && **++argv == '-') {
      /* ====> */	while (*++*argv) {
      			switch (**argv) {
      			case 'd':
      				debug++;
      				break;
      			...
      			default:
      				usage ();
      			}
      		}
      	}
      	...
      }
      
      The line marked "====>" will corrupt the malloc data structures and
      usually cause U-Boot to crash when the next command gets executed by
      the shell.  With the modification, the compiler will prevent this with
      an
      	error: increment of read-only location '*argv'
      
      N.B.: The code above can be trivially rewritten like this:
      
      	while (--argc > 0 && **++argv == '-') {
      		char *arg = *argv;
      		while (*++arg) {
      			switch (*arg) {
      			...
      Signed-off-by: NWolfgang Denk <wd@denx.de>
      Acked-by: NMike Frysinger <vapier@gentoo.org>
      54841ab5
  20. 18 5月, 2010 1 次提交
  21. 06 5月, 2010 2 次提交
  22. 22 4月, 2010 1 次提交
  23. 13 4月, 2010 2 次提交