[OE-core] Question about apply eglibc configurability to create minimal image

Kang Kai Kai.Kang at windriver.com
Tue Jun 21 07:35:10 UTC 2011


>> Hi Mark,
>>
>> According this list, expand with their run time depency(show in the attachment
>> minimal-image-runtime-dependies.png) , and the list is:
>>
>>      base-files \
>>      base-passwd \
>>      busybox \
>>      busybox-syslog \
>>      busybox-udhcpc \
>>      initscripts \
>>      makedevs \
>>      modutils-initscripts \
>>      sysvinit \
>>      sysvinit-pidof \
>>      sysvinit-inittab \
>>      tinylogin
>>
>>
>> When only enable eglibc libm, busybox, sysvinit and tinylogin can't be compiled.
>>
>> busybox depends on
>>
>>      * libc-crypt
>>      * libc-getlogin
>>      * libc-inet
>>      * libc-posix-regexp
>>
>> I wonder that maybe libc-crypt can NOT be disabled?  Other 3 options can be
>> disabled by closing some busybox feature and builtin commands.

Hi Mark,

> I would guess that there are options within busybox that are enabled that make
> use of each of these.  Do you get a failure in compilation, configuration, or?
> You will likely have to shrink busybox down to a shell and a few simple
> commands, instead of the normal config.

libm and libcrypt are added to LDLIBS unconditionally in Makefile.flags 
in busybox source code. I am trying to figure out why add them 
unconditionally. With these 2 options enabled and patch for busybox's 
defconf in attachment, I make the busybox compile succeed.

In the patch all the internet related features are disabled and some 
command such as awk, sed, grep(re support), mount( nfs feature), expr, 
logname, who, find, syslogd(remote log), rdate are removed or disabled .

>> sysvinit depends on
>>
>>      * libc-inet
>>      * libc-sunrpc
>>      * libc-crypt
>>
>> I don't how to resolve them, so as you said, remove it and use busybox init instead.
> Ya, busybox init should use fewer items.  If busybox init can't be used, then
> simply using the busybox shell as the init will likely work for a truly minimal
> system.

busybox init could be used, and mdev is also used to replace udev.

>> tinylogin depends on
>>
>>      * libc-crypt
>>      * libc-utmp
>>      * libc-getlogin
>>
>> I am trapped here, and could you give me some more help here, please?
> Ok, that makes sense.  Guess you need to remove tinylogin as well.  Since simply
> offering login services would require those three items.

tinylogin is removed.

>> The picture named eglibc-options-deps-for-minimal-image.png in attachment is the
>> packages depends on every eglibc option that required by other packages.
>>
>> There are some other dependencies cause problems.
>> linux-yocto requires elfutils python and perl.
> We need to figure out why linux-yocto requires these items.  (I suspect it's for
> perf or similar.  If thats the case, then this is likely a bug.  Perf should
> have to be built for each kernel, if the required capabilities don't exist.)

Yes, perf runtime depends on elfutils,  python and perl, and perf also 
need elfutils to provide libelf for its compilation.

I remove the perl and python in linux-tools.inc file, but keep the 
elfutils. After that remove elfutils' dependency gettext, and add
EXTRA_OEMAKE = "-C libelf"
to build libelf only(because other subdirectories requires libc-ftraverse).

>> elfutils requires gettext and gettext depends on:
>>
>>      * libc-locale-code
>>      * libc-spawn
>>      * libc-getlogin
> I think we have to assume that elfutils is not needed.  It's better to break
> that dependency instead of trying to fix it.
>
>> python requires ncurses and openssl.
>>
>>      * ncurses could be update bb file to choose support wchar or not.
>>      * openssl depends on:
>>            o libc-inet
>>            o libc-nsswitch
> I really wonder if there is something inside of openssl we can disable -- or if
> there is a switch to python that disables SSL support...  It might be worth
> investigating changing the python configuration.
>
>> perl depends on:
>>
>>      * libc-crypt
>>      * libc-fcvt
>>      * libc-inet
>>      * libc-utmp
> Similarly it might be worth investigating in perl if we can disable the users of
> these functions in a similar way.
>
>> How to remove these dependencies?  One way is to remove the "elfutils python
>> perl" from linux-yocto depencies, and the other is to disable related features
>> of these packages, and I wonder this is too hard to finish.
> I'd suggest, for now, simply to remove the elfutils, python and perl
> dependencies from the linux-yocto to continue.
>
> The goal of this exercise is simply to see how small of a eglibc system can be
> produced that will boot.  Then figure out how to scale up from there.  (I assume
> once we get beyond a few basic apps that we will need much of eglibc!)
>
> Based on your research above, I would suggest:
>
> * File a bug on the linux-yocto requiring elfutils, python and perl
>
> * Get rid of sysvinit and tinylogin.
>
> * Figure out if you can change the selections on busybox to still build
> something with a shell, but very little additional functionality with the
> minimal eglibc configuration.

With sysvinit and tinylogin removed and busybox configured by patch in 
the attachment, and keep 3 eglibc options (libc-libm libc-crypt 
libc-posix-regexp), the size of image rootfs after extraction is *2.9M* 
for ppc. busybox is 432K after extraction and maybe remove 
libc-posix-regexp will decrease the size of it. I'll try to do that.

libc-posix-regexp is required by perf.

> * Assuming that's possible... start adding in the additional functionality,
> crypt, inet, getlogin, utmp and get back to that standard busybox configuration
> and tinylogin.

After get "libc-sunrpc libc-utmp libc-inet libc-nsswitch libc-getlogin" 
back, after add tinylogin and standard busybox, I get the size after 
extraction is *3.5M*.

> This should give us a good size comparison between.  Non-internet connected,
> minimal system..  and something that could be connected to the internet.
>
> (Note, I don't think anyone will really build such a minimal system in the
> real-world.  However the size and configuration information could be useful for
> someone trying to squeeze this into a small system.  It might turn out that
> uClibc is still more practical for such systems.)

I wonder how can I record my current work that other people can take 
advantage of it? For now I modify task-core-boot directly, but it seems  
unacceptable because other image also include task-core-boot. Should I 
add a new task-core-boot-minimal only include

     base-files \
     base-passwd \
     busybox \
     initscripts \
     modutils-initscripts

and take the configure informations and the steps into a document file?

Because we will begin yocto pam works next week, I hope I can finish the job in this week.

Thanks for your great help!


Regards,
Kai

>
>
>
>
>>> First see if you can compile the above with a minimal eglibc configuration.  If
>>> not I can help you work through those issues..  If you can, you SHOULD see a
>>> fairly dramatic decrease in size.
>>>
>>> --Mark
>>>
>>>> Thanks a lot!
>>>>
>>>> I made a mistake that try eglibc configurability in a directory which
>>>> has build core-image-minimal, so the packages which depend on eglibc
>>>> didn't rebuild, and I didn't find the dependency before. I am sorry!
>>>>
>>>> Regards,
>>>> Kai

-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-defconfig.patch
Type: text/x-patch
Size: 10491 bytes
Desc: not available
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20110621/36d9132b/attachment-0002.bin>


More information about the Openembedded-core mailing list