Skip to contentSkip to conversation

code size reduction for xloader

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 3 participants 11 messages Jan 11, 2012 – Jan 12, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover code size reduction for xloader

HI,

this patch serie wrok on disble non needed code to optimize the size of barebox specially in the case of non interactive version suc as xloader for TI and late bootstrap for at91

tis will also iclude a sync of the kconfig need for this

The following changes since commit 21d0fac1382cbe20dfc95c0a400350632f28cbdb:

at91: add Calao TNY-A9260/TNY-A9263/TNY-A9G20 (2012-01-11 09:41:25 +0100)

are available in the git repository at:
git://uboot.jcrosoft.org/barebox.git size-optimisation

Jean-Christophe PLAGNIOL-VILLARD (6):
banner: add config to disable it
uncompress: add config to disable it
filetype: add config to disable it
kconfig: sync to linux 3.2-rc4
param: add config to disable it
driver: switch driver_d name to const char*

 Makefile                                 |    3 +-
 commands/Kconfig                         |    3 +
 common/Kconfig                           |    9 +
 common/Makefile                          |    4 +-
 drivers/mtd/core.c                       |   18 +-
 include/common.h                         |    4 +
 include/driver.h                         |    2 +-
 include/linux/kconfig.h                  |   32 +
 include/param.h                          |   53 +
 include/usb/usb.h                        |    2 +-
 lib/Kconfig                              |    9 +
 lib/Makefile                             |    4 +-
 lib/lzo/Kconfig                          |    2 +-
 scripts/kconfig/Makefile                 |  113 +-
 scripts/kconfig/conf.c                   |   50 +-
 scripts/kconfig/confdata.c               |  332 +++--
 scripts/kconfig/expr.c                   |   13 +-
 scripts/kconfig/expr.h                   |    7 -
 scripts/kconfig/gconf.c                  |   50 +-
 scripts/kconfig/kxgettext.c              |    1 -
 scripts/kconfig/lkc.h                    |   18 +-
 scripts/kconfig/lkc_proto.h              |    1 +
 scripts/kconfig/lxdialog/BIG.FAT.WARNING |    2 +-
 scripts/kconfig/lxdialog/textbox.c       |    3 +-
 scripts/kconfig/mconf.c                  |   86 +-
 scripts/kconfig/menu.c                   |   18 +-
 scripts/kconfig/nconf.c                  |   65 +-
 scripts/kconfig/nconf.gui.c              |   59 +-
 scripts/kconfig/nconf.h                  |    2 +-
 scripts/kconfig/qconf.cc                 |   22 +-
 scripts/kconfig/qconf.h                  |    2 +-
 scripts/kconfig/streamline_config.pl     |   38 +-
 scripts/kconfig/symbol.c                 |   47 +-
 scripts/kconfig/util.c                   |    2 +
 scripts/kconfig/zconf.gperf              |    2 +-
 scripts/kconfig/zconf.hash.c_shipped     |  273 ++--
 scripts/kconfig/zconf.l                  |   44 +-
 scripts/kconfig/zconf.lex.c              | 2420 ++++++++++++++++++++++++++++++
 scripts/kconfig/zconf.lex.c_shipped      | 2420 ++++++++++++++++++++++++++++++
 scripts/kconfig/zconf.tab.c_shipped      |   69 +-
 scripts/kconfig/zconf.y                  |   19 +-
 41 files changed, 5722 insertions(+), 601 deletions(-)
 create mode 100644 include/linux/kconfig.h
 create mode 100644 scripts/kconfig/zconf.lex.c
 create mode 100644 scripts/kconfig/zconf.lex.c_shipped

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH 1/6 banner: add config to disable it

this will allow to save 144 bytes

---
 commands/Kconfig |    1 +
 common/Kconfig   |    4 ++++
 common/Makefile  |    2 +-
 include/common.h |    4 ++++
 4 files changed, 10 insertions(+), 1 deletions(-)
commands/Kconfig +1 -0
index 6f9ccb8..1d080e3 100644
@@ -420,6 +420,7 @@ config CMD_REGINFO
 config CMD_VERSION
 	tristate
 	default y
+	depends on BANNER
 	prompt "version"
 
 config CMD_HELP
common/Kconfig +4 -0
index ca4f099..d184d9e 100644
@@ -74,6 +74,10 @@ config LOCALVERSION_AUTO
 config BOARDINFO
 	string
 
