mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] image and bss size decrease
@ 2013-03-09 10:53 Sascha Hauer
  2013-03-09 10:53 ` [PATCH 01/10] mips: initialize malloc pool before start_barebox() Sascha Hauer
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

This series decreases the image size and bss size a bit. First
we make malloc available in all initcalls by moving the malloc
pool initialization before start_barebox().

We then decrease the image size by making some statically initialized
structs smaller. struct command has a struct list_head member
which can be removed by wrapping the static struct command into
a dynamically initialized one which contains the list_head. Also
the embedded struct device_d in struct bus_type is removed in
favour for a dynamically allocated one.

Also we make the bss smaller by allocating the FILE table and
the gpio_desc table dynamically. The bss size is may become
a problem on boards which run from SRAM. Here the malloc pool
is in the big SDRAM area, but the bss is in SRAM, so it makes
sense to move the big tables from bss to SDRAM by using malloc.

Sascha

----------------------------------------------------------------
Sascha Hauer (10):
      mips: initialize malloc pool before start_barebox()
      nios: initialize malloc pool before start_barebox()
      openrisc: initialize malloc pool before start_barebox()
      blackfin: initialize malloc pool before start_barebox()
      x86: initialize malloc pool before start_barebox()
      bus: Make struct device a pointer
      command: remove list_head from struct command
      command: remove statically initialized aliases
      fs: allocate FILE table dynamically
      gpio: allocate gpio_desc table dynamically

 arch/blackfin/cpu-bf561/start.S |  4 +--
 arch/blackfin/lib/board.c       |  6 ++--
 arch/mips/boot/main_entry.c     |  5 ++++
 arch/mips/lib/Makefile          |  1 -
 arch/mips/lib/memory.c          | 29 --------------------
 arch/nios2/cpu/start.S          |  4 +--
 arch/nios2/lib/board.c          |  8 ++----
 arch/openrisc/cpu/start.S       |  2 +-
 arch/openrisc/lib/board.c       |  7 ++---
 arch/x86/boot/main_entry.c      |  4 +--
 arch/x86/lib/memory.c           |  7 ++---
 commands/edit.c                 |  8 ++++--
 commands/help.c                 | 16 +++++++----
 commands/test.c                 |  8 ++++--
 common/command.c                | 61 +++++++++++++++++++++--------------------
 common/complete.c               | 12 ++++----
 common/hush.c                   |  7 +++--
 common/module.c                 |  2 +-
 drivers/base/bus.c              |  7 +++--
 drivers/base/driver.c           |  2 +-
 drivers/gpio/gpio.c             | 11 +++++++-
 fs/fs.c                         | 11 +++++---
 include/command.h               | 25 +++++++++++------
 include/driver.h                |  2 +-
 24 files changed, 126 insertions(+), 123 deletions(-)
 delete mode 100644 arch/mips/lib/memory.c

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 01/10] mips: initialize malloc pool before start_barebox()
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 10:53 ` [PATCH 02/10] nios: " Sascha Hauer
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/mips/boot/main_entry.c |  5 +++++
 arch/mips/lib/Makefile      |  1 -
 arch/mips/lib/memory.c      | 29 -----------------------------
 3 files changed, 5 insertions(+), 30 deletions(-)
 delete mode 100644 arch/mips/lib/memory.c

diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot/main_entry.c
index 0a33c45..015150b 100644
--- a/arch/mips/boot/main_entry.c
+++ b/arch/mips/boot/main_entry.c
@@ -18,6 +18,8 @@
 
 #include <common.h>
 #include <string.h>
+#include <memory.h>
+#include <asm-generic/memory_layout.h>
 #include <asm/sections.h>
 #include <asm/cpu-features.h>
 #include <asm/mipsregs.h>
@@ -90,5 +92,8 @@ void main_entry(void)
 
 	trap_init();
 
+	mem_malloc_init((void *)MALLOC_BASE,
+			(void *)(MALLOC_BASE + MALLOC_SIZE - 1));
+
 	start_barebox();
 }
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index a31046b..71c4f6b 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -3,7 +3,6 @@ obj-$(CONFIG_CSRC_R4K_LIB) += csrc-r4k.o
 obj-y += lshrdi3.o
 obj-y += ashldi3.o
 obj-y += ashrdi3.o
-obj-y += memory.o
 obj-y += cpu-probe.o
 obj-y += traps.o
 obj-y += genex.o
diff --git a/arch/mips/lib/memory.c b/arch/mips/lib/memory.c
deleted file mode 100644
index 003fc00..0000000
--- a/arch/mips/lib/memory.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2011 Antony Pavlov <antonynpavlov@gmail.com>
- *
- * This file is part of barebox.
- * See file CREDITS for list of people who contributed to this project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <common.h>
-#include <init.h>
-#include <memory.h>
-#include <asm-generic/memory_layout.h>
-
-static int mips_mem_malloc_init(void)
-{
-	mem_malloc_init((void *)MALLOC_BASE,
-			(void *)(MALLOC_BASE + MALLOC_SIZE - 1));
-	return 0;
-}
-core_initcall(mips_mem_malloc_init);
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 02/10] nios: initialize malloc pool before start_barebox()
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
  2013-03-09 10:53 ` [PATCH 01/10] mips: initialize malloc pool before start_barebox() Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 10:53 ` [PATCH 03/10] openrisc: " Sascha Hauer
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/nios2/cpu/start.S | 4 ++--
 arch/nios2/lib/board.c | 8 ++------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S
