summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Fix a panic in crypto hash calculations due to uninitialized variable.Krzysztof Halasa2012-06-071-1/+1
| | | | | Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* block: Fix printf warningAlexander Shiyan2012-05-311-1/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* block: do not BUG() on failed block_getSascha Hauer2012-05-301-1/+1
| | | | | | | It does not necessarily means a bug when block_get fails here, this can also be a failure on the underlying device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* block: propagate error code from block_getSascha Hauer2012-05-301-13/+13
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* hush: do not convert to return code too earlySascha Hauer2012-05-231-5/+11
| | | | | | | | | | | | | | | | | parse_stream_outer used to convert a exit value to a return code, but parse_stream_outer maybe inside a recursion. This means that the exit status is lost in this case. Test case: if [ 0 = 0 ]; then false exit $? fi echo "shouldn't be here" Without this patch "shouldn't be here" will be printed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'pu/hush' into nextSascha Hauer2012-05-231-4/+6
|\
| * run_shell: run again on ctrl-cSascha Hauer2012-05-211-4/+6
| | | | | | | | | | | | | | | | We can start a new interactive shell now using the 'sh' command on the command line. This shell exits on ctrl-c though. Add a loop around it to continue instead of exiting. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: Make MENU depend on PROCESS_ESCAPE_SEQUENCEAlan Ott2012-05-211-0/+1
| | | | | | | | | | | | | | print_menu_entry() in common/menu.c depeneds on process_escape_sequence(). Signed-off-by: Alan Ott <alan@signal11.us> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Add next generation default environment templateSascha Hauer2012-05-182-3/+23
|/ | | | | | | | | | | | | | | | | | | | This adds a new environment template which aims to be more flexible and configurable. Instead of having mainly two scripts (a config script and a boot script) this template uses initscripts which control the startup behaviour and configuration. Also we have boot scripts in /env/boot which configure a single boot configuration. Additional boot entries can be added by board specific entries or during runtime by copying and editing a template entry. Some more helpers handle for example network interfaces which can now be brought up with 'ifup'. We use the automount feature to configure mountpoints together with the commands to bring up the devices behind these mountpoints. Optionally menu support is available which hides many details behind a nice looking interface. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'master' into nextSascha Hauer2012-05-164-5/+11
|\
| * complete: fix duplicate env eval listJean-Christophe PLAGNIOL-VILLARD2012-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this can be reproductable by this sequence barebox:/ <TAB> . ? [ addpart bootm cat cd clear cp cpuinfo crc32 delpart devinfo dhcp echo edit erase ethact exit export false getopt go help host loadb loadenv loady login ls md md5sum memcmp memcpy meminfo memset menu mkdir mount mtest mw nfs passwd ping printenv protect pwd readline reset rm rmdir saveenv sedit sh sha1sum sha256sum sleep source test tftp time timeout true umount uncompress unprotect version net.nameserver= net.domainname= cs0.baudrate= cs0.active= cs1.active= cs1.ip= cs1.port= barebox:/ $<TAB> $net.nameserver $net.domainname $cs0.baudrate $cs0.active $cs1.active $cs1.ip $cs1.port $net.nameserver $net.domainname $cs0.baudrate $cs0.active $cs1.active $cs1.ip $cs1.port barebox:/ $ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Merge branch 'next'Sascha Hauer2012-05-0312-3621/+864
| |\ | | | | | | | | | | | | | | | | | | Conflicts: common/hush.c Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | uimage/file_to_sdram: fix resource allocationSascha Hauer2012-05-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | file_to_sdram is used to load an initrd. The resource size is then used to pass the initrd size to Linux. This means that the resource size must exactly match the initrd size. Currently this is not the case since we request the sdram region in chunks of 8 Kbytes. Fix this by adjusting the resource size when the file is loaded. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | hush: bail out of scripts on syntax errorSascha Hauer2012-05-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On a systax error we have to bail out of the shell instead of setting inp->p to NULL and crash barebox with a NULL pointer deref. This only happened in scripts. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> This fixes the problem I had (i.e. a boot loop caused by a stray fi in /env/bin/init). Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
| * | Merge tag 'j-master-fixes' of git://git.jcrosoft.org/bareboxSascha Hauer2012-04-301-2/+7
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Master Fixes usb driver name (driver_d) Menu fixes
| | * | menu: fix support for "\n", "\n\r" and "\r"Jean-Christophe PLAGNIOL-VILLARD2012-04-251-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | If "\n\r" or "\r\n" is ignore one. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| | * | menu: fix double action when "\n\r" or "\r\n" is receivedJean-Christophe PLAGNIOL-VILLARD2012-04-251-2/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | common: memory: fix off-by-one in tlsf_createMarc Kleine-Budde2012-04-241-1/+1
| |/ / | | | | | | | | | | | | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'pu/magicvar' into nextSascha Hauer2012-05-151-0/+4
|\ \ \
| * | | flexible bootargs: Add magicvar descriptionsSascha Hauer2012-05-151-0/+4
| | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | glob: Add sorted output supportSascha Hauer2012-05-141-1/+7
|/ / / | | | | | | | | | | | | | | | | | | This allows us for example to execute init scripts in the correct order. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | booting: more flexible Linux bootargs generationSascha Hauer2012-05-143-1/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use the environment variable 'bootargs' to get the Linux bootargs. This patch allows for a more flexible bootargs generation using global variables. With it the Linux bootargs are concatenated from multiple variables. This allows to replace parts of the bootargs string without having to reconstruct it completely. With this bootargs can be constructed like: global linux.bootargs.base="console=ttyS0,115200" global linux.bootargs.ip="ip=dhcp" global linux.mtdparts="physmap-flash.0:512K(nor0.barebox),-(root)" This will then automatically be combined into a kernel bootargs string during boot. If the 'linux.bootargs.' variables are all empty the old standard 'bootargs' way will be used. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | add 'global' commandSascha Hauer2012-05-143-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements global shell variable support. This is done by registering a new device named 'global', so global variables are just plain device parameters. Global variables are useful for storing the global state in the environment. Currently we do this by sourcing scripts instead of executing them which is quite limiting. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Make errno a positive valueSascha Hauer2012-05-143-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Normally errno contains a positive error value. A certain unnamed developer mixed this up while implementing U-Boot-v2. Also, normally errno is never set to zero by any library function. This patch fixes this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | MIPS: bootm: add "MIPS barebox" handlerAntony Pavlov2012-05-111-0/+2
| |/ |/| | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge tag 'complete_update_support' of git://git.jcrosoft.org/barebox into nextSascha Hauer2012-05-011-27/+174
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | improve complete support The following patch serie improve the complete support by adding a complete framework to allow commands complete support. The add also car complete support for eval and setting and executable file support This also include an update of the stringlist API to support asprintf API
| * | complete: add executable file supportJean-Christophe PLAGNIOL-VILLARD2012-04-301-11/+19
| | | | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| * | complete: add go and sleep supportJean-Christophe PLAGNIOL-VILLARD2012-04-301-0/+5
| | | | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| * | complete: add empty complete supportJean-Christophe PLAGNIOL-VILLARD2012-04-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for cpuinfo, clear, dhcp, false, login, lsmod, meminfo, passwd, pwd, reginfo, reset, true, usb, version for mach-imx and mach-mxs: dump_clocks for u_serial: mycdev Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| * | complete: add device name complete support for devinfoJean-Christophe PLAGNIOL-VILLARD2012-04-301-0/+20
| | | | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| * | complete: add generic command complete frameworkJean-Christophe PLAGNIOL-VILLARD2012-04-301-15/+40
| | | | | | | | | | | | | | | | | | introduce generic command specific complete callback Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| * | complete: add var and device param complete supportJean-Christophe PLAGNIOL-VILLARD2012-04-301-6/+90
| | | | | | | | | | | | | | | | | | with $xx or xx= or if device $xx.yy or xx.yy= Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* | | Merge branch 'pu/assorted' into nextSascha Hauer2012-05-012-3265/+7
|\ \ \
| * | | tlsf_malloc: return valid pointer for malloc(0)Sascha Hauer2012-04-301-0/+7
| | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | remove dlmalloc.srcSascha Hauer2012-04-301-3265/+0
| |/ / | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | 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
|\|