summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig64
-rw-r--r--common/Makefile153
-rw-r--r--common/bootm.c1
-rw-r--r--common/environment.c183
-rw-r--r--common/filetype.c4
-rw-r--r--common/kallsyms.c8
-rw-r--r--common/menu.c18
-rw-r--r--common/password.c4
-rw-r--r--common/startup.c44
9 files changed, 224 insertions, 255 deletions
diff --git a/common/Kconfig b/common/Kconfig
index 2e91cd7a6c..5989502a75 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -145,13 +145,24 @@ config BAREBOX_MAX_IMAGE_SIZE
help
Define the maximum size of barebox
+config BAREBOX_MAX_PBL_SIZE
+ depends on PBL_IMAGE
+ prompt "Maximum pre-bootloader size"
+ hex
+ default 0xffffffff
+ help
+ On some hardware the ROM code can load the pbl into SRAM, but not
+ the whole image. This option specifies how big the pbl may get.
+
config BAREBOX_MAX_BARE_INIT_SIZE
prompt "Maximum bare_init size"
hex
+ range 0x0 BAREBOX_MAX_PBL_SIZE if LOAD_PBL_SRAM
+ default BAREBOX_MAX_PBL_SIZE if LOAD_PBL_SRAM
default 0xffffffff
help
Define the maximum size of bare_init
- this will allow your bare_init will fit in SRAM as example
+ this will allow your bare_init to fit in SRAM as example
ARCH can overwrite it via ARCH_BAREBOX_MAX_BARE_INIT_SIZE
config HAVE_CONFIGURABLE_MEMORY_LAYOUT
@@ -535,35 +546,38 @@ config DEFAULT_ENVIRONMENT
Enabling this option will give you a default environment when
the environment found in the environment sector is invalid
-config DEFAULT_ENVIRONMENT_COMPRESSED
- bool
- depends on DEFAULT_ENVIRONMENT
- depends on !IMAGE_COMPRESSION_LZO
- depends on !IMAGE_COMPRESSION_GZIP
- default y if ZLIB
- default y if BZLIB
- default y if LZO_DECOMPRESS
-
-if DEFAULT_ENVIRONMENT_COMPRESSED
-
choice
- prompt "compression"
-
-config DEFAULT_ENVIRONMENT_COMPRESSED_GZIP
+ prompt "default compression for in-barebox binaries"
+ default DEFAULT_COMPRESSION_NONE if PBL_IMAGE
+ default DEFAULT_COMPRESSION_LZO if LZO_DECOMPRESS
+ default DEFAULT_COMPRESSION_GZIP if ZLIB
+ default DEFAULT_COMPRESSION_LZ4 if LZ4_DECOMPRESS
+ default DEFAULT_COMPRESSION_BZIP2 if BZLIB
+ help
+ Select the default compression for in-barebox binary files. Files
+ compiled into barebox like for example the default environment will
+ be compressed with this compression type.
+
+config DEFAULT_COMPRESSION_GZIP
bool "gzip"
depends on ZLIB
-config DEFAULT_ENVIRONMENT_COMPRESSED_BZIP2
+config DEFAULT_COMPRESSION_BZIP2
bool "bzip2"
depends on BZLIB
-config DEFAULT_ENVIRONMENT_COMPRESSED_LZO
+config DEFAULT_COMPRESSION_LZO
bool "lzo"
depends on LZO_DECOMPRESS
-endchoice
+config DEFAULT_COMPRESSION_LZ4
+ bool "lz4"
+ depends on LZ4_DECOMPRESS
-endif
+config DEFAULT_COMPRESSION_NONE
+ bool "no compression"
+
+endchoice
config HAVE_DEFAULT_ENVIRONMENT_NEW
bool
@@ -585,6 +599,18 @@ config DEFAULT_ENVIRONMENT_GENERIC_NEW
select NET_CMD_IFUP if NET
prompt "Generic environment template"
+config DEFAULT_ENVIRONMENT_GENERIC_NEW_MENU
+ bool
+ depends on DEFAULT_ENVIRONMENT_GENERIC_NEW
+ depends on CONFIG_CMD_MENU_MANAGEMENT
+ default y
+
+config DEFAULT_ENVIRONMENT_GENERIC_NEW_DFU
+ bool
+ depends on DEFAULT_ENVIRONMENT_GENERIC_NEW
+ depends on USB_GADGET_DFU
+ default y
+
config DEFAULT_ENVIRONMENT_GENERIC
bool
depends on !HAVE_DEFAULT_ENVIRONMENT_NEW
diff --git a/common/Makefile b/common/Makefile
index ee02e0ec94..667c7b36ba 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -1,119 +1,48 @@
-obj-$(CONFIG_BINFMT) += binfmt.o
-obj-$(CONFIG_SHELL_HUSH) += hush.o
-obj-$(CONFIG_SHELL_SIMPLE) += parser.o
-obj-$(CONFIG_GREGORIAN_CALENDER) += date.o
-obj-$(CONFIG_KALLSYMS) += kallsyms.o
-obj-$(CONFIG_ENV_HANDLING) += environment.o
+obj-y += memory.o
+obj-y += memory_display.o
+obj-y += clock.o
+obj-y += console_common.o
+obj-y += startup.o
+obj-y += misc.o
+obj-y += memsize.o
+obj-y += resource.o
+obj-y += bootsource.o
obj-$(CONFIG_AUTO_COMPLETE) += complete.o
-obj-$(CONFIG_POLLER) += poller.o
+obj-$(CONFIG_BANNER) += version.o
+obj-$(CONFIG_BAREBOX_UPDATE) += bbu.o
+obj-$(CONFIG_BINFMT) += binfmt.o
obj-$(CONFIG_BLOCK) += block.o
-obj-$(CONFIG_PARTITION_DISK) += partitions.o partitions/
-
+obj-$(CONFIG_BLSPEC) += blspec.o
+obj-$(CONFIG_BOOTM) += bootm.o
obj-$(CONFIG_CMD_LOADS) += s_record.o
-obj-$(CONFIG_OFTREE) += oftree.o
-
-obj-$(CONFIG_BLSPEC) += blspec.o
-obj-y += memory.o
-obj-$(CONFIG_DDR_SPD) += ddr_spd.o
-obj-y += memory_display.o
-obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o
-obj-$(CONFIG_MALLOC_TLSF) += tlsf_malloc.o
-obj-$(CONFIG_MALLOC_TLSF) += tlsf.o
-obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o
-obj-$(CONFIG_CMD_MEMTEST) += memtest.o
-obj-y += clock.o
-obj-$(CONFIG_BANNER) += version.o
-obj-$(CONFIG_MEMINFO) += meminfo.o
-obj-$(CONFIG_COMMAND_SUPPORT) += command.o
-obj-$(CONFIG_CONSOLE_FULL) += console.o
-obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
-obj-y += console_common.o
-obj-$(CONFIG_DIGEST) += digest.o
+obj-$(CONFIG_CMD_MEMTEST) += memtest.o
+obj-$(CONFIG_COMMAND_SUPPORT) += command.o
+obj-$(CONFIG_CONSOLE_FULL) += console.o
+obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
+obj-$(CONFIG_DIGEST) += digest.o
+obj-$(CONFIG_DDR_SPD) += ddr_spd.o
+obj-$(CONFIG_ENV_HANDLING) += environment.o
obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o
-obj-$(CONFIG_UIMAGE) += image.o
-obj-$(CONFIG_UIMAGE) += uimage.o
-obj-y += startup.o
-obj-y += misc.o
-obj-y += memsize.o
-obj-$(CONFIG_GLOBALVAR) += globalvar.o
-obj-$(CONFIG_RESET_SOURCE) += reset_source.o
-obj-$(CONFIG_FILETYPE) += filetype.o
-obj-y += resource.o
-obj-$(CONFIG_MENU) += menu.o
-obj-$(CONFIG_PASSWORD) += password.o
-obj-$(CONFIG_MODULES) += module.o
-obj-$(CONFIG_FLEXIBLE_BOOTARGS) += bootargs.o
-obj-$(CONFIG_BAREBOX_UPDATE) += bbu.o
-obj-y += bootsource.o
-obj-$(CONFIG_BOOTM) += bootm.o
-extra-$(CONFIG_MODULES) += module.lds
-extra-y += barebox_default_env barebox_default_env.h
-
-ifdef CONFIG_DEFAULT_ENVIRONMENT
-$(obj)/startup.o: $(obj)/barebox_default_env.h
-$(obj)/env.o: $(obj)/barebox_default_env.h
-
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW),y)
-DEFAULT_ENVIRONMENT_PATH = "defaultenv-2/base"
-ifeq ($(CONFIG_CMD_MENU_MANAGEMENT),y)
-DEFAULT_ENVIRONMENT_PATH += "defaultenv-2/menu"
-endif
-endif
-
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
-DEFAULT_ENVIRONMENT_PATH = "defaultenv"
-endif
-
-ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
-DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
-endif
-
-ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f ; done)
-
-endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
-
-#
-# Generate a barebox envfs image.
-#
-# echo $(ENV_FILES) > /dev/null is just for letting if_changed
-# recognize that something has changed when the environment has
-# other files,
-#
-quiet_cmd_env = ENV $@
-cmd_env = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(DEFAULT_ENVIRONMENT_PATH)) || \
- (echo $(ENV_FILES) > /dev/null; rm -f $@ ; false)
-
-$(obj)/barebox_default_env: $(ENV_FILES) FORCE
- $(call if_changed,env)
-
-barebox_default_env_comp =
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_GZIP),y)
-barebox_default_env_comp = .gz
-endif
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_BZIP2),y)
-barebox_default_env_comp = .bz2
-endif
-ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_LZO),y)
-barebox_default_env_comp = .lzo
-endif
-
-$(obj)/barebox_default_env.gz: $(obj)/barebox_default_env FORCE
- $(call if_changed,gzip)
-
-$(obj)/barebox_default_env.bz2: $(obj)/barebox_default_env FORCE
- $(call if_changed,bzip2)
-
-$(obj)/barebox_default_env.lzo: $(obj)/barebox_default_env FORCE
- $(call if_changed,lzo)
-
-targets += barebox_default_env.lzo barebox_default_env.bz2 barebox_default_env.gz
-
-quiet_cmd_env_h = ENVH $@
-cmd_env_h = cat $< | (cd $(obj) && $(objtree)/scripts/bin2c default_environment) > $@; \
- 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)
+obj-$(CONFIG_FILETYPE) += filetype.o
+obj-$(CONFIG_FLEXIBLE_BOOTARGS) += bootargs.o
+obj-$(CONFIG_GLOBALVAR) += globalvar.o
+obj-$(CONFIG_GREGORIAN_CALENDER) += date.o
+obj-$(CONFIG_KALLSYMS) += kallsyms.o
+obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o
+obj-$(CONFIG_MALLOC_TLSF) += tlsf_malloc.o tlsf.o
+obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o
+obj-$(CONFIG_MEMINFO) += meminfo.o
+obj-$(CONFIG_MENU) += menu.o
+obj-$(CONFIG_MODULES) += module.o
+extra-$(CONFIG_MODULES) += module.lds
+obj-$(CONFIG_OFTREE) += oftree.o
+obj-$(CONFIG_PARTITION_DISK) += partitions.o partitions/
+obj-$(CONFIG_PASSWORD) += password.o
+obj-$(CONFIG_POLLER) += poller.o
+obj-$(CONFIG_RESET_SOURCE) += reset_source.o
+obj-$(CONFIG_SHELL_HUSH) += hush.o
+obj-$(CONFIG_SHELL_SIMPLE) += parser.o
+obj-$(CONFIG_UIMAGE) += image.o uimage.o
quiet_cmd_pwd_h = PWDH $@
ifdef CONFIG_PASSWORD
diff --git a/common/bootm.c b/common/bootm.c
index d62d011e2a..12d3ee0c46 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -294,6 +294,7 @@ static int bootm_open_oftree(struct image_data *data, const char *oftree, int nu
if (ft != filetype_oftree) {
printf("%s is not an oftree but %s\n", oftree,
file_type_to_string(ft));
+ return -EINVAL;
}
data->of_root_node = of_unflatten_dtb(NULL, fdt);
diff --git a/common/environment.c b/common/environment.c
index 6f06bfce28..776fa3ad38 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -162,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(const char *filename, char *dirname)
+int envfs_save(const char *filename, const char *dirname)
{
struct envfs_super *super;
int envfd, size, ret;
@@ -218,78 +218,52 @@ out1:
}
EXPORT_SYMBOL(envfs_save);
-/**
- * Restore the last environment into the current one
- * @param[in] filename from where to restore
- * @param[in] dir where to store the last content
- * @return 0 on success, anything else in case of failure
- *
- * Note: This function will also be used on the host! See note in the header
- * of this file.
- */
-int envfs_load(const char *filename, char *dir, unsigned flags)
+static int envfs_check_super(struct envfs_super *super, size_t *size)
{
- struct envfs_super super;
- void *buf = NULL, *buf_free = NULL;
- int envfd;
- int fd, ret = 0;
- char *str, *tmp;
- int headerlen_full;
- unsigned long size;
- /* for envfs < 1.0 */
- struct envfs_inode_end inode_end_dummy;
-
- inode_end_dummy.mode = ENVFS_32(S_IRWXU | S_IRWXG | S_IRWXO);
- inode_end_dummy.magic = ENVFS_32(ENVFS_INODE_END_MAGIC);
-
- envfd = open(filename, O_RDONLY);
- if (envfd < 0) {
- printf("Open %s %s\n", filename, errno_str());
- return -1;
+ if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
+ printf("envfs: wrong magic\n");
+ return -EIO;
}
- /* read superblock */
- ret = read(envfd, &super, sizeof(struct envfs_super));
- if ( ret < sizeof(struct envfs_super)) {
- perror("read");
- ret = -errno;
- goto out;
+ if (crc32(0, super, sizeof(*super) - 4) != ENVFS_32(super->sb_crc)) {
+ printf("wrong crc on env superblock\n");
+ return -EIO;
}
- if ( ENVFS_32(super.magic) != ENVFS_MAGIC) {
- printf("envfs: wrong magic on %s\n", filename);
- ret = -EIO;
- goto out;
- }
+ if (super->major < ENVFS_MAJOR)
+ printf("envfs version %d.%d loaded into %d.%d\n",
+ super->major, super->minor,
+ ENVFS_MAJOR, ENVFS_MINOR);
- if (crc32(0, (unsigned char *)&super, sizeof(struct envfs_super) - 4)
- != ENVFS_32(super.sb_crc)) {
- printf("wrong crc on env superblock\n");
- ret = -EIO;
- goto out;
- }
+ *size = ENVFS_32(super->size);
- size = ENVFS_32(super.size);
- buf = xmalloc(size);
- buf_free = buf;
- ret = read(envfd, buf, size);
- if (ret < size) {
- perror("read");
- ret = -errno;
- goto out;
- }
+ return 0;
+}
- if (crc32(0, (unsigned char *)buf, size)
- != ENVFS_32(super.crc)) {
+static int envfs_check_data(struct envfs_super *super, const void *buf, size_t size)
+{
+ uint32_t crc;
+
+ crc = crc32(0, buf, size);
+ if (crc != ENVFS_32(super->crc)) {
printf("wrong crc on env\n");
- ret = -EIO;
- goto out;
+ return -EIO;
}
- if (super.major < ENVFS_MAJOR)
- printf("envfs version %d.%d loaded into %d.%d\n",
- super.major, super.minor,
- ENVFS_MAJOR, ENVFS_MINOR);
+ return 0;
+}
+
+static int envfs_load_data(void *buf, size_t size, const char *dir, unsigned flags)
+{
+ struct envfs_super super;
+ int fd, ret = 0;
+ char *str, *tmp;
+ int headerlen_full;
+ /* for envfs < 1.0 */
+ struct envfs_inode_end inode_end_dummy;
+
+ inode_end_dummy.mode = ENVFS_32(S_IRWXU | S_IRWXG | S_IRWXO);
+ inode_end_dummy.magic = ENVFS_32(ENVFS_INODE_END_MAGIC);
while (size) {
struct envfs_inode *inode;
@@ -300,7 +274,7 @@ int envfs_load(const char *filename, char *dir, unsigned flags)
buf += sizeof(struct envfs_inode);
if (ENVFS_32(inode->magic) != ENVFS_INODE_MAGIC) {
- printf("envfs: wrong magic on %s\n", filename);
+ printf("envfs: wrong magic\n");
ret = -EIO;
goto out;
}
@@ -324,7 +298,7 @@ int envfs_load(const char *filename, char *dir, unsigned flags)
buf += headerlen_full;
if (ENVFS_32(inode_end->magic) != ENVFS_INODE_END_MAGIC) {
- printf("envfs: wrong inode_end_magic on %s\n", filename);
+ printf("envfs: wrong inode_end_magic\n");
ret = -EIO;
goto out;
}
@@ -370,9 +344,86 @@ skip:
ret = 0;
out:
+ return ret;
+}
+
+int envfs_load_from_buf(void *buf, int len, const char *dir, unsigned flags)
+{
+ int ret;
+ size_t size;
+ struct envfs_super *super = buf;
+
+ buf = super + 1;
+
+ ret = envfs_check_super(super, &size);
+ if (ret)
+ return ret;
+
+ ret = envfs_check_data(super, buf, size);
+ if (ret)
+ return ret;
+
+ ret = envfs_load_data(buf, size, dir, flags);
+
+ return ret;
+}
+
+/**
+ * Restore the last environment into the current one
+ * @param[in] filename from where to restore
+ * @param[in] dir where to store the last content
+ * @return 0 on success, anything else in case of failure
+ *
+ * Note: This function will also be used on the host! See note in the header
+ * of this file.
+ */
+int envfs_load(const char *filename, const char *dir, unsigned flags)
+{
+ struct envfs_super super;
+ void *buf = NULL;
+ int envfd;
+ int ret = 0;
+ size_t size;
+
+ envfd = open(filename, O_RDONLY);
+ if (envfd < 0) {
+ printf("Open %s %s\n", filename, errno_str());
+ return -1;
+ }
+
+ /* read superblock */
+ ret = read(envfd, &super, sizeof(struct envfs_super));
+ if ( ret < sizeof(struct envfs_super)) {
+ perror("read");
+ ret = -errno;
+ goto out;
+ }
+
+ ret = envfs_check_super(&super, &size);
+ if (ret)
+ goto out;
+
+ buf = xmalloc(size);
+ ret = read(envfd, buf, size);
+ if (ret < size) {
+ perror("read");
+ ret = -errno;
+ goto out;
+ }
+
+ ret = envfs_check_data(&super, buf, size);
+ if (ret)
+ goto out;
+
+ ret = envfs_load_data(buf, size, dir, flags);
+ if (ret)
+ goto out;
+
+ ret = 0;
+out:
close(envfd);
- if (buf_free)
- free(buf_free);
+ free(buf);
+
return ret;
}
diff --git a/common/filetype.c b/common/filetype.c
index 8cdf82741a..0b5da3042a 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -23,6 +23,7 @@
#include <fs.h>
#include <malloc.h>
#include <errno.h>
+#include <envfs.h>
struct filetype_str {
const char *name; /* human readable filetype */
@@ -51,6 +52,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_ext] = { "ext filesystem", "ext" },
[filetype_gpt] = { "GUID Partition Table", "gpt" },
[filetype_bpk] = { "Binary PacKage", "bpk" },
+ [filetype_barebox_env] = { "barebox environment file", "bbenv" },
};
const char *file_type_to_string(enum filetype f)
@@ -188,6 +190,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (strncmp(buf8, "#!/bin/sh", 9) == 0)
return filetype_sh;
+ if (buf[0] == ENVFS_32(ENVFS_MAGIC))
+ return filetype_barebox_env;
if (bufsize < 32)
return filetype_unknown;
diff --git a/common/kallsyms.c b/common/kallsyms.c
index 94dfcdce84..121b77cc8b 100644
--- a/common/kallsyms.c
+++ b/common/kallsyms.c
@@ -167,10 +167,10 @@ static unsigned long get_symbol_pos(unsigned long addr,
* It resides in a module.
* - We also guarantee that modname will be valid until rescheduled.
*/
-const char *kallsyms_lookup(unsigned long addr,
- unsigned long *symbolsize,
- unsigned long *offset,
- char **modname, char *namebuf)
+static const char *kallsyms_lookup(unsigned long addr,
+ unsigned long *symbolsize,
+ unsigned long *offset,
+ char **modname, char *namebuf)
{
namebuf[KSYM_NAME_LEN - 1] = 0;
namebuf[0] = 0;
diff --git a/common/menu.c b/common/menu.c
index 114c36efcc..54f2c71b29 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -303,7 +303,7 @@ int menu_show(struct menu *m)
int repaint = 0;
if (m->auto_select >= 0)
- ch = KEY_RETURN;
+ ch = BB_KEY_RETURN;
else
ch = read_key();
@@ -327,7 +327,7 @@ int menu_show(struct menu *m)
}
break;
}
- case KEY_UP:
+ case BB_KEY_UP:
m->selected = list_entry(m->selected->list.prev, struct menu_entry,
list);
if (&(m->selected->list) == &(m->entries)) {
@@ -336,7 +336,7 @@ int menu_show(struct menu *m)
}
repaint = 1;
break;
- case KEY_DOWN:
+ case BB_KEY_DOWN:
m->selected = list_entry(m->selected->list.next, struct menu_entry,
list);
if (&(m->selected->list) == &(m->entries)) {
@@ -353,11 +353,11 @@ int menu_show(struct menu *m)
m->selected->action(m, m->selected);
repaint = 1;
break;
- case KEY_ENTER:
- if (ch_previous == KEY_RETURN)
+ case BB_KEY_ENTER:
+ if (ch_previous == BB_KEY_RETURN)
break;
- case KEY_RETURN:
- if (ch_previous == KEY_ENTER)
+ case BB_KEY_RETURN:
+ if (ch_previous == BB_KEY_ENTER)
break;
clear();
gotoXY(1,1);
@@ -368,11 +368,11 @@ int menu_show(struct menu *m)
else
print_menu(m);
break;
- case KEY_HOME:
+ case BB_KEY_HOME:
m->selected = list_first_entry(&m->entries, struct menu_entry, list);
repaint = 1;
break;
- case KEY_END:
+ case BB_KEY_END:
m->selected = list_last_entry(&m->entries, struct menu_entry, list);
repaint = 1;
break;
diff --git a/common/password.c b/common/password.c
index 9c1e54a359..111c139286 100644
--- a/common/password.c
+++ b/common/password.c
@@ -65,8 +65,8 @@ int password(unsigned char *passwd, size_t length, int flags, int timeout)
puts("\r\n");
return 0;
case CTL_CH('h'):
- case KEY_DEL7:
- case KEY_DEL:
+ case BB_KEY_DEL7:
+ case BB_KEY_DEL:
if (pos > 0) {
if (flags & STAR)
puts("\b \b");
diff --git a/common/startup.c b/common/startup.c
index 04f8cf06e3..ceb597b0eb 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -44,48 +44,6 @@
extern initcall_t __barebox_initcalls_start[], __barebox_early_initcalls_end[],
__barebox_initcalls_end[];
-#ifdef CONFIG_DEFAULT_ENVIRONMENT
-#include "barebox_default_env.h"
-
-static int register_default_env(void)
-{
- int ret;
- void *defaultenv;
-
- if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED)) {
- void *tmp = malloc(default_environment_size);
-
- if (!tmp)
- return -ENOMEM;
-
- memcpy(tmp, default_environment, default_environment_size);
-
- defaultenv = xzalloc(default_environment_uncompress_size);
-
- ret = uncompress(tmp, default_environment_size,
- NULL, NULL,
- defaultenv, NULL, uncompress_err_stdout);
-
- free(tmp);
-
- if (ret) {
- free(defaultenv);
- return ret;
- }
- } else {
- defaultenv = (void *)default_environment;
- }
-
-
- add_mem_device("defaultenv", (unsigned long)defaultenv,
- default_environment_uncompress_size,
- IORESOURCE_MEM_WRITEABLE);
- return 0;
-}
-
-device_initcall(register_default_env);
-#endif
-
#if defined CONFIG_FS_RAMFS && defined CONFIG_FS_DEVFS
static int mount_root(void)
{
@@ -129,7 +87,7 @@ void __noreturn start_barebox(void)
pr_err("no valid environment found on %s. "
"Using default environment\n",
default_environment_path);
- envfs_load("/dev/defaultenv", "/env", 0);
+ defaultenv_load("/env", 0);
}
}