index 42520d7..41f65ff 100644
--- a/arch/nios2/cpu/start.S
+++ b/arch/nios2/cpu/start.S
@@ -150,8 +150,8 @@ _reloc:
 	/*
 	 * Call board_init -- never returns
 	 */
-	movhi   r4, %hi(start_barebox@h)
-	ori     r4, r4, %lo(start_barebox@h)
+	movhi   r4, %hi(nios_start_barebox@h)
+	ori     r4, r4, %lo(nios_start_barebox@h)
 	callr   r4
 
 	/* NEVER RETURNS -- but branch to the _start just
diff --git a/arch/nios2/lib/board.c b/arch/nios2/lib/board.c
index 624a4f8..7c4dc76 100644
--- a/arch/nios2/lib/board.c
+++ b/arch/nios2/lib/board.c
@@ -18,23 +18,19 @@
 
 #include <common.h>
 #include <malloc.h>
-#include <init.h>
 #include <memory.h>
 #include <asm-generic/memory_layout.h>
 #include <cache.h>
 
-int altera_mem_malloc_init(void)
+void __noreturn nios_start_barebox(void)
 {
 
 	mem_malloc_init((void *)(NIOS_SOPC_TEXT_BASE - MALLOC_SIZE),
 			(void *)(NIOS_SOPC_TEXT_BASE - 1));
 
-	return 0;
+	start_barebox();
 }
 
-core_initcall(altera_mem_malloc_init);
-
 void arch_shutdown(void)
 {
 }
-
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 03/10] openrisc: initialize malloc pool before start_barebox()
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
  2013-03-09 10:53 ` [PATCH 01/10] mips: initialize malloc pool before start_barebox() Sascha Hauer
  2013-03-09 10:53 ` [PATCH 02/10] nios: " Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 10:53 ` [PATCH 04/10] blackfin: " Sascha Hauer
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/openrisc/cpu/start.S | 2 +-
 arch/openrisc/lib/board.c | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/openrisc/cpu/start.S b/arch/openrisc/cpu/start.S
index 9109cce..269abc0 100644
--- a/arch/openrisc/cpu/start.S
+++ b/arch/openrisc/cpu/start.S
@@ -245,7 +245,7 @@ _start:
 	l.andi	r30, r0, 0
 	l.andi	r31, r0, 0
 
-	l.j	start_barebox
+	l.j	openrisc_start_barebox
 	 l.nop
 
 	.size	_start, .-_start
diff --git a/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c
index f62fbaf..98033b4 100644
--- a/arch/openrisc/lib/board.c
+++ b/arch/openrisc/lib/board.c
@@ -22,17 +22,14 @@
 #include <memory.h>
 #include <asm-generic/memory_layout.h>
 
-int openrisc_mem_malloc_init(void)
+void __noreturn openrisc_start_barebox(void)
 {
-
 	mem_malloc_init((void *)(OPENRISC_SOPC_TEXT_BASE - MALLOC_SIZE),
 			(void *)(OPENRISC_SOPC_TEXT_BASE - 1));
 
-	return 0;
+	start_barebox();
 }
 
-core_initcall(openrisc_mem_malloc_init);
-
 void arch_shutdown(void)
 {
 }
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 04/10] blackfin: initialize malloc pool before start_barebox()
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
                   ` (2 preceding siblings ...)
  2013-03-09 10:53 ` [PATCH 03/10] openrisc: " Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 10:53 ` [PATCH 05/10] x86: " Sascha Hauer
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/blackfin/cpu-bf561/start.S | 4 ++--
 arch/blackfin/lib/board.c       | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/blackfin/cpu-bf561/start.S b/arch/blackfin/cpu-bf561/start.S
index 2664588..96da6b5 100644
--- a/arch/blackfin/cpu-bf561/start.S
+++ b/arch/blackfin/cpu-bf561/start.S
@@ -329,8 +329,8 @@ _clear_bss_skip:
         [p0] = r0;
 #endif
 
-	p0.l = _start_barebox;
-	p0.h = _start_barebox;
+	p0.l = _blackfin_start_barebox;
+	p0.h = _blackfin_start_barebox;
 	jump (p0);
 
 reset_start:
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index e335d6c..88ad618 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -31,15 +31,13 @@
 #include <asm/cpu.h>
 #include <asm-generic/memory_layout.h>
 
-int blackfin_mem_malloc_init(void)
+void __noreturn blackfin_start_barebox(void)
 {
 	mem_malloc_init((void *)(MALLOC_BASE),
 			(void *)(MALLOC_BASE + MALLOC_SIZE - 1));
-	return 0;
+	start_barebox();
 }
 
-core_initcall(blackfin_mem_malloc_init);
-
 void arch_shutdown(void)
 {
 	icache_disable();
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 05/10] x86: initialize malloc pool before start_barebox()
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
                   ` (3 preceding siblings ...)
  2013-03-09 10:53 ` [PATCH 04/10] blackfin: " Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 10:53 ` [PATCH 06/10] bus: Make struct device a pointer Sascha Hauer
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/x86/boot/main_entry.c | 4 ++--
 arch/x86/lib/memory.c      | 7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/boot/main_entry.c b/arch/x86/boot/main_entry.c
index f7f4710..afb7e32 100644
--- a/arch/x86/boot/main_entry.c
+++ b/arch/x86/boot/main_entry.c
@@ -22,7 +22,7 @@
 #include <string.h>
 #include <asm/sections.h>
 
-extern void start_barebox(void);
+extern void x86_start_barebox(void);
 
 /**
  * Called plainly from assembler that switches from real to flat mode
@@ -33,5 +33,5 @@ void uboot_entry(void)
 {
 	/* clear the BSS first */
 	memset(__bss_start, 0x00, __bss_stop - __bss_start);
