Minimal Image: Difference between revisions

From Yocto Project
Jump to navigationJump to search
(first half initialize)
 
(Second half initialize)
Line 63: Line 63:
|| '''libc-locale-code''' || '''gettext'''
|| '''libc-locale-code''' || '''gettext'''
|-
|-
|| '''libc-posix-regexp''' || '''module-init-tools-depmod update-alternatives-cworth linux-yocto(perf)'''
|| '''libc-posix-regexp''' || '''busybox module-init-tools-depmod update-alternatives-cworth linux-yocto(perf)'''
|-
|-
|| '''libc-nsswitch''' || '''libc-inet'''
|| '''libc-nsswitch''' || '''libc-inet'''
Line 75: Line 75:
|| '''libc-utmp''' || '''tinylogin busybox perl libc-getlogin'''
|| '''libc-utmp''' || '''tinylogin busybox perl libc-getlogin'''
|-
|-
|| '''libc-getlogin''' || '''gettext tinylogin'''
|| '''libc-getlogin''' || '''busybox gettext tinylogin'''
|-
|-
|| '''libc-fcvt''' || '''perl'''
|| '''libc-fcvt''' || '''perl'''
Line 83: Line 83:
|| '''libc-ftraverse''' || '''elfutils'''
|| '''libc-ftraverse''' || '''elfutils'''
|}
|}
==Process==
* Packages list
Walk through the core-image-minimal, and we'll see:
IMAGE_INSTALL = "task-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP}"
Looking at task-core-boot:
  RDEPENDS_task-core-boot = "\
    base-files \
    base-passwd \
    busybox \
    initscripts \
    ${@base_contains("MACHINE_FEATURES", "keyboard", "keymaps", "", d)} \
    modutils-initscripts \
    netbase \
    sysvinit \
    tinylogin \
    udev \
    ${VIRTUAL-RUNTIME_update-alternatives} \
    ${MACHINE_ESSENTIAL_EXTRA_RDEPENDS}"
  RRECOMMENDS_task-core-boot = "\
    ${MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS}"
Then we disable all network related packages, drop "keymaps", netbase, tinylogin and update-alternatives, use busybox init replace sysvinit, use busybox mdev replace udev.
Leaving:
    base-files \
    base-passwd \
    busybox \
    initscripts \
    modutils-initscripts
