Enable glibc to include support for kernel versions different than the version from the kernel headers.
Thanks to Nate CASE <ncase@xes-inc.com> for suggesting this use-case, and providing the patch.
/trunk/scripts/build/libc_glibc.sh | 4 2 2 0 +-
/trunk/scripts/build/libc_eglibc.sh | 2 1 1 0 +-
/trunk/config/libc/glibc-eglibc-common.in | 44 44 0 0 +++++++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 3 deletions(-)
1.1 --- a/config/libc/glibc-eglibc-common.in Tue Aug 26 21:30:22 2008 +0000
1.2 +++ b/config/libc/glibc-eglibc-common.in Tue Aug 26 21:37:46 2008 +0000
1.3 @@ -67,3 +67,47 @@
1.4 earlier.
1.5
1.6 Eg.: crypt (for very old libces)
1.7 +
1.8 +config LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
1.9 + bool
1.10 + prompt "Use headers version for minimum kernel version supported"
1.11 + default y
1.12 + help
1.13 + If enabled, crosstool-ng will use the chosen version of kernel
1.14 + headers for the glibc minimum kernel version supported, which is
1.15 + what gets passed to "--enable-kernel=" when configuring glibc.
1.16 +
1.17 + Enabling this will ensure that no legacy compatibility code for
1.18 + older kernels is built into your C libraries, but it will
1.19 + be unable to run on kernel versions older than whichever kernel
1.20 + headers version you've built the toolchain for.
1.21 +
1.22 + If you know for sure that your toolchain will never need to build
1.23 + applications that will run under a kernel version older than your
1.24 + chosen kernel headers version (CT_KERNEL_VERSION), you can choose
1.25 + "y" here.
1.26 +
1.27 +config LIBC_GLIBC_MIN_KERNEL_CHOSEN
1.28 + string
1.29 + prompt "Minimum kernel version supported"
1.30 + default "2.6.9"
1.31 + depends on ! LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
1.32 + help
1.33 + Specify the earliest Linux kernel version you want glibc to
1.34 + include support for. This does not have to match the kernel
1.35 + headers version used for your toolchain. This controls what is
1.36 + passed to the "--enable-kernel=" option to the glibc configure
1.37 + script.
1.38 +
1.39 + If you want to be able to statically link programs with your
1.40 + toolchain's C library, make sure this kernel version is lower than
1.41 + all kernels you wish to support to avoid "FATAL: kernel too old"
1.42 + errors. The higher the version you specify, the less legacy code
1.43 + will be built into libc.
1.44 +
1.45 + Most people can leave this at the default value of "2.6.9".
1.46 +
1.47 +config LIBC_GLIBC_MIN_KERNEL
1.48 + string
1.49 + default KERNEL_VERSION if LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
1.50 + default LIBC_GLIBC_MIN_KERNEL_CHOSEN if ! LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
2.1 --- a/scripts/build/libc_eglibc.sh Tue Aug 26 21:30:22 2008 +0000
2.2 +++ b/scripts/build/libc_eglibc.sh Tue Aug 26 21:37:46 2008 +0000
2.3 @@ -198,7 +198,7 @@
2.4 # We don't need to be conditional on wether the user did set different
2.5 # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
2.6
2.7 - extra_config="--enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
2.8 + extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
2.9
2.10 case "${CT_THREADS}" in
2.11 nptl) extra_config="${extra_config} --with-__thread --with-tls";;
3.1 --- a/scripts/build/libc_glibc.sh Tue Aug 26 21:30:22 2008 +0000
3.2 +++ b/scripts/build/libc_glibc.sh Tue Aug 26 21:37:46 2008 +0000
3.3 @@ -211,7 +211,7 @@
3.4 extra_config=""
3.5 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
3.6 *enable-kernel*) ;;
3.7 - *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
3.8 + *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
3.9 esac
3.10 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
3.11 *-tls*) ;;
3.12 @@ -314,7 +314,7 @@
3.13 # We don't need to be conditional on wether the user did set different
3.14 # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
3.15
3.16 - extra_config="--enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
3.17 + extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
3.18
3.19 case "${CT_THREADS}" in
3.20 nptl) extra_config="${extra_config} --with-__thread --with-tls";;