-	start_barebox();
+	x86_start_barebox();
 }
diff --git a/arch/x86/lib/memory.c b/arch/x86/lib/memory.c
index 43b6931..de0e5d9 100644
--- a/arch/x86/lib/memory.c
+++ b/arch/x86/lib/memory.c
@@ -21,6 +21,7 @@
  * @brief Memory management
  */
 
+#include <common.h>
 #include <init.h>
 #include <stdio.h>
 #include <memory.h>
@@ -36,7 +37,7 @@
  * - memory above 0x100000
  */
 
-static int x86_mem_malloc_init(void)
+int x86_start_barebox(void)
 {
 #ifdef CONFIG_MEMORY_LAYOUT_DEFAULT
 	unsigned long memory_size;
@@ -57,7 +58,5 @@ static int x86_mem_malloc_init(void)
 	mem_malloc_init((void *)MALLOC_BASE,
 			(void *)(MALLOC_BASE + MALLOC_SIZE - 1));
 #endif
-	return 0;
+	start_barebox();
 }
-
-core_initcall(x86_mem_malloc_init);
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 06/10] bus: Make struct device a pointer
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
                   ` (4 preceding siblings ...)
  2013-03-09 10:53 ` [PATCH 05/10] x86: " Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 10:53 ` [PATCH 07/10] command: remove list_head from struct command Sascha Hauer
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

struct bus_type contains an embedded struct device_d which is quite
a big structure. Dynamically allocate this instead to save the space
in the binary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/base/bus.c    | 7 ++++---
 drivers/base/driver.c | 2 +-
 include/driver.h      | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index e2204da..5251be6 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -30,10 +30,11 @@ int bus_register(struct bus_type *bus)
 	if (get_bus_by_name(bus->name))
 		return -EEXIST;
 
-	strcpy(bus->dev.name, bus->name);
-	bus->dev.id = DEVICE_ID_SINGLE;
+	bus->dev = xzalloc(sizeof(*bus->dev));
+	strcpy(bus->dev->name, bus->name);
+	bus->dev->id = DEVICE_ID_SINGLE;
 