* busybox related dependencies
According table above, busybox depends on "libc-libm libc-crypt libc-posix-regexp libc-inet libc-utmp libc-getlogin". And "libc-libm libc-crypt" can not be disabled currently, and the following patch for busybox to remove all that depends on the left options.
busybox-defconfig.patch
  diff --git a/meta/recipes-core/busybox/busybox-1.18.4/defconfig b/meta/recipes-core/busybox/busybox-1.18.4/defconfig
  index 5327a64..46090fc 100644
  --- a/meta/recipes-core/busybox/busybox-1.18.4/defconfig
  +++ b/meta/recipes-core/busybox/busybox-1.18.4/defconfig
  @@ -37,7 +37,7 @@ CONFIG_FEATURE_SUID_CONFIG_QUIET=y
  # CONFIG_FEATURE_PREFER_APPLETS is not set
  CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
  CONFIG_FEATURE_SYSLOG=y
  -CONFIG_FEATURE_HAVE_RPC=y
  +# CONFIG_FEATURE_HAVE_RPC is not set
 
  #
  # Build Options
  @@ -178,7 +178,7 @@ CONFIG_ENV=y
  CONFIG_FEATURE_ENV_LONG_OPTIONS=y
  # CONFIG_EXPAND is not set
  # CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
  -CONFIG_EXPR=y
  +# CONFIG_EXPR is not set
  # CONFIG_EXPR_MATH_SUPPORT_64 is not set
  CONFIG_FALSE=y
  # CONFIG_FOLD is not set
  @@ -191,7 +191,7 @@ CONFIG_ID=y
  # CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
  # CONFIG_LENGTH is not set
  CONFIG_LN=y
  -CONFIG_LOGNAME=y
  +# CONFIG_LOGNAME is not set
  CONFIG_LS=y
  CONFIG_FEATURE_LS_FILETYPES=y
  CONFIG_FEATURE_LS_FOLLOWLINKS=y
  @@ -258,7 +258,7 @@ CONFIG_USLEEP=y
  # CONFIG_UUENCODE is not set
  CONFIG_WC=y
  # CONFIG_FEATURE_WC_LARGE is not set
  -CONFIG_WHO=y
  +# CONFIG_WHO is not set
  CONFIG_WHOAMI=y
  CONFIG_YES=y
 
  @@ -321,7 +321,7 @@ CONFIG_WHICH=y
  #
  # Editors
  #
  -CONFIG_AWK=y
  +# CONFIG_AWK is not set
  # CONFIG_FEATURE_AWK_LIBM is not set
  CONFIG_CMP=y
  CONFIG_DIFF=y
  @@ -329,7 +329,7 @@ CONFIG_DIFF=y
  CONFIG_FEATURE_DIFF_DIR=y
  # CONFIG_ED is not set
  CONFIG_PATCH=y
  -CONFIG_SED=y
  +# CONFIG_SED is not set
  CONFIG_VI=y
  CONFIG_FEATURE_VI_MAX_LEN=1024
  CONFIG_FEATURE_VI_8BIT=y
  @@ -368,13 +368,13 @@ CONFIG_FEATURE_FIND_SIZE=y
  CONFIG_FEATURE_FIND_PRUNE=y
  # CONFIG_FEATURE_FIND_DELETE is not set
  CONFIG_FEATURE_FIND_PATH=y
  -CONFIG_FEATURE_FIND_REGEX=y
  +# CONFIG_FEATURE_FIND_REGEX is not set
  # CONFIG_FEATURE_FIND_CONTEXT is not set
  # CONFIG_FEATURE_FIND_LINKS is not set
  -CONFIG_GREP=y
  -CONFIG_FEATURE_GREP_EGREP_ALIAS=y
  -CONFIG_FEATURE_GREP_FGREP_ALIAS=y
  -CONFIG_FEATURE_GREP_CONTEXT=y
  +# CONFIG_GREP is not set
  +# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
  +# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
  +# CONFIG_FEATURE_GREP_CONTEXT is not set
  CONFIG_XARGS=y
  # CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
  # CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
  @@ -384,15 +384,16 @@ CONFIG_XARGS=y
  #
  # Init Utilities
  #
  -# CONFIG_INIT is not set
  -# CONFIG_FEATURE_USE_INITTAB is not set
  +CONFIG_INIT=y
  +CONFIG_FEATURE_USE_INITTAB=y
  # CONFIG_FEATURE_KILL_REMOVED is not set
  CONFIG_FEATURE_KILL_DELAY=0
  -# CONFIG_FEATURE_INIT_SCTTY is not set
  -# CONFIG_FEATURE_INIT_SYSLOG is not set
  -# CONFIG_FEATURE_EXTRA_QUIET is not set
  -# CONFIG_FEATURE_INIT_COREDUMPS is not set
  -# CONFIG_FEATURE_INITRD is not set
  +CONFIG_FEATURE_INIT_SCTTY=y
  +CONFIG_FEATURE_INIT_SYSLOG=y
  +CONFIG_FEATURE_EXTRA_QUIET=y
  +CONFIG_FEATURE_INIT_COREDUMPS=y
  +CONFIG_FEATURE_INITRD=y
  +CONFIG_INIT_TERMINAL_TYPE="linux"
  CONFIG_HALT=y
  # CONFIG_FEATURE_CALL_TELINIT is not set
  CONFIG_TELINIT_PATH=""
  @@ -418,7 +419,7 @@ CONFIG_FIRST_SYSTEM_ID=0
  CONFIG_LAST_SYSTEM_ID=0
  # CONFIG_DELUSER is not set
  # CONFIG_GETTY is not set
  -CONFIG_FEATURE_UTMP=y
  +# CONFIG_FEATURE_UTMP is not set
  # CONFIG_FEATURE_WTMP is not set
  # CONFIG_LOGIN is not set
  # CONFIG_PAM is not set
  @@ -518,12 +519,12 @@ CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y
  CONFIG_LOSETUP=y
  # CONFIG_LSPCI is not set
  # CONFIG_LSUSB is not set
  -# CONFIG_MDEV is not set
  +CONFIG_MDEV=y
  # CONFIG_FEATURE_MDEV_CONF is not set
  # CONFIG_FEATURE_MDEV_RENAME is not set
  # CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
  # CONFIG_FEATURE_MDEV_EXEC is not set
  -# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
  +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
  CONFIG_MKSWAP=y
  # CONFIG_FEATURE_MKSWAP_UUID is not set
  CONFIG_MORE=y
  @@ -551,12 +552,12 @@ CONFIG_MOUNT=y
  # CONFIG_FEATURE_MOUNT_VERBOSE is not set
  # CONFIG_FEATURE_MOUNT_HELPERS is not set
  # CONFIG_FEATURE_MOUNT_LABEL is not set
  -CONFIG_FEATURE_MOUNT_NFS=y
  +# CONFIG_FEATURE_MOUNT_NFS is not set
  # CONFIG_FEATURE_MOUNT_CIFS is not set
  CONFIG_FEATURE_MOUNT_FLAGS=y
  CONFIG_FEATURE_MOUNT_FSTAB=y
  CONFIG_PIVOT_ROOT=y
  -CONFIG_RDATE=y
  +# CONFIG_RDATE is not set
  # CONFIG_RDEV is not set
  # CONFIG_READPROFILE is not set
  # CONFIG_RTCWAKE is not set
  @@ -617,10 +618,10 @@ CONFIG_DC=y
  # CONFIG_LAST is not set
  # CONFIG_FEATURE_LAST_SMALL is not set
  # CONFIG_FEATURE_LAST_FANCY is not set
  -CONFIG_LESS=y
  -CONFIG_FEATURE_LESS_MAXLINES=9999999
  -CONFIG_FEATURE_LESS_BRACKETS=y
  -CONFIG_FEATURE_LESS_FLAGS=y
  +# CONFIG_LESS is not set
  +CONFIG_FEATURE_LESS_MAXLINES=0
  +# CONFIG_FEATURE_LESS_BRACKETS is not set
  +# CONFIG_FEATURE_LESS_FLAGS is not set
  # CONFIG_FEATURE_LESS_MARKS is not set
  # CONFIG_FEATURE_LESS_REGEXP is not set
  # CONFIG_FEATURE_LESS_WINCH is not set
  @@ -658,9 +659,9 @@ CONFIG_TIME=y
  #
  # Networking Utilities
  #
  -CONFIG_FEATURE_IPV6=y
  +# CONFIG_FEATURE_IPV6 is not set
  # CONFIG_FEATURE_UNIX_LOCAL is not set
  -CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
  +# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
  # CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
  # CONFIG_ARP is not set
  # CONFIG_ARPING is not set
  @@ -676,7 +677,7 @@ CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
  # CONFIG_FTPGET is not set
  # CONFIG_FTPPUT is not set
  # CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
  -CONFIG_HOSTNAME=y
  +# CONFIG_HOSTNAME is not set
  # CONFIG_HTTPD is not set
  # CONFIG_FEATURE_HTTPD_RANGES is not set
  # CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set
  @@ -689,22 +690,22 @@ CONFIG_HOSTNAME=y
  # CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
  # CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
  # CONFIG_FEATURE_HTTPD_PROXY is not set
  -CONFIG_IFCONFIG=y
  -CONFIG_FEATURE_IFCONFIG_STATUS=y
  +# CONFIG_IFCONFIG is not set
  +# CONFIG_FEATURE_IFCONFIG_STATUS is not set
  # CONFIG_FEATURE_IFCONFIG_SLIP is not set
  # CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
  -CONFIG_FEATURE_IFCONFIG_HW=y
  +# CONFIG_FEATURE_IFCONFIG_HW is not set
  # CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
  # CONFIG_IFENSLAVE is not set
  # CONFIG_IFPLUGD is not set
  -CONFIG_IFUPDOWN=y
  -CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
  +# CONFIG_IFUPDOWN is not set
  +CONFIG_IFUPDOWN_IFSTATE_PATH=""
  # CONFIG_FEATURE_IFUPDOWN_IP is not set
  # CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set
  -CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN=y
  -CONFIG_FEATURE_IFUPDOWN_IPV4=y
  -CONFIG_FEATURE_IFUPDOWN_IPV6=y
  -CONFIG_FEATURE_IFUPDOWN_MAPPING=y
  +# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set
  +# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
  +# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
  +# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
  # CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
  # CONFIG_INETD is not set
  # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
  @@ -713,11 +714,11 @@ CONFIG_FEATURE_IFUPDOWN_MAPPING=y
  # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
  # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
  # CONFIG_FEATURE_INETD_RPC is not set
  -CONFIG_IP=y
  -CONFIG_FEATURE_IP_ADDRESS=y
  -CONFIG_FEATURE_IP_LINK=y
  -CONFIG_FEATURE_IP_ROUTE=y
  -CONFIG_FEATURE_IP_TUNNEL=y
  +# CONFIG_IP is not set
  +# CONFIG_FEATURE_IP_ADDRESS is not set
  +# CONFIG_FEATURE_IP_LINK is not set
  +# CONFIG_FEATURE_IP_ROUTE is not set
  +# CONFIG_FEATURE_IP_TUNNEL is not set
  # CONFIG_FEATURE_IP_RULE is not set
  # CONFIG_FEATURE_IP_SHORT_FORMS is not set
  # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
  @@ -731,57 +732,59 @@ CONFIG_FEATURE_IP_TUNNEL=y
  # CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
  # CONFIG_NAMEIF is not set
  # CONFIG_FEATURE_NAMEIF_EXTENDED is not set
  -CONFIG_NC=y
  +# CONFIG_NBDCLIENT is not set
  +# CONFIG_NC is not set
  # CONFIG_NC_SERVER is not set
  # CONFIG_NC_EXTRA is not set
  -CONFIG_NETSTAT=y
  +# CONFIG_NETSTAT is not set
  # CONFIG_FEATURE_NETSTAT_WIDE is not set
  # CONFIG_FEATURE_NETSTAT_PRG is not set
  -CONFIG_NSLOOKUP=y
  +# CONFIG_NSLOOKUP is not set
  # CONFIG_NTPD is not set
  # CONFIG_FEATURE_NTPD_SERVER is not set
  -CONFIG_PING=y
  -CONFIG_PING6=y
  -CONFIG_FEATURE_FANCY_PING=y
  +# CONFIG_PING is not set
  +# CONFIG_PING6 is not set
  +# CONFIG_FEATURE_FANCY_PING is not set
  # CONFIG_PSCAN is not set
  -CONFIG_ROUTE=y
  +# CONFIG_ROUTE is not set
  # CONFIG_SLATTACH is not set
  -CONFIG_TELNET=y
  +# CONFIG_TELNET is not set
  # CONFIG_FEATURE_TELNET_TTYPE is not set
  -CONFIG_FEATURE_TELNET_AUTOLOGIN=y
  +# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
  # CONFIG_TELNETD is not set
  # CONFIG_FEATURE_TELNETD_STANDALONE is not set
  # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
  -CONFIG_TFTP=y
  +# CONFIG_TFTP is not set
  # CONFIG_TFTPD is not set
  -CONFIG_FEATURE_TFTP_GET=y
  -CONFIG_FEATURE_TFTP_PUT=y
  +# CONFIG_FEATURE_TFTP_GET is not set
  +# CONFIG_FEATURE_TFTP_PUT is not set
  # CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
  # CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
  # CONFIG_TFTP_DEBUG is not set
  -CONFIG_TRACEROUTE=y
  +# CONFIG_TRACEROUTE is not set
  # CONFIG_TRACEROUTE6 is not set
  # CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
  # CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
  # CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
  -CONFIG_UDHCPD=y
  +# CONFIG_UDHCPD is not set
  # CONFIG_DHCPRELAY is not set
  -CONFIG_DUMPLEASES=y
  +# CONFIG_DUMPLEASES is not set
  # CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
  -CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases"
  -CONFIG_UDHCPC=y
  -CONFIG_FEATURE_UDHCPC_ARPING=y
  +CONFIG_DHCPD_LEASES_FILE=""
  +# CONFIG_UDHCPC is not set
  +# CONFIG_FEATURE_UDHCPC_ARPING is not set
  # CONFIG_FEATURE_UDHCP_PORT is not set
  CONFIG_UDHCP_DEBUG=0
  # CONFIG_FEATURE_UDHCP_RFC3397 is not set
  -CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
  -CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
  -CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"
  +CONFIG_UDHCPC_DEFAULT_SCRIPT=""
  +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
  +CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
  # CONFIG_VCONFIG is not set
  -CONFIG_WGET=y
  -CONFIG_FEATURE_WGET_STATUSBAR=y
  -CONFIG_FEATURE_WGET_AUTHENTICATION=y
  -CONFIG_FEATURE_WGET_LONG_OPTIONS=y
  +# CONFIG_WGET is not set
  +# CONFIG_FEATURE_WGET_STATUSBAR is not set
  +# CONFIG_FEATURE_WGET_AUTHENTICATION is not set
  +# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set
  +# CONFIG_FEATURE_WGET_TIMEOUT is not set
  # CONFIG_ZCIP is not set
  # CONFIG_TCPSVD is not set
  # CONFIG_TUNCTL is not set
  @@ -914,7 +917,7 @@ CONFIG_FEATURE_SH_EXTRA_QUIET=y
  #
  CONFIG_SYSLOGD=y
  CONFIG_FEATURE_ROTATE_LOGFILE=y
  -CONFIG_FEATURE_REMOTE_LOG=y
  +# CONFIG_FEATURE_REMOTE_LOG is not set
  # CONFIG_FEATURE_SYSLOGD_DUP is not set
  CONFIG_FEATURE_IPC_SYSLOG=y
  CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
