reduce the size of busybox

Bernhard Fischer rep.nop at aon.at
Mon Jun 12 16:36:29 UTC 2006


On Mon, Jun 12, 2006 at 10:17:11AM -0400, Rob Landley wrote:
>Hey everybody!
>
>On Saturday 10 June 2006 3:02 am, Dan Nicolaescu wrote:
>> Hi!
>>
>> The size of busybox can be reduced a lot by using a new compilation
>> flag in gcc-4.1
>>
>> I did a make menuconfig (on a x86 Fedora Core 5 machine) and turned on
>> these options:
>>
>>        [*] Build BusyBox as a static binary (no shared libs)
>>        [*] Compile all sources at once
>>
>> The adding "-fwhole-program --combine" to the do_link command for the
>> "busybox_unstripped" rule in Makefile.

You shouldn't need to specify these two flags manually, i'm doing this
for you if your compiler supports it.
>>
>> The size of the binary looks like this:
>>
>> size -f busybox_unstripped.original busybox.whole-program
>>    text    data     bss     dec     hex filename
>>  661891    1976   18268  682135   a6897 busybox_unstripped.original
>>  489777    1940    7600  499317   79e75 busybox.whole-program
>>
>> I am not sure if the size decrease would be so drastical in case of a
>> more rich busybox configuration. But I think this should help.
>
>Wow!  Cool!

Are you sure that you didn't compare a static vs. a non-static config in
the above?

I'd be interrested to see `egrep -v "^(#|$)" .config´ of that config.
What arch are you on?
>
>> Cheers,
>>                 --dan
>
>Hopefully _this_ is going to merge strings. :)

I doubt that.



More information about the busybox mailing list