+config BANNER
+	bool "display banner"
+	default y
+
 config ENVIRONMENT_VARIABLES
 	bool "environment variables support"
 
common/Makefile +1 -1
index d1132c3..eaf74a6 100644
@@ -17,7 +17,7 @@ obj-$(CONFIG_MALLOC_TLSF) += tlsf_malloc.o
 obj-$(CONFIG_MALLOC_TLSF) += tlsf.o
 obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o
 obj-y += clock.o
-obj-y += version.o
+obj-$(CONFIG_BANNER) += version.o
 obj-$(CONFIG_COMMAND_SUPPORT) += command.o
 obj-$(CONFIG_CONSOLE_FULL) += console.o
 obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
include/common.h +4 -0
index 2f37dd8..a89b3bd 100644
@@ -198,7 +198,11 @@ int run_shell(void);
 int memory_display(char *addr, ulong offs, ulong nbytes, int size);
 
 extern const char version_string[];
+#ifdef CONFIG_BANNER
 void barebox_banner(void);
+#else
+static inline void barebox_banner(void) {}
+#endif
 
 #define IOMEM(addr)	((void __force __iomem *)(addr))
 
Signature · 7 lines
1.7.7


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/6 uncompress: add config to disable it

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 commands/Kconfig |    1 +
 lib/Kconfig      |    5 +++++
 lib/Makefile     |    2 +-
 lib/lzo/Kconfig  |    2 +-
 4 files changed, 8 insertions(+), 2 deletions(-)
commands/Kconfig +1 -0
index 1d080e3..b003786 100644
@@ -310,6 +310,7 @@ config CMD_BOOTM
 	tristate
 	default y
 	select CRC32
+	select UNCOMPRESS
 	prompt "bootm"
 
 config CMD_BOOTM_SHOW_TYPE
lib/Kconfig +5 -0
index 3339a9a..0bbd206 100644
@@ -1,9 +1,14 @@
 menu "Library routines"
+config UNCOMPRESS
+	bool
+
 config ZLIB
 	bool "include gzip uncompression support"
+	select UNCOMPRESS
 
 config BZLIB
 	bool "include bzip2 uncompression support"
+	select UNCOMPRESS
 
 config GENERIC_FIND_NEXT_BIT
 	def_bool n
lib/Makefile +1 -1
index 7799e69..c273c58 100644
@@ -30,6 +30,6 @@ obj-y			+= show_progress.o
 obj-$(CONFIG_LZO_DECOMPRESS)		+= decompress_unlzo.o
 obj-$(CONFIG_PROCESS_ESCAPE_SEQUENCE)	+= process_escape_sequence.o
 obj-$(CONFIG_FDT)	+= fdt/
-obj-y			+= uncompress.o
+obj-$(CONFIG_UNCOMPRESS)	+= uncompress.o
 obj-$(CONFIG_BCH)	+= bch.o
 obj-$(CONFIG_BITREV)	+= bitrev.o
lib/lzo/Kconfig +1 -1
index 03c3350..9276b21 100644
@@ -1,6 +1,6 @@
 config LZO_DECOMPRESS
 	bool "include lzo uncompression support"
-	bool
+	select UNCOMPRESS
 
 config LZO_COMPRESS
 	bool
Signature · 7 lines
1.7.7


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/6 filetype: add config to disable it

In reply to Jean-Christophe PLAGNIOL-VILLARD

remove 160 bytes

---
 commands/Kconfig |    1 +
 common/Kconfig   |    3 +++
 common/Makefile  |    2 +-
 lib/Kconfig      |    1 +
 4 files changed, 6 insertions(+), 1 deletions(-)
commands/Kconfig +1 -0
index b003786..fad3281 100644
@@ -311,6 +311,7 @@ config CMD_BOOTM
 	default y
 	select CRC32
 	select UNCOMPRESS
+	select FILETYPE
 	prompt "bootm"
 
 config CMD_BOOTM_SHOW_TYPE
common/Kconfig +3 -0
index d184d9e..20e4050 100644
@@ -40,6 +40,9 @@ config BLOCK_WRITE
 config HAVE_NOSHELL
 	bool
 
+config FILETYPE
+	bool
+
 menu "General Settings              "
 
 config LOCALVERSION
common/Makefile +1 -1
index eaf74a6..76fe407 100644
@@ -28,7 +28,7 @@ obj-$(CONFIG_CMD_BOOTM) += uimage.o
 obj-y += startup.o
 obj-y += misc.o
 obj-y += memsize.o
