summaryrefslogtreecommitdiffstats
path: root/include/envfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/envfs.h')
-rw-r--r--include/envfs.h31
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 */