summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* hush: allow to run interactive shell in do_shSascha Hauer2012-04-301-1/+1
| | | | | | | This allows to call 'sh' in scripts without arguments in which case an interactive shell will be started. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: Fix globbingSascha Hauer2012-04-301-48/+79
| | | | | | | | | | | | | | | | | hush has a long standing and anoying glob bug. hush expands wildcards during parsing of the script or command stream. When the command stream begins to execute the wildcards are already expanded which leads to: mkdir /tmp cd /tmp mkdir foo; ls * ls: *: No such file or directory To fix this expand wildcards right before executing the command. Since 'for' loops are not executed in commands, we have to keep the old behaviour in here so that 'for i in *' still works. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: pass GLOB_NOCHECK to globSascha Hauer2012-04-301-6/+1
| | | | | | | By doing so glob will not return GLOB_NOMATCH anymore but instead just does what fake_glob would do. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: simplify globhackSascha Hauer2012-04-301-31/+8
| | | | | | | | | | | | | | | | hush used to escape '*' '[' '?' during parsing because the quotes got removed in the first parsing loop. globhack is used to remove these escapes again for glob. Since we now keep the quotes until the end of parsing and we no longer escape glob wildcards, we do no longer have to remove any quotes. With this globhack can be much simpler. While at it, change the prototype to match the one from glob() and rename the function to fake_glob, because that's what it is: it just copies the input string into the output struct without actually globbing. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: remove quotes at end of processingSascha Hauer2012-04-301-23/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hush removes the quotes from strings too early. This leads to some bugs. When hush executes echo "hello sascha" it correctly results in: argv[0] = "echo" argv[1] = "hello sascha" However, the following behaves incorrect: a="hello sascha" echo "$a" results in: argv[0] = "echo" argv[1] = "hello" argv[2] = "sascha" This is because hush removes the quotes and inserts variable values in a single loop, so echo "$a" becomes: echo hello sascha after the loop. Instead, keep the quotes until all variables are inserted and remove them at the end. This also fixes that echo \" resulted in \" instead of ". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: run_pipe_real: bail out early to safe an indention levelSascha Hauer2012-04-301-51/+47
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: run_pipe_real must have num_progs == 1Sascha Hauer2012-04-301-7/+9
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: remove bogus 'else'Sascha Hauer2012-04-301-1/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: cleanup coding styleSascha Hauer2012-04-301-109/+221
| | | | | | | | | General coding style cleanup - add some blank lines - add whitespaces on on both sides of operators Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: safe an indention level by continueing a loopSascha Hauer2012-04-301-66/+69
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: safe indention level by continueing a loopSascha Hauer2012-04-301-79/+81
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* menu: fix support for "\n", "\n\r" and "\r"Jean-Christophe PLAGNIOL-VILLARD2012-04-231-1/+7
| | | | | | If "\n\r" or "\r\n" is ignore one. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Introduce binfmt supportJean-Christophe PLAGNIOL-VILLARD2012-04-184-12/+120
| | | | | | | | | | | | | This will allow to execute any file and detect it's type to handle it. This will allow to use shell for bootp bootfile or dfu. You can register multiple hook for the same filetype. They will be execute in the invert order of register. If a hook does not handle the file you just return -ERESTARTNOHAND; This is only available with hush parser. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* filetype: add Bourne Shell supportJean-Christophe PLAGNIOL-VILLARD2012-04-181-0/+3
| | | | | | Put it at first as it's the most likely to detect Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Merge branch 'master' into nextSascha Hauer2012-04-171-2/+2
|\
| * filetype: Make it work on files < 512 bytesSascha Hauer2012-04-171-2/+2
| | | | | | | | | | | | | | This is a brown paper bag type of bugs. Do not assume that a file has to be at minimun 512 bytes to be detectable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'work/dns' into nextSascha Hauer2012-04-161-1/+1
|\ \
| * | Use DEVICE_ID_DYNAMIC where applicableSascha Hauer2012-04-161-1/+1
| | | | | | | | | | | | | | | | | | | | | We now have DEVICE_ID_DYNAMIC for dynamic allocation of device ids, Use it where applicable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'work/build-timestamp' into nextSascha Hauer2012-04-162-1/+20
|\ \ \
| * | | Makefile: fix build timestampsSascha Hauer2012-04-152-1/+20
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the scripts/mkcompile_h from the Kernel. This gives us additional information about the build like who built this binary and with which compiler. Currently the only information used is the build timestamp and the generation number. This also fixes the build timestamp in the banner which is now correct even with consecutive builds without making clean in between. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / / menu: enable the fancy color support only if HUSH is enabledJean-Christophe PLAGNIOL-VILLARD2012-04-151-6/+15
|/ / | | | | | | | | | | | | So we can use the menu for the xloader too. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | console simple: return with a proper error valueSascha Hauer2012-04-131-6/+8
| | | | | | | | | | | | | | There can be only one console for console_simple, so return with -EBUSY when the second gets registered. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | make building of bareboxenv-target optionalSascha Hauer2012-04-131-0/+7
| | | | | | | | | | | | | | The bareboxenv script build for the target does not work on all architectures, so make it optional. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | filetype: add Android boot image supportJean-Christophe PLAGNIOL-VILLARD2012-04-121-0/+3
| | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | menu: add color fancy supportJean-Christophe PLAGNIOL-VILLARD2012-04-101-5/+45
| | | | | | | | | | | | | | | | | | | | | | | | You can now use AINSI color in the display of the menu or menu_entry. As the length of the string is not any more the same as the display simplify the invertion display managemnent. We just now invert the fontground and backgound on the string itself as done in Kconfig. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | menu: fix double action when "\n\r" or "\r\n" is receivedJean-Christophe PLAGNIOL-VILLARD2012-04-101-2/+1
|/ | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush source: expand $PATHSascha Hauer2012-03-181-1/+16
| | | | | | | | The behaviour of other shells suggest that with source or '.' the path should be resolved using the PATH environment variable. Do the same in barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'work/thumb2' into nextSascha Hauer2012-03-061-0/+3
|\
| * ARM: Allow to compile in thumb-2 modeSascha Hauer2012-03-061-0/+3
| | | | | | | | | | | | | | | | | | This shrinks the resulting binary size by ~25%. Exceptions are still handled in arm mode, so we have to explicitely put .arm directives into the exception code. Thumb-2 mode has been tested on i.MX51 Babbage board. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: remove struct command pointer from commandsSascha Hauer2012-02-272-6/+6
| | | | | | | | | | | | This is unused in all commands and thus can be removed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | command: do not allow abbreviated commands anymoreSascha Hauer2012-02-271-19/+3
|/ | | | | | | | | | | | abbreviated commands are derived from U-Boot and are only partly useful. Noone expects from a shell to support this, also we have tab completion. They also have some funny side effects. For example we have a 'time' command. If this command is not compiled in, the time command is interpreted as an abbreviated version of the 'timeout' command. So remove support for abbreviated commands and safe the binary space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* getopt: save and restore contextSascha Hauer2012-02-272-9/+18
| | | | | | | | | | | | execute_command is the single point where commands are executed and thus a new getopt context is needed. currently we call getopt_reset here to reset the context. This breaks though when a command tries to run a command itself by calling execute_command or run_command. In this case we have to store the context and restore it afterwards. The same is necessary in builtin_getopt. Currently noone does this so this one shouldn't fix a bug, but merely allows us to do such things later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: use container_of instead of type_dataSascha Hauer2012-02-251-3/+4
| | | | | | This reduces the usage of type_data. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add string for -ETIMEDOUTSascha Hauer2012-02-191-1/+1
| | | | | | | -ETIMEDOUT is a common error value, so print the string rather than just the number. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* make uimages work on tftpfsSascha Hauer2012-02-191-0/+25
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'pu/device-cleanup' into nextSascha Hauer2012-02-171-1/+1
|\
| * dos partitions: Do not register as fixed partitionsSascha Hauer2012-02-171-1/+1
| | | | | | | | | | | | | | | | A fixed partition means that we can't remove it. This is only suitable for our vital /dev/self0 and /dev/env0 partitions, so remove the fixed flag. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'pu/block' into nextSascha Hauer2012-02-171-73/+201
|\ \
| * | block: reimplement cachingSascha Hauer2012-02-151-73/+201
| |/ | | | | | | | | | | | | | | | | | | | | The current caching layer only has a single buffer for writing and reading. The FAT driver often accesses the fat and then data again, which currently can't be cached. Reimplement this with a list of cached chunks. The number of chunks and their sizes are currently hardcoded, but that could be easily made configurable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / readkey: add define for Ascii keysJean-Christophe PLAGNIOL-VILLARD2012-02-161-3/+3
|/ | | | | | this will simplify the usage of gpio keyboard Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Select CMD_LOADENV with DEFAULT_ENVIRONMENTSanjeev Premi2012-02-071-0/+1
| | | | | | | | | | The environment isn't loaded until this command is is selected - even if compiled in. This patch makes the dependency explicit. Signed-off-by: Sanjeev Premi <premi@ti.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'pu/debug' into nextSascha Hauer2012-01-272-24/+35
|\
| * startup: use regular debug statements in initcall debuggingSascha Hauer2012-01-261-4/+3
| | | | | | | | | | | | | | | | Now that we don't need malloc for the console anymore it's safe to call printf anytime, so switch the initcall debugging to regular debug() statements.. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * initcalls: do not hang if an initcall failsSascha Hauer2012-01-261-4/+1
| | | | | | | | | | | | | | | | | | Currently we just hang when an initcall fails. This resulted in most initcalls just returning 0 unconditionally. Instead of hanging which usually leaves the user without a clue what happened just continue and hope for the best. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * console: make it work without mallocSascha Hauer2012-01-261-17/+32
| | | | | | | | | | | | | | | | This changes the dynamically allocated kfifos to statically initialized ones. This makes the console work without malloc and thus safe to be called before malloc is initialized. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | introduce barebox_bare_init_size to known the bare_init size and check itJean-Christophe PLAGNIOL-VILLARD2012-01-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | this allow to check we do not exceed the size of the SRAM as example introduce BAREBOX_MAX_BARE_INIT_SIZE the maximum size of bare_init this will allow your bare_init will fit in SRAM as example ARCH can overwrite it via ARCH_BAREBOX_MAX_BARE_INIT_SIZE Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | add config to check if the size of barebox exceed the target sizeJean-Christophe PLAGNIOL-VILLARD2012-01-171-0/+7
| | | | | | | | | | | | | | CONFIG_BAREBOX_MAX_IMAGE_SIZE will allow to detected silent oversize result Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | param: add config to disable itJean-Christophe PLAGNIOL-VILLARD2012-01-111-0/+2
| | | | | | | | | | | | this will allow to save 992 Bytes for TI xlaoder or AT91 bootstrap Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* | filetype: add config to disable itJean-Christophe PLAGNIOL-VILLARD2012-01-112-1/+4
| | | | | | | | | | | | remove 160 bytes Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* | banner: add config to disable itJean-Christophe PLAGNIOL-VILLARD2012-01-112-1/+5
| | | | | | | | | | | | this will allow to save 144 bytes Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>