* linux-yocto related dependencies
**perf
perf requires python perl elfutils as runtime dependency, but we don't need perf in minimal image, so drop them.
  diff --git a/meta/recipes-kernel/linux/linux-tools.inc b/meta/recipes-kernel/linux/linux-tools.inc
  index ef81650..991a827 100644
  --- a/meta/recipes-kernel/linux/linux-tools.inc
  +++ b/meta/recipes-kernel/linux/linux-tools.inc
  @@ -25,4 +25,4 @@ PERFDEPENDS_libc-uclibc = ""
  PERFRDEPENDS = "python perl elfutils"
  PERFRDEPENDS_libc-uclibc = ""
  do_compile_perf[depends] = "${PERFDEPENDS}"
  -RDEPENDS_perf += "${PERFRDEPENDS}"
  +#RDEPENDS_perf += "${PERFRDEPENDS}"
**elfutils
When build linux-yocto(perf) will need libelf, so patch to elfutils only build libelf and remove depency "gettext"
  diff --git a/meta/recipes-devtools/elfutils/elfutils_0.148.bb b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
  index 2bedc05..2644687 100644
  --- a/meta/recipes-devtools/elfutils/elfutils_0.148.bb
  +++ b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
  @@ -41,7 +41,7 @@ SRC_URI += "\
          file://i386_dis.h \
          file://x86_64_dis.h \
  "
  -inherit autotools gettext
  +inherit autotools
  EXTRA_OECONF = "--program-prefix=eu-"
  EXTRA_OECONF_append_libc-uclibc = " ${@['', '--enable-uclibc']['${PN}' == '${BPN}']}"
  @@ -57,6 +57,7 @@ do_configure_prepend() {
  # build only libelf for uclibc case
  EXTRA_OEMAKE_libc-uclibc = "-C libelf"
  +EXTRA_OEMAKE = "-C libelf"
  EXTRA_OEMAKE_virtclass-native = ""
  EXTRA_OEMAKE_virtclass-nativesdk = ""
At last, we only enabled eglibc "libc-libm libc-crypt libc-posix-regexp(perf requires it)" in conf/local.conf and build minimal image with
  bitbake core-image-minimal
Then we will get the rootfs image looks like "core-image-minimal-mpc8315e-rdb-20110621065105.rootfs.tar.bz2", it takes '''2.9M''' disk space after extraction.

Revision as of 08:34, 22 June 2011

Introduction

A core run-time component of any Linux-based system is the C standard library. The C standard library (otherwise referred to as "libc" in this wiki page) contains a collection of headers and library routines used to implement operations (I/O and string handling, for example) in the C programming language. There are numerous implementations of libc. GNU libc (glibc) is ubiquitous while other libcs, in particular embedded glibc (eglibc) is designed for embedded systems.

eglibc strives to be source and binary compatible with glibc. eglibc's goals include reduced footprint, configurable components, better support for cross-compilation and cross-testing. In particular, eglibc's component configuration system allows embedded developers to build customized versions of the library that include only the features their application uses, reducing its space requirements.

Yocto provides eglibc's component configuration system by commit fbc60cc5ba2284bfcaea8c82001a49b7795cc2a2

This wiki page try to describe how to use eglibc component configuration system to create a really minimal image based on Yocto core-image-minimal.

eglibc component configuration system

eglibc's component configuration system categorizes the library's functions into "option groups", and allows you to include or exclude option groups individually. Some option groups depend on others; eglibc tracks these relationships, and ensures that the selected configuration yields a functioning library.

eglibc currently provides 38 option groups, documented in the file 'option-groups.def' in eglibc source code. Yocto support eglibc component configuration system in meta/recipes-core/eglibc/eglibc-options.inc, and provides distro features corresponding to eglibc configurable options there. It checks DISTRO_FEATURES whether contain the option then set it to Y or N in the ${B}/option-groups.config.

meta-yocto/conf/local.conf.sample.extended has a sample to enable all the eglibc configurable options. You should define DISTRO_FEATURES_LIBC and DISTRO_FEATURES in your own conf/local.conf, and set the options what you want to enable in DISTRO_FEATURES_LIBC.

For example, write the following line to your conf/local.conf to only enable OPTION_EGLIBC_LIBM,

DISTRO_FEATURES_LIBC = "libc-libm"

DISTRO_FEATURES = "alsa bluetooth ext2 irda pcmcia usbgadget usbhost wifi nfs zeroconf pci ${DISTRO_FEATURES_LIBC}"

Then you can build eglibc.

Dependencies

Current build core-image-minimal image need enable the following 15 options list in the following table. And the table show the dependecies between these eglibc component configuration system and Yocto core-image-minimal installed packages.

eglibc configuration option Required by
libc-libm gcc-runtime busybox
libc-crypt busybox tinylogin perl sysvinit
libc-posix-clang-wchar libc-posix-wchar-io libc-locale-code
libc-posix-wchar-io ncurses util-linux
libc-locale-code gettext
libc-posix-regexp busybox module-init-tools-depmod update-alternatives-cworth linux-yocto(perf)
libc-nsswitch libc-inet
libc-inet pciutils sysvinit openssl util-linux perl busybox libc-sunrpc libc-nis
libc-sunrpc libc-nis sysvinit
libc-nis perl
libc-utmp tinylogin busybox perl libc-getlogin
libc-getlogin busybox gettext tinylogin
libc-fcvt perl
libc-spawn gettext
libc-ftraverse elfutils


Process

  • Packages list

Walk through the core-image-minimal, and we'll see: IMAGE_INSTALL = "task-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP}"

Looking at task-core-boot:

 RDEPENDS_task-core-boot = "\
   base-files \
   base-passwd \
   busybox \
   initscripts \
   ${@base_contains("MACHINE_FEATURES", "keyboard", "keymaps", "", d)} \
   modutils-initscripts \
   netbase \
   sysvinit \
   tinylogin \
   udev \
   ${VIRTUAL-RUNTIME_update-alternatives} \
   ${MACHINE_ESSENTIAL_EXTRA_RDEPENDS}"
 RRECOMMENDS_task-core-boot = "\
   ${MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS}"

Then we disable all network related packages, drop "keymaps", netbase, tinylogin and update-alternatives, use busybox init replace sysvinit, use busybox mdev replace udev.

Leaving:

   base-files \
   base-passwd \
   busybox \
   initscripts \
   modutils-initscripts
  • busybox related dependencies

According table above, busybox depends on "libc-libm libc-crypt libc-posix-regexp libc-inet libc-utmp libc-getlogin". And "libc-libm libc-crypt" can not be disabled currently, and the following patch for busybox to remove all that depends on the left options.

busybox-defconfig.patch

 diff --git a/meta/recipes-core/busybox/busybox-1.18.4/defconfig b/meta/recipes-core/busybox/busybox-1.18.4/defconfig
 index 5327a64..46090fc 100644
 --- a/meta/recipes-core/busybox/busybox-1.18.4/defconfig
 +++ b/meta/recipes-core/busybox/busybox-1.18.4/defconfig
 @@ -37,7 +37,7 @@ CONFIG_FEATURE_SUID_CONFIG_QUIET=y
  # CONFIG_FEATURE_PREFER_APPLETS is not set
  CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
  CONFIG_FEATURE_SYSLOG=y
 -CONFIG_FEATURE_HAVE_RPC=y
 +# CONFIG_FEATURE_HAVE_RPC is not set
  
  #
  # Build Options
 @@ -178,7 +178,7 @@ CONFIG_ENV=y
  CONFIG_FEATURE_ENV_LONG_OPTIONS=y
  # CONFIG_EXPAND is not set
  # CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
 -CONFIG_EXPR=y
 +# CONFIG_EXPR is not set
  # CONFIG_EXPR_MATH_SUPPORT_64 is not set
  CONFIG_FALSE=y
  # CONFIG_FOLD is not set
 @@ -191,7 +191,7 @@ CONFIG_ID=y
  # CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
  # CONFIG_LENGTH is not set
  CONFIG_LN=y
 -CONFIG_LOGNAME=y
 +# CONFIG_LOGNAME is not set
  CONFIG_LS=y
  CONFIG_FEATURE_LS_FILETYPES=y
  CONFIG_FEATURE_LS_FOLLOWLINKS=y
 @@ -258,7 +258,7 @@ CONFIG_USLEEP=y
  # CONFIG_UUENCODE is not set
  CONFIG_WC=y
  # CONFIG_FEATURE_WC_LARGE is not set
 -CONFIG_WHO=y
 +# CONFIG_WHO is not set
  CONFIG_WHOAMI=y
  CONFIG_YES=y
  
 @@ -321,7 +321,7 @@ CONFIG_WHICH=y
  #
  # Editors
  #
 -CONFIG_AWK=y
 +# CONFIG_AWK is not set
  # CONFIG_FEATURE_AWK_LIBM is not set
  CONFIG_CMP=y
  CONFIG_DIFF=y
 @@ -329,7 +329,7 @@ CONFIG_DIFF=y
  CONFIG_FEATURE_DIFF_DIR=y
  # CONFIG_ED is not set
  CONFIG_PATCH=y
 -CONFIG_SED=y
 +# CONFIG_SED is not set
  CONFIG_VI=y
  CONFIG_FEATURE_VI_MAX_LEN=1024
  CONFIG_FEATURE_VI_8BIT=y
 @@ -368,13 +368,13 @@ CONFIG_FEATURE_FIND_SIZE=y
  CONFIG_FEATURE_FIND_PRUNE=y
  # CONFIG_FEATURE_FIND_DELETE is not set
  CONFIG_FEATURE_FIND_PATH=y
 -CONFIG_FEATURE_FIND_REGEX=y
 +# CONFIG_FEATURE_FIND_REGEX is not set
  # CONFIG_FEATURE_FIND_CONTEXT is not set
  # CONFIG_FEATURE_FIND_LINKS is not set
 -CONFIG_GREP=y
 -CONFIG_FEATURE_GREP_EGREP_ALIAS=y
 -CONFIG_FEATURE_GREP_FGREP_ALIAS=y
 -CONFIG_FEATURE_GREP_CONTEXT=y
 +# CONFIG_GREP is not set
 +# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
 +# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
 +# CONFIG_FEATURE_GREP_CONTEXT is not set
  CONFIG_XARGS=y
  # CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
  # CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
 @@ -384,15 +384,16 @@ CONFIG_XARGS=y
  #
  # Init Utilities
  #
 -# CONFIG_INIT is not set
 -# CONFIG_FEATURE_USE_INITTAB is not set
 +CONFIG_INIT=y
 +CONFIG_FEATURE_USE_INITTAB=y
  # CONFIG_FEATURE_KILL_REMOVED is not set
  CONFIG_FEATURE_KILL_DELAY=0
 -# CONFIG_FEATURE_INIT_SCTTY is not set
 -# CONFIG_FEATURE_INIT_SYSLOG is not set
 -# CONFIG_FEATURE_EXTRA_QUIET is not set
 -# CONFIG_FEATURE_INIT_COREDUMPS is not set
 -# CONFIG_FEATURE_INITRD is not set
 +CONFIG_FEATURE_INIT_SCTTY=y
 +CONFIG_FEATURE_INIT_SYSLOG=y
 +CONFIG_FEATURE_EXTRA_QUIET=y
 +CONFIG_FEATURE_INIT_COREDUMPS=y
 +CONFIG_FEATURE_INITRD=y
 +CONFIG_INIT_TERMINAL_TYPE="linux"
  CONFIG_HALT=y
  # CONFIG_FEATURE_CALL_TELINIT is not set
  CONFIG_TELINIT_PATH=""
 @@ -418,7 +419,7 @@ CONFIG_FIRST_SYSTEM_ID=0
  CONFIG_LAST_SYSTEM_ID=0
  # CONFIG_DELUSER is not set
  # CONFIG_GETTY is not set
 -CONFIG_FEATURE_UTMP=y
 +# CONFIG_FEATURE_UTMP is not set
  # CONFIG_FEATURE_WTMP is not set
  # CONFIG_LOGIN is not set
  # CONFIG_PAM is not set
 @@ -518,12 +519,12 @@ CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y
  CONFIG_LOSETUP=y
  # CONFIG_LSPCI is not set
  # CONFIG_LSUSB is not set
 -# CONFIG_MDEV is not set
 +CONFIG_MDEV=y
  # CONFIG_FEATURE_MDEV_CONF is not set
  # CONFIG_FEATURE_MDEV_RENAME is not set
  # CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
  # CONFIG_FEATURE_MDEV_EXEC is not set
 -# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
 +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
  CONFIG_MKSWAP=y
  # CONFIG_FEATURE_MKSWAP_UUID is not set
  CONFIG_MORE=y
 @@ -551,12 +552,12 @@ CONFIG_MOUNT=y
  # CONFIG_FEATURE_MOUNT_VERBOSE is not set
  # CONFIG_FEATURE_MOUNT_HELPERS is not set
  # CONFIG_FEATURE_MOUNT_LABEL is not set
 -CONFIG_FEATURE_MOUNT_NFS=y
 +# CONFIG_FEATURE_MOUNT_NFS is not set
  # CONFIG_FEATURE_MOUNT_CIFS is not set
  CONFIG_FEATURE_MOUNT_FLAGS=y
  CONFIG_FEATURE_MOUNT_FSTAB=y
  CONFIG_PIVOT_ROOT=y
 -CONFIG_RDATE=y
 +# CONFIG_RDATE is not set
  # CONFIG_RDEV is not set
  # CONFIG_READPROFILE is not set
  # CONFIG_RTCWAKE is not set
 @@ -617,10 +618,10 @@ CONFIG_DC=y
  # CONFIG_LAST is not set
  # CONFIG_FEATURE_LAST_SMALL is not set
  # CONFIG_FEATURE_LAST_FANCY is not set
 -CONFIG_LESS=y
 -CONFIG_FEATURE_LESS_MAXLINES=9999999
 -CONFIG_FEATURE_LESS_BRACKETS=y
 -CONFIG_FEATURE_LESS_FLAGS=y
 +# CONFIG_LESS is not set
 +CONFIG_FEATURE_LESS_MAXLINES=0
 +# CONFIG_FEATURE_LESS_BRACKETS is not set
 +# CONFIG_FEATURE_LESS_FLAGS is not set
  # CONFIG_FEATURE_LESS_MARKS is not set
  # CONFIG_FEATURE_LESS_REGEXP is not set
  # CONFIG_FEATURE_LESS_WINCH is not set
 @@ -658,9 +659,9 @@ CONFIG_TIME=y
  #
  # Networking Utilities
  #
 -CONFIG_FEATURE_IPV6=y
 +# CONFIG_FEATURE_IPV6 is not set
  # CONFIG_FEATURE_UNIX_LOCAL is not set
 -CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
 +# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
  # CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
  # CONFIG_ARP is not set
  # CONFIG_ARPING is not set
 @@ -676,7 +677,7 @@ CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
  # CONFIG_FTPGET is not set
  # CONFIG_FTPPUT is not set
  # CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
 -CONFIG_HOSTNAME=y
 +# CONFIG_HOSTNAME is not set
  # CONFIG_HTTPD is not set
  # CONFIG_FEATURE_HTTPD_RANGES is not set
  # CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set
 @@ -689,22 +690,22 @@ CONFIG_HOSTNAME=y
  # CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
  # CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
  # CONFIG_FEATURE_HTTPD_PROXY is not set
 -CONFIG_IFCONFIG=y
 -CONFIG_FEATURE_IFCONFIG_STATUS=y
 +# CONFIG_IFCONFIG is not set
 +# CONFIG_FEATURE_IFCONFIG_STATUS is not set
  # CONFIG_FEATURE_IFCONFIG_SLIP is not set
  # CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
 -CONFIG_FEATURE_IFCONFIG_HW=y
 +# CONFIG_FEATURE_IFCONFIG_HW is not set
  # CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
  # CONFIG_IFENSLAVE is not set
  # CONFIG_IFPLUGD is not set
 -CONFIG_IFUPDOWN=y
 -CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
 +# CONFIG_IFUPDOWN is not set
 +CONFIG_IFUPDOWN_IFSTATE_PATH=""
  # CONFIG_FEATURE_IFUPDOWN_IP is not set
  # CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set
 -CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN=y
 -CONFIG_FEATURE_IFUPDOWN_IPV4=y
 -CONFIG_FEATURE_IFUPDOWN_IPV6=y
 -CONFIG_FEATURE_IFUPDOWN_MAPPING=y
 +# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set
 +# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
 +# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
 +# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
  # CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
  # CONFIG_INETD is not set
  # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
 @@ -713,11 +714,11 @@ CONFIG_FEATURE_IFUPDOWN_MAPPING=y
  # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
  # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
  # CONFIG_FEATURE_INETD_RPC is not set
 -CONFIG_IP=y
 -CONFIG_FEATURE_IP_ADDRESS=y
 -CONFIG_FEATURE_IP_LINK=y
 -CONFIG_FEATURE_IP_ROUTE=y
 -CONFIG_FEATURE_IP_TUNNEL=y
 +# CONFIG_IP is not set
 +# CONFIG_FEATURE_IP_ADDRESS is not set
 +# CONFIG_FEATURE_IP_LINK is not set
 +# CONFIG_FEATURE_IP_ROUTE is not set
 +# CONFIG_FEATURE_IP_TUNNEL is not set
  # CONFIG_FEATURE_IP_RULE is not set
  # CONFIG_FEATURE_IP_SHORT_FORMS is not set
  # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
 @@ -731,57 +732,59 @@ CONFIG_FEATURE_IP_TUNNEL=y
  # CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
  # CONFIG_NAMEIF is not set
  # CONFIG_FEATURE_NAMEIF_EXTENDED is not set
 -CONFIG_NC=y
 +# CONFIG_NBDCLIENT is not set
 +# CONFIG_NC is not set
  # CONFIG_NC_SERVER is not set
  # CONFIG_NC_EXTRA is not set
 -CONFIG_NETSTAT=y
 +# CONFIG_NETSTAT is not set
  # CONFIG_FEATURE_NETSTAT_WIDE is not set
  # CONFIG_FEATURE_NETSTAT_PRG is not set
 -CONFIG_NSLOOKUP=y
 +# CONFIG_NSLOOKUP is not set
  # CONFIG_NTPD is not set
  # CONFIG_FEATURE_NTPD_SERVER is not set
 -CONFIG_PING=y
 -CONFIG_PING6=y
 -CONFIG_FEATURE_FANCY_PING=y
 +# CONFIG_PING is not set
 +# CONFIG_PING6 is not set
 +# CONFIG_FEATURE_FANCY_PING is not set
  # CONFIG_PSCAN is not set
 -CONFIG_ROUTE=y
 +# CONFIG_ROUTE is not set
  # CONFIG_SLATTACH is not set
 -CONFIG_TELNET=y
 +# CONFIG_TELNET is not set
  # CONFIG_FEATURE_TELNET_TTYPE is not set
 -CONFIG_FEATURE_TELNET_AUTOLOGIN=y
 +# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
  # CONFIG_TELNETD is not set
  # CONFIG_FEATURE_TELNETD_STANDALONE is not set
  # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
 -CONFIG_TFTP=y
 +# CONFIG_TFTP is not set
  # CONFIG_TFTPD is not set
 -CONFIG_FEATURE_TFTP_GET=y
 -CONFIG_FEATURE_TFTP_PUT=y
 +# CONFIG_FEATURE_TFTP_GET is not set
 +# CONFIG_FEATURE_TFTP_PUT is not set
  # CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
  # CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
  # CONFIG_TFTP_DEBUG is not set
 -CONFIG_TRACEROUTE=y
 +# CONFIG_TRACEROUTE is not set
  # CONFIG_TRACEROUTE6 is not set
  # CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
  # CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
  # CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
 -CONFIG_UDHCPD=y
 +# CONFIG_UDHCPD is not set
  # CONFIG_DHCPRELAY is not set
 -CONFIG_DUMPLEASES=y
 +# CONFIG_DUMPLEASES is not set
  # CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
 -CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases"
 -CONFIG_UDHCPC=y
 -CONFIG_FEATURE_UDHCPC_ARPING=y
 +CONFIG_DHCPD_LEASES_FILE=""
 +# CONFIG_UDHCPC is not set
 +# CONFIG_FEATURE_UDHCPC_ARPING is not set
  # CONFIG_FEATURE_UDHCP_PORT is not set
  CONFIG_UDHCP_DEBUG=0
  # CONFIG_FEATURE_UDHCP_RFC3397 is not set
 -CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
 -CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
 -CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"
 +CONFIG_UDHCPC_DEFAULT_SCRIPT=""
 +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
 +CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
  # CONFIG_VCONFIG is not set
 -CONFIG_WGET=y
 -CONFIG_FEATURE_WGET_STATUSBAR=y
 -CONFIG_FEATURE_WGET_AUTHENTICATION=y
 -CONFIG_FEATURE_WGET_LONG_OPTIONS=y
 +# CONFIG_WGET is not set
 +# CONFIG_FEATURE_WGET_STATUSBAR is not set
 +# CONFIG_FEATURE_WGET_AUTHENTICATION is not set
 +# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set
 +# CONFIG_FEATURE_WGET_TIMEOUT is not set
  # CONFIG_ZCIP is not set
  # CONFIG_TCPSVD is not set
  # CONFIG_TUNCTL is not set
 @@ -914,7 +917,7 @@ CONFIG_FEATURE_SH_EXTRA_QUIET=y
  #
  CONFIG_SYSLOGD=y
  CONFIG_FEATURE_ROTATE_LOGFILE=y
 -CONFIG_FEATURE_REMOTE_LOG=y
 +# CONFIG_FEATURE_REMOTE_LOG is not set
  # CONFIG_FEATURE_SYSLOGD_DUP is not set
  CONFIG_FEATURE_IPC_SYSLOG=y
  CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
  • linux-yocto related dependencies
    • perf

perf requires python perl elfutils as runtime dependency, but we don't need perf in minimal image, so drop them.

 diff --git a/meta/recipes-kernel/linux/linux-tools.inc b/meta/recipes-kernel/linux/linux-tools.inc
 index ef81650..991a827 100644
 --- a/meta/recipes-kernel/linux/linux-tools.inc
 +++ b/meta/recipes-kernel/linux/linux-tools.inc
 @@ -25,4 +25,4 @@ PERFDEPENDS_libc-uclibc = ""
  PERFRDEPENDS = "python perl elfutils"
  PERFRDEPENDS_libc-uclibc = ""
  do_compile_perf[depends] = "${PERFDEPENDS}"
 -RDEPENDS_perf += "${PERFRDEPENDS}"
 +#RDEPENDS_perf += "${PERFRDEPENDS}"
    • elfutils

When build linux-yocto(perf) will need libelf, so patch to elfutils only build libelf and remove depency "gettext"

 diff --git a/meta/recipes-devtools/elfutils/elfutils_0.148.bb b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
 index 2bedc05..2644687 100644
 --- a/meta/recipes-devtools/elfutils/elfutils_0.148.bb
 +++ b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
 @@ -41,7 +41,7 @@ SRC_URI += "\
          file://i386_dis.h \
          file://x86_64_dis.h \
  "
 -inherit autotools gettext
 +inherit autotools

  EXTRA_OECONF = "--program-prefix=eu-"
  EXTRA_OECONF_append_libc-uclibc = " ${@[, '--enable-uclibc']['${PN}' == '${BPN}']}"
 @@ -57,6 +57,7 @@ do_configure_prepend() {
  # build only libelf for uclibc case

  EXTRA_OEMAKE_libc-uclibc = "-C libelf"
 +EXTRA_OEMAKE = "-C libelf"
  EXTRA_OEMAKE_virtclass-native = ""
  EXTRA_OEMAKE_virtclass-nativesdk = ""

At last, we only enabled eglibc "libc-libm libc-crypt libc-posix-regexp(perf requires it)" in conf/local.conf and build minimal image with

 bitbake core-image-minimal

Then we will get the rootfs image looks like "core-image-minimal-mpc8315e-rdb-20110621065105.rootfs.tar.bz2", it takes 2.9M disk space after extraction.