summaryrefslogtreecommitdiffstats
path: root/common/startup.c
Commit message (Collapse)AuthorAgeFilesLines
* include: move shell prototypes to shell.hSascha Hauer2016-04-151-0/+1
| | | | | | We have a shell,h, so move shell specific prototypes there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Add pstore filesystemMarkus Pargmann2015-12-101-0/+5
| | | | | | | | | | | | | | | | pstore is a persistent storage filesystem used for RAMOOPS. It is used to store console logs, panics, ftrace and other information in case of a crash/panic/oops/reboot. pstore is implemented for barebox as a read-only filesystem at the moment. It may be extended later on. The idea is to provide a way to extract essential data from the last running kernel. Most of the code is copied from the kernel. However this is only a lightweight implementation without real write support yet. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* login: rework login mechanismSascha Hauer2015-08-281-5/+2
| | | | | | | | | | | | | | We used to have the login functionality in the /env/bin/init script. This is hard to review and it's too easy to break the login functionality with changes to this script. Move the places to ask for a password to C code where we have only a few places where we have to ask for a password. Mainly these are run_shell() and the menutree command. This patch introduces a login() function which will only return if the correct password has been entered. Following calls will return immediately without asking for a password again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* exitcall: move board_shutdown to exitcall infrastructureHerve Codina2015-07-131-5/+0
| | | | | Signed-off-by: Herve Codina <Herve.CODINA@celad.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* exitcall: move arch_shutdown to exitcall infrastructureHerve Codina2015-07-131-3/+0
| | | | | Signed-off-by: Herve Codina <Herve.CODINA@celad.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* exitcall: move device_shutdown to exitcall infrastructureHerve Codina2015-07-131-1/+0
| | | | | Signed-off-by: Herve Codina <Herve.CODINA@celad.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* exitcall: Add exitcall infrastructureHerve Codina2015-07-131-0/+11
| | | | | | | | exitcall infrastructure is based on initcall infrastructure. It allows to have and use exit call hooks on barebox shutdown. Signed-off-by: Herve Codina <Herve.CODINA@celad.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: introduce postenvironment_initcallSascha Hauer2015-05-151-10/+18
| | | | | | | | To allow init code that depends on the environment being loaded. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* efi: mount efivarfs by default if enabledLucas Stach2014-12-091-0/+6
| | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add support for non volatile variablesSascha Hauer2014-11-061-0/+2
| | | | | | | | | | | | | | | This adds (back) support for non volatile variables. Non volatile variables are variables which are stored in the environment over reboot. They are used in the same way as the global variables, but with a 'nv' command and device. The variables are stored under /env/nv/, one variable per file. Adding a nv variable automatically adds a global variable with the same name. Changing a nv variable also changes the same global variable, but not the other way round. This allows for example to configure the username as: nv user=sha; saveenv Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* environment: Only save changes to the defaultenvSascha Hauer2014-11-061-8/+3
| | | | | | | Instead of storing the complete files with a 'saveenv' command only store the files that have changes to the default environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/nfs'Sascha Hauer2014-03-071-4/+4
|\ | | | | | | | | Conflicts: defaultenv/defaultenv-2-base/bin/ifup
| * run_command: remove unused flag parameterSascha Hauer2014-03-071-2/+2
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mount: support filesystem options passed via -oUwe Kleine-König2014-02-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | Similar to mount(8) the barebox command mount now supports passing a string to the file system driver via -o. This is used in the next commit to let the user specify port numbers for nfs mounts. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv: Allow multiple defaultenvironment overlaysSascha Hauer2014-02-281-34/+1
| | | | | | | | | | | | | | | | | | | | We can compile barebox for multiple boards at once, but currently they all share a single default environment. This patch adds a defaultenv_append() which boards can call to customize the default environment during runtime. Each board now generate default environment snippets using bbenv-y and add them during runtime with defaultenv_append() Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv: Align defaultenv arraySascha Hauer2014-02-201-10/+1
| | | | | | | | | | | | | | | | | | | | The default environment buffer is an unsigned char array and thus may be unaligned. Some decompression algorithms expect the buffer to be sufficiently aligned for u32 accesses. We make this sure by copying the default env to a temporary buffer. Instead of doing this just add a __aligned(4) to the default environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Kconfig: Select default compression typeSascha Hauer2014-02-191-1/+1
|/ | | | | | | | | | Instead of asking explicitly for the default environment compression type ask for the in-barebox default compression type. This also adds a DEFAULT_COMPRESSION_SUFFIX make variable which can be used together with the wildcard rules for compressed files to generate compressed files without explicitly support each compression type. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* environment: Use accessor functions for default environment pathSascha Hauer2014-01-271-0/+1
| | | | | | | | | default_environment_path only exists when CONFIG_ENV_HANDLING is enabled. Boards would have to #ifdef this if they wanted to use default_environment_path. Use accessor functions instead which can be ifdeffed on a single place. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Add missing includesSascha Hauer2013-11-081-0/+1
| | | | | | | | A lot of files rely on include/driver.h including include/of.h (and this including include/errno.h. include the files explicitly so we can eventually get rid of including of.h from driver.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rs485'Sascha Hauer2013-10-071-0/+4
|\ | | | | | | | | Conflicts: common/console_common.c
| * shutdown: add board call backJean-Christophe PLAGNIOL-VILLARD2013-09-241-0/+4
| | | | | | | | | | | | | | | | so if we need to do something switch in the board we can fill this function pointer (as example on Animeo IP shutdown some rs232 & rs485) Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | login: disable input console if password wrongJean-Christophe PLAGNIOL-VILLARD2013-09-191-0/+2
|/ | | | | | | so we guarantee that barebox is secured again user interaction Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: Add initcall tracing debug optionSascha Hauer2013-06-251-0/+4
| | | | | | | | Being able to trace initcall is very useful when trying to find out where startup hangs. This adds a kconfig option for it to make it easier to access. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: switch to pr_xxxJean-Christophe PLAGNIOL-VILLARD2013-03-091-4/+4
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: switch to pr_xxxJean-Christophe PLAGNIOL-VILLARD2013-03-091-2/+2
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* defaultenv loading: rework to use less ifdefs/definesSascha Hauer2013-01-201-18/+22
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: add __noreturn to start_bareboxSascha Hauer2013-01-201-2/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: Use IS_ENABLED for loading environmentSascha Hauer2013-01-201-9/+11
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: use IS_ENABLED instead of ifdefSascha Hauer2013-01-201-9/+8
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* move prototypes for envfs_* to envfs.hSascha Hauer2013-01-201-1/+1
| | | | | | | environment.h is for environment variables, not for the environment storage (envfs), so move the prototypes to envfs.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: call a barebox_main function pointer at the end of the startupSascha Hauer2013-01-201-1/+12
| | | | | | | | | | | | | | | | | Currently Kconfig dependencies are used to allow non-interactive builds. This leads to problems in Kconfig getting the dependencies right. This patch adds a barebox_main function pointer which is called at the end of the startup process. This defaults to run_shell when a shell is enabled. With this the HAVE_NOSHELL Kconfig variable can be removed. Non interactive builds can now be enabled for every board allowing to compile a binary without further Kconfig dependencies. This also allows for more flexibility, for example boards may decide to try non-interactive startup first and call run_shell if that fails. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* loadenv: allow more fine grained environment loadingSascha Hauer2012-11-291-2/+2
| | | | | | | | | | | This implements two new options for the loadenv command: -s: removes (scrubs) old directory contents to be able to create a fresh environment from for example /dev/defaultenv -n: no overwrite. Do not overwrite existing files. This allows to keep parts of the old environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2012-11-161-1/+3
|\ | | | | | | | | | | | | Conflicts: commands/Makefile Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * startup: Print error message when initcall failsSascha Hauer2012-10-091-1/+3
| | | | | | | | | | | | | | | | | | | | There was a time when we used to panic when initcalls failed. Then it was changed to totally ignore the return value. Instead, print an error message now so that the user can get a clue when something bad happened. So initcalls are now recommended to actually return negative error codes when something fails. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | defaultenv: dependencies fixesSascha Hauer2012-10-121-1/+1
|/ | | | | | | | | | | | | | When a build with a compressed default environment is done and then environment compression is disabled, barebox_default_env.h is not regenerated because its dependency (now barebox_default_env) is still up to date. This results in a corrupt default environment. This patch fixes this by adding a cmd_env_h and changing barebox_default_env.h to FORCE. As a side effect barebox_default_env.h is no longer generated in include/generated/ but in common/ as we have to add barebox_default_env.h to $(targets) (extra-y). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/remove-fsf-address'Sascha Hauer2012-10-031-4/+0
|\ | | | | | | | | | | Conflicts: drivers/net/miidev.c include/miidev.h
| * Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | | | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: split out meminfo output and make it optionalJan Luebbe2012-09-061-21/+0
|/ | | | | Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 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>
* defaultenv: use a compressed version when embedded in bareboxJean-Christophe PLAGNIOL-VILLARD2012-01-021-2/+27
| | | | | | | | | | | | | | | | | | | enable it only if a compression is enabled support gzip, bzip2 and lzo you will be able to choose which compression to use -rw-r--r-- 1 root root 8436 Dec 15 01:35 barebox_default_env -rw-r--r-- 1 root root 2782 Dec 15 01:35 barebox_default_env.bz2 -rw-r--r-- 1 root root 2691 Dec 15 01:38 barebox_default_env.gz -rw-r--r-- 1 root root 3262 Dec 15 01:38 barebox_default_env.lzo with using gzip and the default env we can save 5.6KiB (5,745 bytes) with using bzip2 and the default env we can save 5.5KiB (5,654 bytes) with using lzo and the default env we can save 5.1KiB (5,174 bytes) Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove EARLY_INIT and EARLY_CONSOLE supportSascha Hauer2011-09-271-28/+0
| | | | | | Bitrotted over time and nearly unused, so remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename include/mem_malloc.h to include/memory.hSascha Hauer2011-09-231-1/+1
| | | | | | | Which is a better name and also better to collect other things. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add a add_mem_device functionSascha Hauer2011-07-181-13/+3
| | | | | | | | | | | Add a helper function for boards to register their memory devices. This makes the board code smaller and also helps getting rid of map_base and struct memory_platform_data. And switch all of the memory to it Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* startup.c: make DEBUG_LL output more usefulAntony Pavlov2011-07-181-1/+5
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* environment: make default env path configurableSascha Hauer2011-04-121-3/+4
| | | | | | | | Normally the default path to save the environment is /dev/env0. However, we can't map a file in a fat filesystem to /dev/env0. So if we want to store the environment in a file in fat we have to make it configurable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* make command support optionalSascha Hauer2011-04-111-1/+4
| | | | | | | In a noninveractive environment we do not need commands. So make them optional. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: we can only mount root and devfs when compiled inSascha Hauer2011-04-111-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* startup: make debug printing of linker variables work againSascha Hauer2011-01-171-2/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Silence few warnings.Krzysztof Halasa2010-12-211-1/+1
| | | | | Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>