-	ret = register_device(&bus->dev);
+	ret = register_device(bus->dev);
 	if (ret)
 		return ret;
 
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index fa30c68..487f478 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -135,7 +135,7 @@ int register_device(struct device_d *new_device)
 
 	if (new_device->bus) {
 		if (!new_device->parent)
-			new_device->parent = &new_device->bus->dev;
+			new_device->parent = new_device->bus->dev;
 
 		list_add_tail(&new_device->bus_list, &new_device->bus->device_list);
 
diff --git a/include/driver.h b/include/driver.h
index 46c56c0..2d107e1 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -368,7 +368,7 @@ struct bus_type {
 	int (*probe)(struct device_d *dev);
 	void (*remove)(struct device_d *dev);
 
-	struct device_d dev;
+	struct device_d *dev;
 
 	struct list_head list;
 	struct list_head device_list;
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 07/10] command: remove list_head from struct command
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
                   ` (5 preceding siblings ...)
  2013-03-09 10:53 ` [PATCH 06/10] bus: Make struct device a pointer Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 10:53 ` [PATCH 08/10] command: remove statically initialized aliases Sascha Hauer
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

struct command is statically initialized many times in barebox. The list_head
included in struct command is only needed during runtime, so embed a struct
command_entry into struct command. The static information is included in
struct command_entry whereas the list_head is in struct command. This saves
number of commands * sizeof(struct list_head) bytes from the binary image.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/help.c   |  8 ++++----
 common/command.c  | 41 +++++++++++++++++++++--------------------
 common/complete.c | 12 ++++++------
 common/module.c   |  2 +-
 include/command.h | 23 +++++++++++++++--------
 5 files changed, 47 insertions(+), 39 deletions(-)

diff --git a/commands/help.c b/commands/help.c
index a12d9c3..e3cd1f6 100644
--- a/commands/help.c
+++ b/commands/help.c
@@ -32,13 +32,13 @@ static int do_help(int argc, char *argv[])
 
 	if (argc == 1) {	/* show list of commands */
 		for_each_command(cmdtp)
-			if(strlen(cmdtp->name) > max_length)
-				max_length = strlen(cmdtp->name);
+			if (strlen(cmdtp->entry.name) > max_length)
+				max_length = strlen(cmdtp->entry.name);
 
 		for_each_command(cmdtp) {
-			if (!cmdtp->usage)
+			if (!cmdtp->entry.usage)
 				continue;
-			printf("%*s - %s\n", max_length, cmdtp->name, cmdtp->usage);
+			printf("%*s - %s\n", max_length, cmdtp->entry.name, cmdtp->entry.usage);
 		}
 		return 0;
 	}
diff --git a/common/command.c b/common/command.c
index 7f2b777..59087ef 100644
--- a/common/command.c
+++ b/common/command.c
@@ -38,17 +38,17 @@ void barebox_cmd_usage(struct command *cmdtp)
 {
 #ifdef	CONFIG_LONGHELP
 		/* found - print (long) help info */
-		if (cmdtp->help) {
-			puts (cmdtp->help);
+		if (cmdtp->entry.help) {
+			puts (cmdtp->entry.help);
 		} else {
-			puts (cmdtp->name);
+			puts (cmdtp->entry.name);
 			putchar (' ');
 			puts ("- No help available.\n");
 		}
 		putchar ('\n');
 #else	/* no long help available */
-		if (cmdtp->usage) {
-			puts (cmdtp->usage);
+		if (cmdtp->entry.usage) {
+			puts (cmdtp->entry.usage);
 			puts("\n");
 		}
 #endif	/* CONFIG_LONGHELP */
@@ -57,8 +57,8 @@ EXPORT_SYMBOL(barebox_cmd_usage);
 
 static int compare(struct list_head *a, struct list_head *b)
 {
-	char *na = (char*)list_entry(a, struct command, list)->name;
-	char *nb = (char*)list_entry(b, struct command, list)->name;
+	char *na = (char*)list_entry(a, struct command, list)->entry.name;
+	char *nb = (char*)list_entry(b, struct command, list)->entry.name;
 
 	return strcmp(na, nb);
 }
@@ -74,7 +74,7 @@ int execute_command(int argc, char **argv)
 	/* Look up command in command table */
 	if ((cmdtp = find_cmd(argv[0]))) {
 		/* OK - call function to do the command */
-		ret = cmdtp->cmd(argc, argv);
+		ret = cmdtp->entry.cmd(argc, argv);
 		if (ret == COMMAND_ERROR_USAGE) {
 			barebox_cmd_usage(cmdtp);
 			ret = COMMAND_ERROR;
@@ -93,31 +93,32 @@ int execute_command(int argc, char **argv)
 	return ret;
 }
 
-int register_command(struct command *cmd)
+int register_command(struct command_entry *entry)
 {
+	struct command *cmd = xzalloc(sizeof(*cmd));
+
+	memcpy(&cmd->entry, entry, sizeof(*entry));
+
 	/*
 	 * We do not check if the command already exists.
 	 * This allows us to overwrite a builtin command
 	 * with a module.
 	 */
 
-	debug("register command %s\n", cmd->name);
+	debug("register command %s\n", cmd->entry.name);
 
 	list_add_sort(&cmd->list, &command_list, compare);
 
-	if (cmd->aliases) {
-		char **aliases = (char**)cmd->aliases;
+	if (cmd->entry.aliases) {
+		char **aliases = (char**)cmd->entry.aliases;
 		while(*aliases) {
 			char *usage = "alias for ";
-			struct command *c = xzalloc(sizeof(struct command));
-
-			memcpy(c, cmd, sizeof(struct command));
+			struct command_entry *c = xzalloc(sizeof(*c));
 
+			memcpy(c, entry, sizeof(*entry));
 			c->name = *aliases;
-			c->usage = xmalloc(strlen(usage) + strlen(cmd->name) + 1);
-			sprintf((char*)c->usage, "%s%s", usage, cmd->name);
-
 			c->aliases = NULL;
+			c->usage = asprintf("%s%s", usage, cmd->entry.name);
 
 			register_command(c);
 
@@ -137,7 +138,7 @@ struct command *find_cmd (const char *cmd)
 	struct command *cmdtp;
 
 	for_each_command(cmdtp)
-		if (!strcmp(cmd, cmdtp->name))
+		if (!strcmp(cmd, cmdtp->entry.name))
 			return cmdtp;
 
 	return NULL;	/* not found or ambiguous command */
@@ -152,7 +153,7 @@ EXPORT_SYMBOL(find_cmd);
  */
 static int init_command_list(void)
 {
-	struct command *cmdtp;
+	struct command_entry *cmdtp;
 
 	for (cmdtp = &__barebox_cmd_start;
 			cmdtp != &__barebox_cmd_end;
diff --git a/common/complete.c b/common/complete.c
index 9206ef0..7b6d845 100644
--- a/common/complete.c
+++ b/common/complete.c
@@ -138,10 +138,10 @@ int command_complete(struct string_list *sl, char *instr)
 		instr = "";
 
 	for_each_command(cmdtp) {
-		if (strncmp(instr, cmdtp->name, strlen(instr)))
+		if (strncmp(instr, cmdtp->entry.name, strlen(instr)))
 			continue;
 
-		string_list_add_asprintf(sl, "%s ", cmdtp->name);
+		string_list_add_asprintf(sl, "%s ", cmdtp->entry.name);
 	}
 
 	return 0;
@@ -279,11 +279,11 @@ static char* cmd_complete_lookup(struct string_list *sl, char *instr)
 	char *res = NULL;
 
 	for_each_command(cmdtp) {
-		len = strlen(cmdtp->name);
-		if (!strncmp(instr, cmdtp->name, len) && instr[len] == ' ') {
+		len = strlen(cmdtp->entry.name);
+		if (!strncmp(instr, cmdtp->entry.name, len) && instr[len] == ' ') {
 			instr += len + 1;
-			if (cmdtp->complete) {
-				ret = cmdtp->complete(sl, instr);
+			if (cmdtp->entry.complete) {
+				ret = cmdtp->entry.complete(sl, instr);
 				res = instr;
 			}
 			goto end;
diff --git a/common/module.c b/common/module.c
index 109fe5c..639ee61 100644
--- a/common/module.c
+++ b/common/module.c
@@ -293,7 +293,7 @@ struct module * load_module(void *mod_image, unsigned long len)
 
 	cmdindex = find_sec(ehdr, sechdrs, secstrings, ".barebox_cmd");
 	if (cmdindex) {
-		struct command *cmd =(struct command *)sechdrs[cmdindex].sh_addr;
+		struct command_entry *cmd =(struct command_entry *)sechdrs[cmdindex].sh_addr;
 		for (i = 0; i < sechdrs[cmdindex].sh_size / sizeof(struct command); i++) {
 			register_command(cmd);
 			cmd++;
diff --git a/include/command.h b/include/command.h
index ffc722c..b774ae6 100644
--- a/include/command.h
+++ b/include/command.h
@@ -41,7 +41,7 @@ struct string_list;
 /*
  * Monitor Command Table
  */
-struct command {
+struct command_entry {
 	const char	*name;		/* Command Name			*/
 	const char	**aliases;
 					/* Implementation function	*/
@@ -49,9 +49,8 @@ struct command {
 	int		(*complete)(struct string_list *sl, char *instr);
 	const char	*usage;		/* Usage message	(short)	*/
 
-	struct list_head list;		/* List of commands		*/
 #ifdef	CONFIG_LONGHELP
-	const char	*help;		/* Help  message	(long)	*/
+	const char	*help;			/* Help  message	(long)	*/
 #endif
 }
 #ifdef __x86_64__
@@ -60,9 +59,17 @@ __attribute__((aligned(64)))
 #endif
 ;
 
-extern struct command __barebox_cmd_start;
-extern struct command __barebox_cmd_end;
+/*
+ * Monitor Command Table
+ */
+struct command {
+	struct command_entry entry;
+
+	struct list_head list;		/* List of commands		*/
+};
 
+extern struct command_entry __barebox_cmd_start;
+extern struct command_entry __barebox_cmd_end;
 
 /* common/command.c */
 struct command *find_cmd(const char *cmd);
@@ -80,8 +87,8 @@ void barebox_cmd_usage(struct command *cmdtp);
 #define Struct_Section  __attribute__ ((unused,section (".barebox_cmd")))
 
 #define BAREBOX_CMD_START(_name)							\
-extern const struct command __barebox_cmd_##_name;					\
-const struct command __barebox_cmd_##_name						\
+extern const struct command_entry __barebox_cmd_##_name;				\
+const struct command_entry __barebox_cmd_##_name					\
 	__attribute__ ((unused,section (".barebox_cmd_" __stringify(_name)))) = {	\
 	.name		= #_name,
 
@@ -110,6 +117,6 @@ static const __maybe_unused char cmd_##_name##_help[] =
 
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
-int register_command(struct command *);
+int register_command(struct command_entry *);
 
 #endif	/* __COMMAND_H */
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 08/10] command: remove statically initialized aliases
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
                   ` (6 preceding siblings ...)
  2013-03-09 10:53 ` [PATCH 07/10] command: remove list_head from struct command Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 10:53 ` [PATCH 09/10] fs: allocate FILE table dynamically Sascha Hauer
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

the aliases pointer occupies four bytes from struct command_entry, but
it is only used a few times. Create command aliases during runtime to
save a few bytes from the binary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/edit.c   |  8 ++++++--
 commands/help.c   |  8 ++++++--
 commands/test.c   |  8 ++++++--
 common/command.c  | 34 ++++++++++++++++++----------------
 common/hush.c     |  7 +++++--
 include/command.h |  2 +-
 6 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/commands/edit.c b/commands/edit.c
index 295d0a7..9083ac8 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -24,6 +24,7 @@
 #include <command.h>
 #include <malloc.h>
 #include <fs.h>
+#include <init.h>
 #include <linux/ctype.h>
 #include <fcntl.h>
 #include <readkey.h>
@@ -544,7 +545,11 @@ out:
 	return 0;
 }
 