-obj-y += filetype.o
+obj-$(CONFIG_FILETYPE) += filetype.o
 obj-y += resource.o
 obj-$(CONFIG_MENU) += menu.o
 obj-$(CONFIG_PASSWORD) += password.o
lib/Kconfig +1 -0
index 0bbd206..6b4063d 100644
@@ -1,6 +1,7 @@
 menu "Library routines"
 config UNCOMPRESS
 	bool
+	select FILETYPE
 
 config ZLIB
 	bool "include gzip uncompression support"
Signature · 7 lines
1.7.7


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 4/6 kconfig: sync to linux 3.2-rc4

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 Makefile                                 |    3 +-
 include/linux/kconfig.h                  |   32 +
 scripts/kconfig/Makefile                 |  113 +-
 scripts/kconfig/conf.c                   |   50 +-
 scripts/kconfig/confdata.c               |  332 +++--
 scripts/kconfig/expr.c                   |   13 +-
 scripts/kconfig/expr.h                   |    7 -
 scripts/kconfig/gconf.c                  |   50 +-
 scripts/kconfig/kxgettext.c              |    1 -
 scripts/kconfig/lkc.h                    |   18 +-
 scripts/kconfig/lkc_proto.h              |    1 +
 scripts/kconfig/lxdialog/BIG.FAT.WARNING |    2 +-
 scripts/kconfig/lxdialog/textbox.c       |    3 +-
 scripts/kconfig/mconf.c                  |   86 +-
 scripts/kconfig/menu.c                   |   18 +-
 scripts/kconfig/nconf.c                  |   65 +-
 scripts/kconfig/nconf.gui.c              |   59 +-
 scripts/kconfig/nconf.h                  |    2 +-
 scripts/kconfig/qconf.cc                 |   22 +-
 scripts/kconfig/qconf.h                  |    2 +-
 scripts/kconfig/streamline_config.pl     |   38 +-
 scripts/kconfig/symbol.c                 |   47 +-
 scripts/kconfig/util.c                   |    2 +
 scripts/kconfig/zconf.gperf              |    2 +-
 scripts/kconfig/zconf.hash.c_shipped     |  273 ++--
 scripts/kconfig/zconf.l                  |   44 +-
 scripts/kconfig/zconf.lex.c              | 2420 ++++++++++++++++++++++++++++++
 scripts/kconfig/zconf.lex.c_shipped      | 2420 ++++++++++++++++++++++++++++++
 scripts/kconfig/zconf.tab.c_shipped      |   69 +-
 scripts/kconfig/zconf.y                  |   19 +-
 30 files changed, 5627 insertions(+), 586 deletions(-)
 create mode 100644 include/linux/kconfig.h
 create mode 100644 scripts/kconfig/zconf.lex.c
 create mode 100644 scripts/kconfig/zconf.lex.c_shipped

http://git.jcrosoft.org/git?p=barebox.git;a=commitdiff;h=18e18dd13b5d756d9ac32458a7982d25056328fb;hp=507319e13bd5e0ad13138970e90e8426d08f5817

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw

PATCH 5/6 param: add config to disable it

In reply to Jean-Christophe PLAGNIOL-VILLARD

this will allow to save 992 Bytes for TI xlaoder or AT91 bootstrap

---
 common/Kconfig     |    2 +
 drivers/mtd/core.c |   18 +++++++++-------
 include/param.h    |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/Kconfig        |    3 ++
 lib/Makefile       |    2 +-
 5 files changed, 69 insertions(+), 9 deletions(-)
common/Kconfig +2 -0
index 20e4050..382e591 100644
@@ -258,6 +258,7 @@ choice
 		bool "hush parser"
 		select ENVIRONMENT_VARIABLES
 		select COMMAND_SUPPORT
+		select PARAMETER
 		help
 		  Enable hush support. This is the most advanced shell available
 		  for barebox.
@@ -266,6 +267,7 @@ choice
 		bool "Simple parser"
 		select ENVIRONMENT_VARIABLES
 		select COMMAND_SUPPORT
+		select PARAMETER
 		help
 		  simple shell. No if/then, no return values from commands, no loops
 
drivers/mtd/core.c +10 -8
index f25863d..491cc1f 100644
@@ -204,14 +204,16 @@ int add_mtd_device(struct mtd_info *mtd, char *devname)
 	mtd->cdev.dev = &mtd->class_dev;
 	mtd->cdev.mtd = mtd;
 
