From: Charles Manning <manningc2@actrix.gen.nz>
To: u-boot@lists.denx.de
Subject: [U-Boot] Easy reduction to u-boot image size
Date: Wed, 26 May 2010 12:44:26 +1200 [thread overview]
Message-ID: <201005261244.27080.manningc2@actrix.gen.nz> (raw)
I've been investigating reducing the size of an omap3 uboot image to less than
64k to facilitate loading via the bootrom. I've been working with the Brian
Silvermans' patch and some modifications to that.
http://www.mail-archive.com/u-boot at lists.denx.de/msg16073.html
With Brians's patch, and some extra fiddling, I got to around 62k but needed
to get lower (need to be under 60k ).
One thing I came across was that u-boot is not using function sections etc and
as a result there's quite a bit of dead code that is included in the image.
Applying the following patch reduced the size by around 7k to approx 55k. That
really helped :-) and lets me add back some functionality and still keep
under 60k.
Note:
1) This only sorts out the overo. Other u-boot.lds files need to be modified
in the same way.
2) This only does dead code stripping and not dead data stripping. I have not
yet figured out why that is not working (hence the commented out line
for -fdata-sections). This will save something, but I expect not very much.
-- Charles
--- a/board/omap3/overo/u-boot.lds
+++ b/board/omap3/overo/u-boot.lds
@@ -34,7 +34,7 @@ SECTIONS
. = ALIGN(4);
.text :
{
- cpu/arm_cortexa8/start.o (.text)
+ KEEP(cpu/arm_cortexa8/start.o (.text))
*(.text)
}
diff --git a/config.mk b/config.mk
index b1254e9..b129761 100644
--- a/config.mk
+++ b/config.mk
@@ -171,6 +171,11 @@ ifneq ($(TEXT_BASE),)
LDFLAGS += -Ttext $(TEXT_BASE)
endif
+# Stuff to strip out dead code
+CFLAGS += -ffunction-sections
+#CFLAGS += -fdata-sections
+LDFLAGS += --cref --gc-sections
+
# Location of a usable BFD library, where we define "usable" as
# "built for ${HOST}, supports ${TARGET}". Sensible values are
# - When cross-compiling: the root of the cross-environment
next reply other threads:[~2010-05-26 0:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-26 0:44 Charles Manning [this message]
2010-05-26 4:36 ` [U-Boot] Easy reduction to u-boot image size Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201005261244.27080.manningc2@actrix.gen.nz \
--to=manningc2@actrix.gen.nz \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox