[U-Boot-Users] Compressed U-Boot image

VanBaren, Gerald (AGRE) Gerald.VanBaren at smiths-aerospace.com
Thu Nov 4 14:26:12 CET 2004


> -----Original Message-----
> From: u-boot-users-admin at lists.sourceforge.net
> [mailto:u-boot-users-admin at lists.sourceforge.net] On Behalf
> Of Terry Barnaby
> Sent: Wednesday, November 03, 2004 11:39 AM
> To: Wolfgang Denk
> Cc: u-boot-users at lists.sourceforge.net
> Subject: Re: [U-Boot-Users] Compressed U-Boot image

[snip]

> In my case I was hoping to use u-boot simply as a network
> boot loader without all of the debugging options. However I
> have only 32KByte to store the code in ....
>
> Is there another PPC based network boot loader you know off
> that would be better at this than u-boot ?
>
> Cheers
>
> Terry

Hi Terry,

You have a significant challenge.  I just did a quick gzip --best check
which confirmed that my u-boot image compressed ~50% (45% but you will
need to add the decompression code).  This implies that you need an
uncompressed u-boot image smaller than 64K.  Since you have all the
source, it is do-able, it is just a question of how hard you are willing
to work and what you are willing to cut out ;-).

My advice is to...
1) Configure a minimal u-boot by turning off as many commands as
possible.
2) See how close you are.  My gut feel is that, if you are under 96K,
you have a decent chance.
3) Look in the u-boot.map file and see who the heavy hitters are.  With
some luck, you will be able to minimize or remove enough of them to get
under 64K.

As everybody has been saying, this isn't going to be easy.  The nice
thing is that you are starting from solid code.  A _lot_ of people make
the mistake of optimizing and then debugging... it is a lot easier to
debug and then optimize.

Looking at my u-boot map it is very clear how much memory each .a/.o is
taking up (3rd column in the .text section) and what it is used for.  I
see several decompression libraries (gzip, bzip2, inflate?) that you
could remove all-but-one (and possibly all if you can get u-boot to
re-use the u-boot image decompression routine that you will need to
write).  The command parser and commands make up a pretty large chunk --
obviously that can be minimized and possibly eliminated.

Some big hitters that are obviously necessary.  These add up to just
over 32K.  We're still in the game, but this isn't looking very easy.
 .text          0xff800000     0x3560 cpu/mpc8260/start.o
 .text          0xff805098     0x1bf4 net/libnet.a(net.o)
 .text          0xff806c8c      0x6b0 net/libnet.a(tftp.o)
 .text          0xff80733c      0xae0 net/libnet.a(bootp.o)
 .text          0xff808018      0x87c net/libnet.a(eth.o)
 .text          0xff80992c      0xab4 common/libcommon.a(main.o)
 .text          0xff81248c      0x96c common/libcommon.a(console.o)
 .text          0xff812fb0     0x1328 common/libcommon.a(dlmalloc.o)

Commands, most or all of which would need to be sacrificed
 .text          0xff814bb8     0x2674 common/libcommon.a(hush.o)
 .text          0xff80a3e0      0x1ec
common/libcommon.a(cmd_autoscript.o)
 .text          0xff80a5cc      0x23c common/libcommon.a(cmd_bdinfo.o)
 .text          0xff80a808       0xbc common/libcommon.a(cmd_boot.o)
 .text          0xff80a8c4     0x11e8 common/libcommon.a(cmd_bootm.o)
 .text          0xff80baac      0x1cc common/libcommon.a(cmd_cache.o)
 .text          0xff80bc78      0x120 common/libcommon.a(cmd_console.o)
 .text          0xff80bd98      0xb5c common/libcommon.a(cmd_flash.o)
 .text          0xff80c8f4      0xe18 common/libcommon.a(cmd_immap.o)
 .text          0xff80d70c      0x424 common/libcommon.a(cmd_itest.o)
 .text          0xff80db30      0x3b0 common/libcommon.a(cmd_jffs2.o)
 .text          0xff80dee0     0x1320 common/libcommon.a(cmd_load.o)
 .text          0xff80f200      0xd04 common/libcommon.a(cmd_mem.o)
 .text          0xff80ff04      0x820 common/libcommon.a(cmd_mii.o)
 .text          0xff810724       0xb0 common/libcommon.a(cmd_misc.o)
 .text          0xff8107d4      0x5b8 common/libcommon.a(cmd_net.o)
 .text          0xff810d8c      0xca8 common/libcommon.a(cmd_nvedit.o)
 .text          0xff811a34      0x178 common/libcommon.a(cmd_portio.o)

I _really hope_ that you have a development board that you can create an
analog of your compressed u-boot on and debug it before you have to go
to a severely memory starved environment.

You have an interesting challenge.  Keep us informed and good luck,
gvb

******************************************
The following messages are brought to you by the Lawyers' League of
IdioSpeak:

******************************************
The information contained in, or attached to, this e-mail, may contain confidential information and is intended solely for the use of the individual or entity to whom they are addressed and may be subject to legal privilege.  If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager.  Please do not copy it for any purpose, or disclose its contents to any other person.  The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company.  The recipient should check this e-mail and any attachments for the presence of viruses.  The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email.
******************************************




More information about the U-Boot mailing list