-	sprintf(str, "%u", mtd->size);
-	dev_add_param_fixed(&mtd->class_dev, "size", str);
-	sprintf(str, "%u", mtd->erasesize);
-	dev_add_param_fixed(&mtd->class_dev, "erasesize", str);
-	sprintf(str, "%u", mtd->writesize);
-	dev_add_param_fixed(&mtd->class_dev, "writesize", str);
-	sprintf(str, "%u", mtd->oobsize);
-	dev_add_param_fixed(&mtd->class_dev, "oobsize", str);
+	if (IS_ENABLED(CONFIG_PARAMETER)) {
+		sprintf(str, "%u", mtd->size);
+		dev_add_param_fixed(&mtd->class_dev, "size", str);
+		sprintf(str, "%u", mtd->erasesize);
+		dev_add_param_fixed(&mtd->class_dev, "erasesize", str);
+		sprintf(str, "%u", mtd->writesize);
+		dev_add_param_fixed(&mtd->class_dev, "writesize", str);
+		sprintf(str, "%u", mtd->oobsize);
+		dev_add_param_fixed(&mtd->class_dev, "oobsize", str);
+	}
 
 	devfs_create(&mtd->cdev);
 
include/param.h +53 -0

65 lines not on this page · raw message

lib/Kconfig +3 -0
index 6b4063d..f886e6e 100644
@@ -1,4 +1,7 @@
 menu "Library routines"
+config PARAMETER
+	bool
+
 config UNCOMPRESS
 	bool
 	select FILETYPE
lib/Makefile +1 -1
index c273c58..01a01b5 100644
@@ -5,7 +5,7 @@ obj-y			+= string.o
 obj-y			+= vsprintf.o
 obj-y			+= div64.o
 obj-y			+= misc.o
-obj-y			+= parameter.o
+obj-$(CONFIG_PARAMETER)	+= parameter.o
 obj-y			+= xfuncs.o
 obj-y			+= getopt.o
 obj-y 			+= readkey.o
Signature · 7 lines
1.7.7


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH 6/6 driver: switch driver_d name to const char*

In reply to Jean-Christophe PLAGNIOL-VILLARD

this will allow to save 200 bytes on a9g20 and 180 bytes on ti xlaoder

---
 include/driver.h  |    2 +-
 include/usb/usb.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/driver.h +1 -1