-static const char *edit_aliases[] = { "sedit", NULL};
+static int edit_add_alias(void)	\
+{					\
+	return command_add_alias("edit", "sedit");
+}
+device_initcall(edit_add_alias);
 
 BAREBOX_CMD_HELP_START(edit)
 BAREBOX_CMD_HELP_USAGE("(s)edit <file>\n")
@@ -563,7 +568,6 @@ If called as sedit, the editor uses ansi codes to scroll the screen.
 
 BAREBOX_CMD_START(edit)
 	.cmd		= do_edit,
-	.aliases	= edit_aliases,
 	.usage		= "Usage: (s)edit <file>",
 	BAREBOX_CMD_HELP(cmd_edit_help)
 BAREBOX_CMD_END
diff --git a/commands/help.c b/commands/help.c
index e3cd1f6..3c25b26 100644
--- a/commands/help.c
+++ b/commands/help.c
@@ -18,6 +18,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <command.h>
 #include <complete.h>
 
@@ -63,11 +64,14 @@ static const __maybe_unused char cmd_help_help[] =
 "To get detailed help information for specific commands you can type\n"
 "'help' with one or more command names as arguments.\n";
 
-static const char *help_aliases[] = { "?", NULL};
+static int help_add_alias(void)	\
+{					\
+	return command_add_alias("help", "?");
+}
+device_initcall(help_add_alias);
 
 BAREBOX_CMD_START(help)
 	.cmd		= do_help,
-	.aliases	= help_aliases,
 	.usage		= "print online help",
 	BAREBOX_CMD_HELP(cmd_help_help)
 	BAREBOX_CMD_COMPLETE(command_complete)
diff --git a/commands/test.c b/commands/test.c
index b3cd164..c0a391b 100644
--- a/commands/test.c
+++ b/commands/test.c
@@ -23,6 +23,7 @@
 #include <command.h>
 #include <fs.h>
 #include <linux/stat.h>
+#include <init.h>
 
 typedef enum {
 	OPT_EQUAL,
@@ -224,7 +225,11 @@ out:
 	return expr;
 }
 
-static const char *test_aliases[] = { "[", NULL};
+static int test_add_alias(void)	\
+{					\
+	return command_add_alias("test", "[");
+}
+device_initcall(test_add_alias);
 
 static const __maybe_unused char cmd_test_help[] =
 "Usage: test [OPTIONS]\n"
@@ -234,7 +239,6 @@ static const __maybe_unused char cmd_test_help[] =
 static const __maybe_unused char cmd_test_usage[] = "minimal test like /bin/sh";
 
 BAREBOX_CMD_START(test)
-	.aliases	= test_aliases,
 	.cmd		= do_test,
 	.usage		= cmd_test_usage,
 	BAREBOX_CMD_HELP(cmd_test_help)
diff --git a/common/command.c b/common/command.c
index 59087ef..31fb27f 100644
--- a/common/command.c
+++ b/common/command.c
@@ -30,6 +30,7 @@
 #include <init.h>
 #include <complete.h>
 #include <getopt.h>
+#include <errno.h>
 
 LIST_HEAD(command_list);
 EXPORT_SYMBOL(command_list);
@@ -109,26 +110,28 @@ int register_command(struct command_entry *entry)
 
 	list_add_sort(&cmd->list, &command_list, compare);
 
-	if (cmd->entry.aliases) {
-		char **aliases = (char**)cmd->entry.aliases;
-		while(*aliases) {
-			char *usage = "alias for ";
-			struct command_entry *c = xzalloc(sizeof(*c));
+	return 0;
+}
+EXPORT_SYMBOL(register_command);
 
-			memcpy(c, entry, sizeof(*entry));
-			c->name = *aliases;
-			c->aliases = NULL;
-			c->usage = asprintf("%s%s", usage, cmd->entry.name);
+int command_add_alias(const char *command, const char *alias)
+{
+	struct command_entry *c;
+	struct command *cmd = find_cmd(command);
 
-			register_command(c);
+	if (!cmd)
+		return -ENODEV;
 
-			aliases++;
-		}
-	}
+	c = xzalloc(sizeof(*c));
+
+	memcpy(c, &cmd->entry, sizeof(*c));
+	c->name = strdup(alias);
+	c->usage = asprintf("alias for %s", cmd->entry.name);
+
+	register_command(c);
 
 	return 0;
 }
