# HG changeset patch # User "Yann E. MORIN" # Date 1219786666 0 # Node ID 5d357e239b62f8dc20232308fd391426c60abe24 # Parent 72253e8a1155b808e8c755b366163e6c47d0ea19 Enable glibc to include support for kernel versions different than the version from the kernel headers. Thanks to Nate CASE 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(-) diff -r 72253e8a1155 -r 5d357e239b62 config/libc/glibc-eglibc-common.in --- a/config/libc/glibc-eglibc-common.in Tue Aug 26 21:30:22 2008 +0000 +++ b/config/libc/glibc-eglibc-common.in Tue Aug 26 21:37:46 2008 +0000 @@ -67,3 +67,47 @@ earlier. Eg.: crypt (for very old libces) + +config LIBC_GLIBC_USE_HEADERS_MIN_KERNEL + bool + prompt "Use headers version for minimum kernel version supported" + default y + help + If enabled, crosstool-ng will use the chosen version of kernel + headers for the glibc minimum kernel version supported, which is + what gets passed to "--enable-kernel=" when configuring glibc. + + Enabling this will ensure that no legacy compatibility code for + older kernels is built into your C libraries, but it will + be unable to run on kernel versions older than whichever kernel + headers version you've built the toolchain for. + + If you know for sure that your toolchain will never need to build + applications that will run under a kernel version older than your + chosen kernel headers version (CT_KERNEL_VERSION), you can choose + "y" here. + +config LIBC_GLIBC_MIN_KERNEL_CHOSEN + string + prompt "Minimum kernel version supported" + default "2.6.9" + depends on ! LIBC_GLIBC_USE_HEADERS_MIN_KERNEL + help + Specify the earliest Linux kernel version you want glibc to + include support for. This does not have to match the kernel + headers version used for your toolchain. This controls what is + passed to the "--enable-kernel=" option to the glibc configure + script. + + If you want to be able to statically link programs with your + toolchain's C library, make sure this kernel version is lower than + all kernels you wish to support to avoid "FATAL: kernel too old" + errors. The higher the version you specify, the less legacy code + will be built into libc. + + Most people can leave this at the default value of "2.6.9". + +config LIBC_GLIBC_MIN_KERNEL + string + default KERNEL_VERSION if LIBC_GLIBC_USE_HEADERS_MIN_KERNEL + default LIBC_GLIBC_MIN_KERNEL_CHOSEN if ! LIBC_GLIBC_USE_HEADERS_MIN_KERNEL diff -r 72253e8a1155 -r 5d357e239b62 scripts/build/libc_eglibc.sh --- a/scripts/build/libc_eglibc.sh Tue Aug 26 21:30:22 2008 +0000 +++ b/scripts/build/libc_eglibc.sh Tue Aug 26 21:37:46 2008 +0000 @@ -198,7 +198,7 @@ # We don't need to be conditional on wether the user did set different # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config - extra_config="--enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" + extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" case "${CT_THREADS}" in nptl) extra_config="${extra_config} --with-__thread --with-tls";; diff -r 72253e8a1155 -r 5d357e239b62 scripts/build/libc_glibc.sh --- a/scripts/build/libc_glibc.sh Tue Aug 26 21:30:22 2008 +0000 +++ b/scripts/build/libc_glibc.sh Tue Aug 26 21:37:46 2008 +0000 @@ -211,7 +211,7 @@ extra_config="" case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in *enable-kernel*) ;; - *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" + *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" esac case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in *-tls*) ;; @@ -314,7 +314,7 @@ # We don't need to be conditional on wether the user did set different # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config - extra_config="--enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" + extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" case "${CT_THREADS}" in nptl) extra_config="${extra_config} --with-__thread --with-tls";;