diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-02-03 09:55:54 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-02-03 09:55:54 +0100 |
commit | 601bf0fcc62854af68b35d857696be9a4a9e567d (patch) | |
tree | 39e6eb29bdd79e49b474a64558d81f6fb9d34c94 /common | |
parent | 701d565c2a1c50e84e7035048968bc81fd869c87 (diff) | |
parent | a4d39ca0f1e0ceeab4e1f817a9c32b9c0a4f01c2 (diff) | |
download | barebox-601bf0fcc62854af68b35d857696be9a4a9e567d.tar.gz barebox-601bf0fcc62854af68b35d857696be9a4a9e567d.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 2 | ||||
-rw-r--r-- | common/Makefile | 6 | ||||
-rw-r--r-- | common/console.c | 29 | ||||
-rw-r--r-- | common/environment.c | 18 | ||||
-rw-r--r-- | common/startup.c | 1 |
5 files changed, 48 insertions, 8 deletions
diff --git a/common/Kconfig b/common/Kconfig index ce426f22ad..8af7ec1a8d 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -529,7 +529,7 @@ source common/partitions/Kconfig config DEFAULT_ENVIRONMENT bool default y - select CMD_LOADENV + select ENV_HANDLING prompt "Compile in default environment" help Enabling this option will give you a default environment when diff --git a/common/Makefile b/common/Makefile index 6f6e360647..ee02e0ec94 100644 --- a/common/Makefile +++ b/common/Makefile @@ -110,7 +110,7 @@ targets += barebox_default_env.lzo barebox_default_env.bz2 barebox_default_env.g quiet_cmd_env_h = ENVH $@ cmd_env_h = cat $< | (cd $(obj) && $(objtree)/scripts/bin2c default_environment) > $@; \ - echo "const int default_environment_uncompress_size=`stat -c%s $(obj)/barebox_default_env`;" >> $@ + echo "static const int default_environment_uncompress_size=`stat -c%s $(obj)/barebox_default_env`;" >> $@ $(obj)/barebox_default_env.h: $(obj)/barebox_default_env$(barebox_default_env_comp) FORCE $(call if_changed,env_h) @@ -119,14 +119,14 @@ quiet_cmd_pwd_h = PWDH $@ ifdef CONFIG_PASSWORD ifneq ($(CONFIG_PASSWORD_DEFAULT),"") PASSWD_FILE := $(shell cd $(srctree); find $(CONFIG_PASSWORD_DEFAULT) -type f) -cmd_pwd_h = echo -n "const char default_passwd[] = \"" > $@; \ +cmd_pwd_h = echo -n "static const char default_passwd[] = \"" > $@; \ cat $< | tr -d '\n' >> $@; \ echo "\";" >> $@ include/generated/passwd.h: $(PASSWD_FILE) $(call if_changed,pwd_h) else -cmd_pwd_h = echo "const char default_passwd[] = \"\";" > $@ +cmd_pwd_h = echo "static const char default_passwd[] = \"\";" > $@ include/generated/passwd.h: FORCE $(call if_changed,pwd_h) diff --git a/common/console.c b/common/console.c index 329bc72493..aa9e3ce0f5 100644 --- a/common/console.c +++ b/common/console.c @@ -31,6 +31,8 @@ #include <kfifo.h> #include <module.h> #include <poller.h> +#include <magicvar.h> +#include <globalvar.h> #include <linux/list.h> #include <linux/stringify.h> #include <debug_ll.h> @@ -140,6 +142,26 @@ static void console_init_early(void) initialized = CONSOLE_INITIALIZED_BUFFER; } +static void console_set_stdoutpath(struct console_device *cdev) +{ + int id; + char *str; + + if (!cdev->linux_console_name) + return; + + id = of_alias_get_id(cdev->dev->device_node, "serial"); + if (id < 0) + return; + + str = asprintf("console=%s%d,%dn8", cdev->linux_console_name, + id, cdev->baudrate); + + globalvar_add_simple("linux.bootargs.console", str); + + free(str); +} + int console_register(struct console_device *newcdev) { struct device_d *dev = &newcdev->class_dev; @@ -169,8 +191,10 @@ int console_register(struct console_device *newcdev) activate = 1; } - if (newcdev->dev && of_device_is_stdout_path(newcdev->dev)) + if (newcdev->dev && of_device_is_stdout_path(newcdev->dev)) { activate = 1; + console_set_stdoutpath(newcdev); + } list_add_tail(&newcdev->list, &console_list); @@ -357,3 +381,6 @@ int ctrlc (void) } EXPORT_SYMBOL(ctrlc); #endif /* ARCH_HAS_CTRC */ + +BAREBOX_MAGICVAR_NAMED(global_linux_bootargs_console, global.linux.bootargs.console, + "console= argument for Linux from the linux,stdout-path property in /chosen node"); diff --git a/common/environment.c b/common/environment.c index 24487775d7..6f06bfce28 100644 --- a/common/environment.c +++ b/common/environment.c @@ -48,7 +48,19 @@ struct action_data { }; #define PAD4(x) ((x + 3) & ~3) -char *default_environment_path = "/dev/env0"; +#ifdef __BAREBOX__ +static char *default_environment_path = "/dev/env0"; + +void default_environment_path_set(char *path) +{ + default_environment_path = path; +} + +char *default_environment_path_get(void) +{ + return default_environment_path; +} +#endif static int file_size_action(const char *filename, struct stat *statbuf, void *userdata, int depth) @@ -150,7 +162,7 @@ out: * Note: This function will also be used on the host! See note in the header * of this file. */ -int envfs_save(char *filename, char *dirname) +int envfs_save(const char *filename, char *dirname) { struct envfs_super *super; int envfd, size, ret; @@ -215,7 +227,7 @@ EXPORT_SYMBOL(envfs_save); * Note: This function will also be used on the host! See note in the header * of this file. */ -int envfs_load(char *filename, char *dir, unsigned flags) +int envfs_load(const char *filename, char *dir, unsigned flags) { struct envfs_super super; void *buf = NULL, *buf_free = NULL; diff --git a/common/startup.c b/common/startup.c index 74c7735e31..e8b9ea0216 100644 --- a/common/startup.c +++ b/common/startup.c @@ -121,6 +121,7 @@ void __noreturn start_barebox(void) if (IS_ENABLED(CONFIG_ENV_HANDLING)) { int ret; + char *default_environment_path = default_environment_path_get(); ret = envfs_load(default_environment_path, "/env", 0); |