Enhance setting the minimum kernel version glibc will run against.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Sep 14 18:09:36 2008 +0000 (2008-09-14)
changeset 852c17bb66e2aa5
parent 851 6add2c0b63cd
child 853 4309b90b030c
Enhance setting the minimum kernel version glibc will run against.
Ideally, eglibc should also benefit for that, but the current code does not set it.

/trunk/scripts/build/libc/glibc.sh | 38 33 5 0 +++++++++++++++---
/trunk/config/libc/glibc.in | 4 2 2 0 +-
/trunk/config/libc/uClibc.in | 2 2 0 0 +
/trunk/config/libc/eglibc.in | 4 2 2 0 +-
/trunk/config/libc/glibc-eglibc-common.in | 80 68 12 0 +++++++++++++++++++++++++++++++------
/trunk/config/libc.in | 69 38 31 0 ++++++++++++++++++--------------
6 files changed, 145 insertions(+), 52 deletions(-)
config/libc.in
config/libc/eglibc-glibc-common.in
config/libc/eglibc.in
config/libc/glibc-eglibc-common.in
config/libc/glibc.in
config/libc/uClibc.in
scripts/build/libc/glibc.sh
     1.1 --- a/config/libc.in	Sun Sep 14 16:54:12 2008 +0000
     1.2 +++ b/config/libc.in	Sun Sep 14 18:09:36 2008 +0000
     1.3 @@ -11,6 +11,20 @@
     1.4  
     1.5  menu "C-library"
     1.6  
     1.7 +config LIBC_VERSION
     1.8 +    string
     1.9 +    help
    1.10 +      Enter the date of the snapshot you want to use in the form: YYYYMMDD
    1.11 +      where YYYY is the 4-digit year, MM the 2-digit month and DD the 2-digit
    1.12 +      day in the month.
    1.13 +      
    1.14 +      Please note:
    1.15 +      - glibc has snapshots done every monday, and only the last ten are kept.
    1.16 +      - uClibc has daily snapshots, and only the last 30-or-so are kept.
    1.17 +      
    1.18 +      So if you want to be able to re-build your toolchain later, you will
    1.19 +      have to save your C library tarball by yourself.
    1.20 +
    1.21  choice
    1.22      bool
    1.23      prompt "C-library to use:"
    1.24 @@ -22,10 +36,6 @@
    1.25      select LIBC_SUPPORT_NPTL
    1.26      select LIBC_SUPPORT_LINUXTHREADS
    1.27  
    1.28 -if LIBC_GLIBC
    1.29 -source config/libc/glibc.in
    1.30 -endif
    1.31 -
    1.32  config LIBC_EGLIBC
    1.33      bool
    1.34      prompt "eglibc (EXPERIMENTAL)"
    1.35 @@ -40,23 +50,14 @@
    1.36        cross-compilation support.  EGLIBC also includes some embedded ports
    1.37        (such as e500/spe) that are normally separate add-ons of GLIBC.
    1.38  
    1.39 -if LIBC_EGLIBC
    1.40 -source config/libc/eglibc.in
    1.41 -endif
    1.42 -
    1.43  config LIBC_UCLIBC
    1.44      bool
    1.45      prompt "uClibc"
    1.46      select LIBC_SUPPORT_LINUXTHREADS
    1.47  
    1.48 -if LIBC_UCLIBC
    1.49 -source config/libc/uClibc.in
    1.50 -endif
    1.51 -
    1.52  endchoice
    1.53  
    1.54 -config LIBC_VERSION
    1.55 -    string
    1.56 +comment "Common C library options"
    1.57  
    1.58  config LIBC_SUPPORT_NPTL
    1.59      bool
    1.60 @@ -66,6 +67,12 @@
    1.61      bool
    1.62      default n
    1.63  
    1.64 +config THREADS
    1.65 +    string
    1.66 +    default "nptl"          if THREADS_NPTL
    1.67 +    default "linuxthreads"  if THREADS_LINUXTHREADS
    1.68 +    default "none"          if THREADS_NONE
    1.69 +
    1.70  choice
    1.71      bool
    1.72      prompt "Threading implementation to use:"
    1.73 @@ -89,24 +96,24 @@
    1.74  
    1.75  endchoice
    1.76  
    1.77 -config THREADS
    1.78 -    string
    1.79 -    default "nptl"          if THREADS_NPTL
    1.80 -    default "linuxthreads"  if THREADS_LINUXTHREADS
    1.81 -    default "none"          if THREADS_NONE
    1.82 +if LIBC_GLIBC
    1.83 +source config/libc/glibc.in
    1.84 +endif
    1.85  
    1.86 -config LIBC_VERSION
    1.87 -    help
    1.88 -      Enter the date of the snapshot you want to use in the form: YYYYMMDD
    1.89 -      where YYYY is the 4-digit year, MM the 2-digit month and DD the 2-digit
    1.90 -      day in the month.
    1.91 -      
    1.92 -      Please note:
    1.93 -      - glibc has snapshots done every monday, and only the last ten are kept.
    1.94 -      - uClibc has daily snapshots, and only the last 30-or-so are kept.
    1.95 -      
    1.96 -      So if you want to be able to re-build your toolchain later, you will
    1.97 -      have to save your C library tarball by yourself.
    1.98 +if LIBC_EGLIBC
    1.99 +source config/libc/eglibc.in
   1.100 +endif
   1.101 +
   1.102 +# Hack: mconf does not allow to include a file multiple times,
   1.103 +# so include glibc and eglibc common options from here, rather
   1.104 +# than from each config files.
   1.105 +if LIBC_GLIBC || LIBC_EGLIBC
   1.106 +source config/libc/glibc-eglibc-common.in
   1.107 +endif
   1.108 +
   1.109 +if LIBC_UCLIBC
   1.110 +source config/libc/uClibc.in
   1.111 +endif
   1.112  
   1.113  endmenu
   1.114  
     2.1 --- a/config/libc/eglibc-glibc-common.in	Sun Sep 14 16:54:12 2008 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,1 +0,0 @@
     2.4 -glibc-eglibc-common.in
     2.5 \ No newline at end of file
     3.1 --- a/config/libc/eglibc.in	Sun Sep 14 16:54:12 2008 +0000
     3.2 +++ b/config/libc/eglibc.in	Sun Sep 14 18:09:36 2008 +0000
     3.3 @@ -1,5 +1,7 @@
     3.4  # eglibc options
     3.5  
     3.6 +comment "eglibc specific options"
     3.7 +
     3.8  choice
     3.9      bool
    3.10      prompt "eglibc version"
    3.11 @@ -68,5 +70,3 @@
    3.12        
    3.13        Note that crosstool-NG will *not* update your working copy, you will
    3.14        have to do that yourself.
    3.15 -
    3.16 -source config/libc/eglibc-glibc-common.in
     4.1 --- a/config/libc/glibc-eglibc-common.in	Sun Sep 14 16:54:12 2008 +0000
     4.2 +++ b/config/libc/glibc-eglibc-common.in	Sun Sep 14 18:09:36 2008 +0000
     4.3 @@ -7,6 +7,8 @@
     4.4  # If mconf is updated to accept multiple inclusion of the same
     4.5  # file, then the symlink can go (and the includers be updated).
     4.6  
     4.7 +comment "glibc/eglibc common options"
     4.8 +
     4.9  config LIBC_GLIBC_EXTRA_CONFIG
    4.10      string
    4.11      prompt "extra config"
    4.12 @@ -68,30 +70,57 @@
    4.13  
    4.14        Eg.: crypt        (for very old libces)
    4.15  
    4.16 -config LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
    4.17 +if KERNEL_LINUX
    4.18 +
    4.19 +choice
    4.20      bool
    4.21 -    prompt "Use headers version for minimum kernel version supported"
    4.22 -    default y
    4.23 +    prompt "Minimum supported kernel version"
    4.24 +    default LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS
    4.25 +
    4.26 +config LIBC_GLIBC_KERNEL_VERSION_NONE
    4.27 +    bool
    4.28 +    prompt "Let ./configure decide"
    4.29      help
    4.30 +      Let ./configure decide what minimum kernel version glibc/eglibc
    4.31 +      will be able to run against.
    4.32 +      
    4.33 +      This will inclde legacy compatibility code for older kernels in
    4.34 +      the C library, thus ensuring that it will run on a large number
    4.35 +      of old kernels.
    4.36 +      
    4.37 +      The minimum kernel version supported will be dependent upon the
    4.38 +      target you build for. For example:
    4.39 +        alpha*-*-linux-gnu      Requires Linux 2.6.9 for NPTL
    4.40 +        sh[34]-*-linux-gnu      Requires Linux 2.6.11
    4.41 +        powerpc*                Requires Linux 2.4.19
    4.42 +        arm*-*-linux-*gnueabi   Requires Linux 2.6.16
    4.43 +
    4.44 +config LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS
    4.45 +    bool
    4.46 +    prompt "Same as kernel headers (default)"
    4.47 +    help
    4.48 +      Normaly, you'll want glibc/eglibc to run against the same kernel
    4.49 +      version as the one used for the headers.
    4.50 +      
    4.51 +      This is the default.
    4.52 +      
    4.53        If enabled, crosstool-ng will use the chosen version of kernel
    4.54        headers for the glibc minimum kernel version supported, which is
    4.55        what gets passed to "--enable-kernel=" when configuring glibc.
    4.56 -
    4.57 +      
    4.58        Enabling this will ensure that no legacy compatibility code for
    4.59        older kernels is built into your C libraries, but it will
    4.60        be unable to run on kernel versions older than whichever kernel
    4.61        headers version you've built the toolchain for.
    4.62 -
    4.63 +      
    4.64        If you know for sure that your toolchain will never need to build
    4.65        applications that will run under a kernel version older than your
    4.66        chosen kernel headers version (CT_KERNEL_VERSION), you can choose
    4.67        "y" here.
    4.68  
    4.69 -config LIBC_GLIBC_MIN_KERNEL_CHOSEN
    4.70 -    string
    4.71 -    prompt "Minimum kernel version supported"
    4.72 -    default "2.6.9"
    4.73 -    depends on ! LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
    4.74 +config LIBC_GLIBC_KERNEL_VERSION_CHOSEN
    4.75 +    bool
    4.76 +    prompt "Specific kernel version"
    4.77      help
    4.78        Specify the earliest Linux kernel version you want glibc to
    4.79        include support for.  This does not have to match the kernel
    4.80 @@ -107,7 +136,34 @@
    4.81  
    4.82        Most people can leave this at the default value of "2.6.9".
    4.83  
    4.84 +if LIBC_GLIBC_KERNEL_VERSION_CHOSEN
    4.85 +
    4.86 +config LIBC_GLIBC_MIN_KERNEL_VERSION
    4.87 +    string
    4.88 +    prompt "Minimum kernel version to support"
    4.89 +    default "2.6.9"
    4.90 +    help
    4.91 +      Enter here the lowest kernel version glibc/eglibc will be able to
    4.92 +      run against.
    4.93 +      
    4.94 +      The minimum kernel version supported will be dependent upon the
    4.95 +      target you build for. For example:
    4.96 +        alpha*-*-linux-gnu      Requires Linux 2.6.9 for NPTL
    4.97 +        sh[34]-*-linux-gnu      Requires Linux 2.6.11
    4.98 +        powerpc*                Requires Linux 2.4.19
    4.99 +        arm*-*-linux-*gnueabi   Requires Linux 2.6.16
   4.100 +      
   4.101 +      Note that no sanity check is performed by crosstool-NG to ensure
   4.102 +      that the value you enter here is appropriate for your target.
   4.103 +
   4.104 +endif # LIBC_GLIBC_KERNEL_VERSION_CHOSEN
   4.105 +
   4.106 +endchoice
   4.107 +
   4.108  config LIBC_GLIBC_MIN_KERNEL
   4.109      string
   4.110 -    default KERNEL_VERSION if LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
   4.111 -    default LIBC_GLIBC_MIN_KERNEL_CHOSEN if ! LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
   4.112 +    default ""                            if LIBC_GLIBC_KERNEL_VERSION_NONE
   4.113 +    default KERNEL_VERSION                if LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS
   4.114 +    default LIBC_GLIBC_MIN_KERNEL_VERSION if LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
   4.115 +
   4.116 +endif # KERNEL_LINUX
     5.1 --- a/config/libc/glibc.in	Sun Sep 14 16:54:12 2008 +0000
     5.2 +++ b/config/libc/glibc.in	Sun Sep 14 18:09:36 2008 +0000
     5.3 @@ -1,5 +1,7 @@
     5.4  # glibc options
     5.5  
     5.6 +comment "glibc specific options"
     5.7 +
     5.8  choice
     5.9      bool
    5.10      prompt "glibc version"
    5.11 @@ -72,5 +74,3 @@
    5.12  
    5.13        Note: this is awkward, doesn't work well if you need more than one
    5.14              line in configparms
    5.15 -
    5.16 -source config/libc/glibc-eglibc-common.in
     6.1 --- a/config/libc/uClibc.in	Sun Sep 14 16:54:12 2008 +0000
     6.2 +++ b/config/libc/uClibc.in	Sun Sep 14 18:09:36 2008 +0000
     6.3 @@ -1,5 +1,7 @@
     6.4  # uClibc options
     6.5  
     6.6 +comment "uClibc specific options"
     6.7 +
     6.8  choice
     6.9      bool
    6.10      prompt "uClibc version"
     7.1 --- a/scripts/build/libc/glibc.sh	Sun Sep 14 16:54:12 2008 +0000
     7.2 +++ b/scripts/build/libc/glibc.sh	Sun Sep 14 18:09:36 2008 +0000
     7.3 @@ -89,9 +89,21 @@
     7.4      addons_config="${addons_config//linuxthreads/}"
     7.5      addons_config=$(echo "${addons_config}" |sed -r -e 's/^,+//; s/,+$//; s/,+/,/g;')
     7.6  
     7.7 +    extra_config="${addons_config}"
     7.8 +    min_kernel_config=
     7.9 +    case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
    7.10 +        *enable-kernel*) ;;
    7.11 +        *)  if [    "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" \
    7.12 +                 -o "${CT_LIBC_GLIBC_USE_HEADERS_MIN_KERNEL}" = "y"    ]; then
    7.13 +                min_kernel_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
    7.14 +            fi
    7.15 +            ;;
    7.16 +    esac
    7.17 +    extra_config="${extra_config} ${min_kernel_config}"
    7.18 +
    7.19      cross_cc=$(CT_Which "${CT_TARGET}-gcc")
    7.20      CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
    7.21 -    CT_DoLog DEBUG "Extra config passed : '${addons_config}'"
    7.22 +    CT_DoLog DEBUG "Extra config passed : '${extra_config}'"
    7.23  
    7.24      libc_cv_ppc_machine=yes                     \
    7.25      CC=${cross_cc}                              \
    7.26 @@ -104,7 +116,7 @@
    7.27          --without-cvs                           \
    7.28          --disable-sanity-checks                 \
    7.29          --enable-hacker-mode                    \
    7.30 -        ${addons_config}                        \
    7.31 +        ${extra_config}                         \
    7.32          --without-nptl
    7.33  
    7.34      CT_DoLog EXTRA "Installing C library headers"
    7.35 @@ -208,11 +220,17 @@
    7.36      CT_DoLog EXTRA "Configuring C library"
    7.37  
    7.38      # Add some default glibc config options if not given by user.
    7.39 -    extra_config=""
    7.40 +    extra_config=
    7.41 +    min_kernel_config=
    7.42      case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
    7.43          *enable-kernel*) ;;
    7.44 -        *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
    7.45 +        *)  if [    "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" \
    7.46 +                 -o "${CT_LIBC_GLIBC_USE_HEADERS_MIN_KERNEL}" = "y"    ]; then
    7.47 +                min_kernel_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
    7.48 +            fi
    7.49 +            ;;
    7.50      esac
    7.51 +    extra_config="${extra_config} ${min_kernel_config}"
    7.52      case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
    7.53          *-tls*) ;;
    7.54          *) extra_config="${extra_config} --with-tls"
    7.55 @@ -314,7 +332,17 @@
    7.56      # We don't need to be conditional on wether the user did set different
    7.57      # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
    7.58  
    7.59 -    extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
    7.60 +    extra_config=
    7.61 +    min_kernel_config=""
    7.62 +    case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
    7.63 +        *enable-kernel*) ;;
    7.64 +        *)  if [    "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" \
    7.65 +                 -o "${CT_LIBC_GLIBC_USE_HEADERS_MIN_KERNEL}" = "y"    ]; then
    7.66 +                min_kernel_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
    7.67 +            fi
    7.68 +            ;;
    7.69 +    esac
    7.70 +    extra_config="${extra_config} ${min_kernel_config}"
    7.71  
    7.72      case "${CT_THREADS}" in
    7.73          nptl)           extra_config="${extra_config} --with-__thread --with-tls";;