diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-10-03 21:10:57 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-10-03 21:10:57 +0200 |
commit | 4517b5980f0772ba909e152ea289200bf1cf421f (patch) | |
tree | 0b5545ead92c40b76df47609fdb9549c846e9576 /common | |
parent | 3a9a4a4d705c17c46dfeba2010ba285c2b5a9320 (diff) | |
parent | 46bf132f15ec073c0a6d9abc30a516302888ed13 (diff) | |
download | barebox-4517b5980f0772ba909e152ea289200bf1cf421f.tar.gz barebox-4517b5980f0772ba909e152ea289200bf1cf421f.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 4 | ||||
-rw-r--r-- | common/Makefile | 1 | ||||
-rw-r--r-- | common/meminfo.c | 23 | ||||
-rw-r--r-- | common/startup.c | 21 |
4 files changed, 28 insertions, 21 deletions
diff --git a/common/Kconfig b/common/Kconfig index 93787839c4..0597c9cb62 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -96,6 +96,10 @@ config BANNER bool "display banner" default y +config MEMINFO + bool "display memory info" + default y + config ENVIRONMENT_VARIABLES bool "environment variables support" diff --git a/common/Makefile b/common/Makefile index df9f301234..68582b78e1 100644 --- a/common/Makefile +++ b/common/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_MALLOC_TLSF) += tlsf.o obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.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 diff --git a/common/meminfo.c b/common/meminfo.c new file mode 100644 index 0000000000..06fce5afb4 --- /dev/null +++ b/common/meminfo.c @@ -0,0 +1,23 @@ +#include <common.h> +#include <init.h> +#include <memory.h> +#include <asm-generic/memory_layout.h> + +static int display_meminfo(void) +{ + ulong mstart = mem_malloc_start(); + ulong mend = mem_malloc_end(); + ulong msize = mend - mstart + 1; + + debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext); + debug("bss segment: 0x%p -> 0x%p\n", __bss_start, __bss_stop); + printf("malloc space: 0x%08lx -> 0x%08lx (size %s)\n", + mstart, mend, size_human_readable(msize)); +#ifdef CONFIG_ARM + printf("stack space: 0x%08x -> 0x%08x (size %s)\n", + STACK_BASE, STACK_BASE + STACK_SIZE, + size_human_readable(STACK_SIZE)); +#endif + return 0; +} +late_initcall(display_meminfo); diff --git a/common/startup.c b/common/startup.c index abd1b774bd..e639d05cc7 100644 --- a/common/startup.c +++ b/common/startup.c @@ -33,34 +33,15 @@ #include <init.h> #include <command.h> #include <malloc.h> -#include <memory.h> #include <debug_ll.h> #include <fs.h> #include <linux/stat.h> #include <environment.h> -#include <asm-generic/memory_layout.h> #include <asm/sections.h> extern initcall_t __barebox_initcalls_start[], __barebox_early_initcalls_end[], __barebox_initcalls_end[]; -static void display_meminfo(void) -{ - ulong mstart = mem_malloc_start(); - ulong mend = mem_malloc_end(); - ulong msize = mend - mstart + 1; - - debug("barebox code: 0x%p -> 0x%p\n", _stext, _etext); - debug("bss segment: 0x%p -> 0x%p\n", __bss_start, __bss_stop); - printf("Malloc space: 0x%08lx -> 0x%08lx (size %s)\n", - mstart, mend, size_human_readable(msize)); -#ifdef CONFIG_ARM - printf("Stack space : 0x%08x -> 0x%08x (size %s)\n", - STACK_BASE, STACK_BASE + STACK_SIZE, - size_human_readable(STACK_SIZE)); -#endif -} - #ifdef CONFIG_DEFAULT_ENVIRONMENT #include <generated/barebox_default_env.h> @@ -128,8 +109,6 @@ void start_barebox (void) debug("initcalls done\n"); - display_meminfo(); - #ifdef CONFIG_ENV_HANDLING if (envfs_load(default_environment_path, "/env")) { #ifdef CONFIG_DEFAULT_ENVIRONMENT |