index 1751d3c..1b8b16d 100644
@@ -105,7 +105,7 @@ struct device_d {
 struct driver_d {
 	/*! The name of this driver. Used to match to
 	 * the corresponding device. */
-	char name[MAX_DRIVER_NAME];
+	const char *name;
 
 	struct list_head list;
 
include/usb/usb.h +1 -1
index 08fd1a1..a61a008 100644
@@ -187,7 +187,7 @@ struct usb_device {
 struct usb_device_id;
 
 struct usb_driver {
-	char	*name;
+	const char	*name;
 	int     (*probe) (struct usb_device *, const struct usb_device_id *);
 	void    (*disconnect)(struct usb_device *);
 
Signature · 7 lines
1.7.7


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD

Hi J,

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD

HI,

this patch serie wrok on disble non needed code to optimize the size of barebox specially in the case of non interactive version suc as xloader for TI and late bootstrap for at91

tis will also iclude a sync of the kconfig need for this

Quoted 6 lines

The following changes since commit 21d0fac1382cbe20dfc95c0a400350632f28cbdb:

at91: add Calao TNY-A9260/TNY-A9263/TNY-A9G20 (2012-01-11 09:41:25 +0100)

are available in the git repository at:
git://uboot.jcrosoft.org/barebox.git size-optimisation

Your git server does not work for me. A git pull just stalls. The web frontend works well though.

Can you check this?

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw
Quoted 16 lines · Sascha Hauer

Hi J,

Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD

HI,

this patch serie wrok on disble non needed code to optimize the size of barebox specially in the case of non interactive version suc as xloader for TI and late bootstrap for at91

tis will also iclude a sync of the kconfig need for this

The following changes since commit 21d0fac1382cbe20dfc95c0a400350632f28cbdb:

at91: add Calao TNY-A9260/TNY-A9263/TNY-A9G20 (2012-01-11 09:41:25 +0100)

Quoted 7 lines
Quoted 2 lines

are available in the git repository at:
git://uboot.jcrosoft.org/barebox.git size-optimisation

Your git server does not work for me. A git pull just stalls. The web frontend works well though.

Can you check this?

check ready

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#9 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jean-Christophe PLAGNIOL-VILLARD
Sent: Wednesday, January 11, 2012 6:59 PM
To: [email protected]
Subject: [PATCH 0/6] code size reduction for xloader

HI,

Quoted 7 lines

this patch serie wrok on disble non needed code to
optimize the size
of barebox specially in the case of non interactive
version suc as
xloader for TI and late bootstrap for at91

tis will also iclude a sync of the kconfig need for this

I manually pulled all the patches in this series against latest "master" except (didn't seemed related to size reduction):
kconfig: sync to linux 3.2-rc4

I encountered compile error in this patch:
param: add config to disable it

CC drivers/mtd/core.o
drivers/mtd/core.c: In function 'add_mtd_device':
drivers/mtd/core.c:230:2: warning: implicit declaration of function 'IS_ENABLED' drivers/mtd/core.c:230:17: error: 'CONFIG_PARAMETER' undeclared (first use in this function) drivers/mtd/core.c:230:17: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [drivers/mtd/core.o] Error 1
make[1]: *** [drivers/mtd] Error 2
make: *** [drivers] Error 2

I am not sure whether IS_ENABLED is implemented in yet-to-be merged patch; so, continued testing after applying the temp patch at bottom of this mail.

With the modification, tested all working fine on OMAP3EVM.

I had to apply these patches from the series I posted yesterday, otherwise, barebox doesn't boot:
[PATCH 3/5] ARM omap3evm: Allow building first stage [PATCH 4/5] ARM omap3evm: Enable HSMMC device

You may add Tested-by: Sanjeev Premi<[email protected]> to these:
banner: add config to disable it
uncompress: add config to disable it
filetype: add config to disable it
driver: switch driver_d name to const char*

~sanjeev

From bbe95b44869d63d991bb26a9098c5f123f3c757e Mon Sep 17 00:00:00 2001
From: Sanjeev Premi <[email protected]>
Date: Thu, 12 Jan 2012 20:16:15 +0530
Subject: [PATCH] temp: fix failure due to a portion of prev patch

---
 drivers/mtd/core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/mtd/core.c +2 -1
index ccc5c26..dc0d5b0 100644
@@ -227,6 +227,7 @@ int add_mtd_device(struct mtd_info *mtd, char *devname)
        mtd->cdev.dev = &mtd->class_dev;
        mtd->cdev.mtd = mtd;
 
+#ifdef CONFIG_PARAMETER
        if (IS_ENABLED(CONFIG_PARAMETER)) {
                sprintf(str, "%u", mtd->size);
                dev_add_param_fixed(&mtd->class_dev, "size", str);
@@ -237,7 +238,7 @@ int add_mtd_device(struct mtd_info *mtd, char *devname)
                sprintf(str, "%u", mtd->oobsize);
                dev_add_param_fixed(&mtd->class_dev, "oobsize", str);
        }
-
+#endif
        devfs_create(&mtd->cdev);
 
        list_for_each_entry(hook, &mtd_register_hooks, hook)

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#10 lore raw
Quoted 16 lines · Sanjeev
Quoted 16 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jean-Christophe PLAGNIOL-VILLARD
Sent: Wednesday, January 11, 2012 6:59 PM
To: [email protected]
Subject: [PATCH 0/6] code size reduction for xloader

HI,

this patch serie wrok on disble non needed code to
optimize the size
of barebox specially in the case of non interactive
version suc as
xloader for TI and late bootstrap for at91

Quoted 5 lines
Quoted 1 line

tis will also iclude a sync of the kconfig need for this

I manually pulled all the patches in this series against latest "master" except (didn't seemed related to size reduction):
kconfig: sync to linux 3.2-rc4

because you do need this one

to be able to the IS_ENABLED macro

Quoted 13 lines

I encountered compile error in this patch:
param: add config to disable it

CC drivers/mtd/core.o
drivers/mtd/core.c: In function 'add_mtd_device':
drivers/mtd/core.c:230:2: warning: implicit declaration of function 'IS_ENABLED' drivers/mtd/core.c:230:17: error: 'CONFIG_PARAMETER' undeclared (first use in this function) drivers/mtd/core.c:230:17: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [drivers/mtd/core.o] Error 1
make[1]: *** [drivers/mtd] Error 2
make: *** [drivers] Error 2

Quoted 3 lines

I am not sure whether IS_ENABLED is implemented in yet-to-be merged patch; so, continued testing after applying the temp patch at bottom of this mail.

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox