This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Support minimum kernel version for glibc build other than CT_KERNEL_VERSION


Sometimes you don't want to build glibc with --enable-kernel=
${CT_KERNEL_VERSION}.  For example, if you build a toolchain with 2.6.24
kernel headers, you may want to compile applications targeting a 2.6.23
kernel without getting "FATAL: kernel too old" errors at runtime.

crosstool-ng currently uses ${CT_KERNEL_VERSION} for --enable-kernel
(probably out of convenience).  However, --enable-kernel for glibc
really controls how much compatibility for older kernels gets compiled
into the libraries, so it can be considered independent from
CT_KERNEL_VERSION.

Make this a configuration option with a sane default (2.6.9) and update
the glibc/eglibc build scripts accordingly.

-- 
Nate Case <ncase@xes-inc.com>

Index: scripts/build/libc_glibc.sh
===================================================================
--- scripts/build/libc_glibc.sh	(revision 959)
+++ scripts/build/libc_glibc.sh	(working copy)
@@ -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";;
Index: scripts/build/libc_eglibc.sh
===================================================================
--- scripts/build/libc_eglibc.sh	(revision 959)
+++ scripts/build/libc_eglibc.sh	(working copy)
@@ -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_EGLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
 
     case "${CT_THREADS}" in
         nptl)           extra_config="${extra_config} --with-__thread --with-tls";;
Index: config/libc/glibc.in
===================================================================
--- config/libc/glibc.in	(revision 959)
+++ config/libc/glibc.in	(working copy)
@@ -134,3 +134,22 @@
       earlier.
       
       Eg.: crypt        (for very old glibces)
+
+config LIBC_GLIBC_MIN_KERNEL
+    string
+    prompt "Minimum kernel version supported"
+    default "2.6.9"
+    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".
Index: config/libc/eglibc.in
===================================================================
--- config/libc/eglibc.in	(revision 959)
+++ config/libc/eglibc.in	(working copy)
@@ -129,3 +129,22 @@
       earlier.
       
       Eg.: crypt        (for very old glibces)
+
+config LIBC_EGLIBC_MIN_KERNEL
+    string
+    prompt "Minimum kernel version supported"
+    default "2.6.9"
+    help
+      Specify the earliest Linux kernel version you want eglibc 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 eglibc 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".


--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]