diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-02-18 10:25:13 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-02-28 08:14:14 +0100 |
commit | 7fa10256c3f4b38f9ca899c5367584380c017bea (patch) | |
tree | d1c5654947c4d8305d66646aa35656c8611bd16d /include/envfs.h | |
parent | b850dbad6557c4cd0e03c9b83be88579412cdd3f (diff) | |
download | barebox-7fa10256c3f4b38f9ca899c5367584380c017bea.tar.gz barebox-7fa10256c3f4b38f9ca899c5367584380c017bea.tar.xz |
defaultenv: Allow multiple defaultenvironment overlays
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>
Diffstat (limited to 'include/envfs.h')
-rw-r--r-- | include/envfs.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/envfs.h b/include/envfs.h index b63683c043..ae98808ede 100644 --- a/include/envfs.h +++ b/include/envfs.h @@ -3,6 +3,7 @@ #ifdef __BAREBOX__ #include <asm/byteorder.h> +#include <linux/stringify.h> #endif #define ENVFS_MAJOR 1 @@ -111,4 +112,34 @@ static inline char *default_environment_path_get(void) int envfs_register_partition(const char *devname, unsigned int partnr); +#ifdef CONFIG_DEFAULT_ENVIRONMENT +void defaultenv_append(void *buf, unsigned int size, const char *name); +int defaultenv_load(const char *dir, unsigned flags); +#else +static inline void defaultenv_append(void *buf, unsigned int size, const char *name) +{ +} + +static inline int defaultenv_load(const char *dir, unsigned flags) +{ + return -ENOSYS; +} +#endif + +/* + * Append environment directory compiled into barebox with bbenv-y + * to the default environment. The symbol is generated from the filename + * during the build process. Replace '-' with '_' to get the name + * from the filename. + */ +#define defaultenv_append_directory(name) \ + { \ + extern char __bbenv_##name##_start[]; \ + extern char __bbenv_##name##_end[]; \ + defaultenv_append(__bbenv_##name##_start, \ + __bbenv_##name##_end - \ + __bbenv_##name##_start, \ + __stringify(name)); \ + } + #endif /* _ENVFS_H */ |