-EXPORT_SYMBOL(register_command);
 
 /*
  * find command table entry for a command
@@ -163,5 +166,4 @@ static int init_command_list(void)
 	return 0;
 }
 
-late_initcall(init_command_list);
-
+pure_initcall(init_command_list);
diff --git a/common/hush.c b/common/hush.c
index b5e111a..d14e0e3 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1901,7 +1901,11 @@ static int do_source(int argc, char *argv[])
 	return ret;
 }
 
-static const char *source_aliases[] = { ".", NULL};
+static int source_add_alias(void)	\
+{					\
+	return command_add_alias("source", ".");
+}
+device_initcall(source_add_alias);
 
 static const __maybe_unused char cmd_source_help[] =
 "Usage: .  filename [arguments]\n"
@@ -1915,7 +1919,6 @@ static const __maybe_unused char cmd_source_usage[] =
 "execute shell script in current shell environment";
 
 BAREBOX_CMD_START(source)
-	.aliases	= source_aliases,
 	.cmd		= do_source,
 	.usage		= cmd_source_usage,
 	BAREBOX_CMD_HELP(cmd_source_help)
diff --git a/include/command.h b/include/command.h
index b774ae6..3225c86 100644
--- a/include/command.h
+++ b/include/command.h
@@ -43,7 +43,6 @@ struct string_list;
  */
 struct command_entry {
 	const char	*name;		/* Command Name			*/
-	const char	**aliases;
 					/* Implementation function	*/
 	int		(*cmd)(int, char *[]);
 	int		(*complete)(struct string_list *sl, char *instr);
@@ -75,6 +74,7 @@ extern struct command_entry __barebox_cmd_end;
 struct command *find_cmd(const char *cmd);
 int execute_command(int argc, char **argv);
 void barebox_cmd_usage(struct command *cmdtp);
+int command_add_alias(const char *command, const char *alias);
 
 #define COMMAND_SUCCESS		0
 #define COMMAND_ERROR		1
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 09/10] fs: allocate FILE table dynamically
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
                   ` (7 preceding siblings ...)
  2013-03-09 10:53 ` [PATCH 08/10] command: remove statically initialized aliases Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 10:53 ` [PATCH 10/10] gpio: allocate gpio_desc " Sascha Hauer
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

Some systems are runnignfrom a very limited SRAM, but have a huge
malloc space in SDRAM. The bss normally is in SRAM, so we should
avoid having big structures there. The FILE table is 5120 bytes
big, so allocate it dynamically instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/fs.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 6346112..7e2fb78 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -119,14 +119,19 @@ EXPORT_SYMBOL(mkmodestr);
 
 static char *cwd;
 
-static int init_cwd(void)
+static FILE *files;
+
+static int init_fs(void)
 {
 	cwd = xzalloc(PATH_MAX);
 	*cwd = '/';
+
+	files = xzalloc(sizeof(FILE) * MAX_FILES);
+
 	return 0;
 }
 
-postcore_initcall(init_cwd);
+postcore_initcall(init_fs);
 
 char *normalise_link(const char *pathname, const char *symlink)
 {
@@ -268,8 +273,6 @@ char *get_mounted_path(const char *path)
 	return fdev->path;
 }
 
-static FILE files[MAX_FILES];
-
 static FILE *get_file(void)
 {
 	int i;
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 10/10] gpio: allocate gpio_desc table dynamically
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
                   ` (8 preceding siblings ...)
  2013-03-09 10:53 ` [PATCH 09/10] fs: allocate FILE table dynamically Sascha Hauer
@ 2013-03-09 10:53 ` Sascha Hauer
  2013-03-09 18:38 ` [PATCH] image and bss size decrease Jean-Christophe PLAGNIOL-VILLARD
  2013-03-11  9:08 ` Juergen Beisert
  11 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-09 10:53 UTC (permalink / raw)
  To: barebox

Some systems are runnignfrom a very limited SRAM, but have a huge
malloc space in SDRAM. The bss normally is in SRAM, so we should
avoid having big structures there. The gpio_desc table is 3072 bytes
big, so allocate it dynamically instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/gpio/gpio.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpio.c
index d37f5a0..9d081c2 100644
--- a/drivers/gpio/gpio.c
+++ b/drivers/gpio/gpio.c
@@ -1,3 +1,4 @@
+#include <init.h>
 #include <common.h>
 #include <command.h>
 #include <complete.h>
@@ -13,7 +14,15 @@ struct gpio_info {
 	char *label;
 };
 
-static struct gpio_info gpio_desc[ARCH_NR_GPIOS];
+static struct gpio_info *gpio_desc;
+
+static int gpio_desc_alloc(void)
+{
+	gpio_desc = xzalloc(sizeof(struct gpio_info) * ARCH_NR_GPIOS);
+
+	return 0;
+}
+pure_initcall(gpio_desc_alloc);
 
 static int gpio_ensure_requested(struct gpio_info *gi, int gpio)
 {
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] image and bss size decrease
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
                   ` (9 preceding siblings ...)
  2013-03-09 10:53 ` [PATCH 10/10] gpio: allocate gpio_desc " Sascha Hauer
@ 2013-03-09 18:38 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-03-10 10:02   ` Sascha Hauer
  2013-03-11  9:08 ` Juergen Beisert
  11 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-03-09 18:38 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox


On Mar 9, 2013, at 6:53 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:

> This series decreases the image size and bss size a bit. First
> we make malloc available in all initcalls by moving the malloc
> pool initialization before start_barebox().
> 
> We then decrease the image size by making some statically initialized
> structs smaller. struct command has a struct list_head member
> which can be removed by wrapping the static struct command into
> a dynamically initialized one which contains the list_head. Also
> the embedded struct device_d in struct bus_type is removed in
> favour for a dynamically allocated one.
> 
> Also we make the bss smaller by allocating the FILE table and
> the gpio_desc table dynamically. The bss size is may become
> a problem on boards which run from SRAM. Here the malloc pool
> is in the big SDRAM area, but the bss is in SRAM, so it makes
> sense to move the big tables from bss to SDRAM by using malloc.
> 

How much less

IIRC I try this too but with PBL it's bigger

Best Regards,
J.
> Sascha
> 
> ----------------------------------------------------------------
> Sascha Hauer (10):
>      mips: initialize malloc pool before start_barebox()
>      nios: initialize malloc pool before start_barebox()
>      openrisc: initialize malloc pool before start_barebox()
>      blackfin: initialize malloc pool before start_barebox()
>      x86: initialize malloc pool before start_barebox()
>      bus: Make struct device a pointer
>      command: remove list_head from struct command
>      command: remove statically initialized aliases
>      fs: allocate FILE table dynamically
>      gpio: allocate gpio_desc table dynamically
> 
> arch/blackfin/cpu-bf561/start.S |  4 +--
> arch/blackfin/lib/board.c       |  6 ++--
> arch/mips/boot/main_entry.c     |  5 ++++
> arch/mips/lib/Makefile          |  1 -
> arch/mips/lib/memory.c          | 29 --------------------
> arch/nios2/cpu/start.S          |  4 +--
> arch/nios2/lib/board.c          |  8 ++----
> arch/openrisc/cpu/start.S       |  2 +-
> arch/openrisc/lib/board.c       |  7 ++---
> arch/x86/boot/main_entry.c      |  4 +--
> arch/x86/lib/memory.c           |  7 ++---
> commands/edit.c                 |  8 ++++--
> commands/help.c                 | 16 +++++++----
> commands/test.c                 |  8 ++++--
> common/command.c                | 61 +++++++++++++++++++++--------------------
> common/complete.c               | 12 ++++----
> common/hush.c                   |  7 +++--
> common/module.c                 |  2 +-
> drivers/base/bus.c              |  7 +++--
> drivers/base/driver.c           |  2 +-
> drivers/gpio/gpio.c             | 11 +++++++-
> fs/fs.c                         | 11 +++++---
> include/command.h               | 25 +++++++++++------
> include/driver.h                |  2 +-
> 24 files changed, 126 insertions(+), 123 deletions(-)
> delete mode 100644 arch/mips/lib/memory.c
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] image and bss size decrease
  2013-03-09 18:38 ` [PATCH] image and bss size decrease Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-10 10:02   ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-03-10 10:02 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sun, Mar 10, 2013 at 02:38:06AM +0800, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 
> On Mar 9, 2013, at 6:53 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> > This series decreases the image size and bss size a bit. First
> > we make malloc available in all initcalls by moving the malloc
> > pool initialization before start_barebox().
> > 
> > We then decrease the image size by making some statically initialized
> > structs smaller. struct command has a struct list_head member
> > which can be removed by wrapping the static struct command into
> > a dynamically initialized one which contains the list_head. Also
> > the embedded struct device_d in struct bus_type is removed in
> > favour for a dynamically allocated one.
> > 
> > Also we make the bss smaller by allocating the FILE table and
> > the gpio_desc table dynamically. The bss size is may become
> > a problem on boards which run from SRAM. Here the malloc pool
> > is in the big SDRAM area, but the bss is in SRAM, so it makes
> > sense to move the big tables from bss to SDRAM by using malloc.
> > 
> 
> How much less
> 
> IIRC I try this too but with PBL it's bigger

With PBL it's still smaller, but on a pcm038 defconfig it's only 18
bytes, so this is not really worth the effort. Decreasing the bss
size still makes sense though.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] image and bss size decrease
  2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
                   ` (10 preceding siblings ...)
  2013-03-09 18:38 ` [PATCH] image and bss size decrease Jean-Christophe PLAGNIOL-VILLARD
@ 2013-03-11  9:08 ` Juergen Beisert
  11 siblings, 0 replies; 14+ messages in thread
From: Juergen Beisert @ 2013-03-11  9:08 UTC (permalink / raw)
  To: barebox

Hi Sascha,

Sascha Hauer wrote:
> [...]
> Also we make the bss smaller by allocating the FILE table and
> the gpio_desc table dynamically. The bss size is may become
> a problem on boards which run from SRAM. Here the malloc pool
> is in the big SDRAM area, but the bss is in SRAM, so it makes
> sense to move the big tables from bss to SDRAM by using malloc.

It would also be possible to instruct the linker to locate the BSS in the big 
SDRAM area. But that might interfere with very running early code using 
variables in BSS while the SDRAM isn't up and running yet.

jbe

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-03-11  9:10 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-09 10:53 [PATCH] image and bss size decrease Sascha Hauer
2013-03-09 10:53 ` [PATCH 01/10] mips: initialize malloc pool before start_barebox() Sascha Hauer
2013-03-09 10:53 ` [PATCH 02/10] nios: " Sascha Hauer
2013-03-09 10:53 ` [PATCH 03/10] openrisc: " Sascha Hauer
2013-03-09 10:53 ` [PATCH 04/10] blackfin: " Sascha Hauer
2013-03-09 10:53 ` [PATCH 05/10] x86: " Sascha Hauer
2013-03-09 10:53 ` [PATCH 06/10] bus: Make struct device a pointer Sascha Hauer
2013-03-09 10:53 ` [PATCH 07/10] command: remove list_head from struct command Sascha Hauer
2013-03-09 10:53 ` [PATCH 08/10] command: remove statically initialized aliases Sascha Hauer
2013-03-09 10:53 ` [PATCH 09/10] fs: allocate FILE table dynamically Sascha Hauer
2013-03-09 10:53 ` [PATCH 10/10] gpio: allocate gpio_desc " Sascha Hauer
2013-03-09 18:38 ` [PATCH] image and bss size decrease Jean-Christophe PLAGNIOL-VILLARD
2013-03-10 10:02   ` Sascha Hauer
2013-03-11  9:08 ` Juergen Beisert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox