[CUWiN-Dev] Questions from Lawrence of CSIR

David Young dyoung at pobox.com
Tue Oct 31 04:33:09 CST 2006


On Tue, Oct 31, 2006 at 11:00:03AM +0100, Sven-Ola Tuecke wrote:
> Hi,
> 
> JFFS2 and RAM space is always an issue on retail devices like the WRT54G. 
> Those have only 4Mb Flash/16 Mb RAM. Some have only 2Mb Flash/8Mb RAM. A 
> binary with 1Mb size will be stored compressed on the JFFS2 partition if 
> Lawrence is using the standard OpenWrt toolchain - so that size may be OK 
> if you do not need large addons.
> 
> I can hardly imagine, that you guys programmed so much source lines that 
> the resulting binary has really 1Mb. So here are some tipps:
> 
> - Modern opensource packs tends to grab any available library. A little 
> JavaRuntime here, some funny C++ string-lib there, a full sized openssl to 
> check a hash, topped by a zebra-does-any-routing-proto-since-the-1980's and 
> so on. You need to cut off that deps - especially the unused stuff of 
> course.
> 
> - Check the final linker ("ld") command wich generates the resulting 
> binary. Treacherous libs where you pull in an unwanted chain-of-deps will 
> be visible here.

I was using 'nm' to look at the statically-linked hslsd binary, and I
was astonished at some of the stuff that was linked-in.  XDR(3)?!

> - Try to cut off debug stuff. Sometimes up to 25% can be saved with a 
> simple #define printf(...)

Lots of messages are logged using the macro LOGLIB_LOG().

Lawrence, beware of getting bogged down in optimization.  I recommend
optimizing the storage size last.  Run the programs from an NFS root
until you are finished porting, then shrink the programs to the size of
the Flash storage.

Dave

-- 
David Young             OJC Technologies
dyoung at ojctech.com      Urbana, IL * (217) 278-3933


More information about the CU-Wireless-Dev mailing list