From 02d2b29cdaefd315977bfad549416d6904f40d04 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Sun, 14 Sep 2008 18:09:36 +0000 Subject: 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(-) diff --git a/config/libc.in b/config/libc.in index d564752..27228d1 100644 --- a/config/libc.in +++ b/config/libc.in @@ -11,6 +11,20 @@ if ! BARE_METAL menu "C-library" +config LIBC_VERSION + string + help + Enter the date of the snapshot you want to use in the form: YYYYMMDD + where YYYY is the 4-digit year, MM the 2-digit month and DD the 2-digit + day in the month. + + Please note: + - glibc has snapshots done every monday, and only the last ten are kept. + - uClibc has daily snapshots, and only the last 30-or-so are kept. + + So if you want to be able to re-build your toolchain later, you will + have to save your C library tarball by yourself. + choice bool prompt "C-library to use:" @@ -22,10 +36,6 @@ config LIBC_GLIBC select LIBC_SUPPORT_NPTL select LIBC_SUPPORT_LINUXTHREADS -if LIBC_GLIBC -source config/libc/glibc.in -endif - config LIBC_EGLIBC bool prompt "eglibc (EXPERIMENTAL)" @@ -40,23 +50,14 @@ config LIBC_EGLIBC cross-compilation support. EGLIBC also includes some embedded ports (such as e500/spe) that are normally separate add-ons of GLIBC. -if LIBC_EGLIBC -source config/libc/eglibc.in -endif - config LIBC_UCLIBC bool prompt "uClibc" select LIBC_SUPPORT_LINUXTHREADS -if LIBC_UCLIBC -source config/libc/uClibc.in -endif - endchoice -config LIBC_VERSION - string +comment "Common C library options" config LIBC_SUPPORT_NPTL bool @@ -66,6 +67,12 @@ config LIBC_SUPPORT_LINUXTHREADS bool default n +config THREADS + string + default "nptl" if THREADS_NPTL + default "linuxthreads" if THREADS_LINUXTHREADS + default "none" if THREADS_NONE + choice bool prompt "Threading implementation to use:" @@ -89,24 +96,24 @@ config THREADS_NONE endchoice -config THREADS - string - default "nptl" if THREADS_NPTL - default "linuxthreads" if THREADS_LINUXTHREADS - default "none" if THREADS_NONE +if LIBC_GLIBC +source config/libc/glibc.in +endif -config LIBC_VERSION - help - Enter the date of the snapshot you want to use in the form: YYYYMMDD - where YYYY is the 4-digit year, MM the 2-digit month and DD the 2-digit - day in the month. - - Please note: - - glibc has snapshots done every monday, and only the last ten are kept. - - uClibc has daily snapshots, and only the last 30-or-so are kept. - - So if you want to be able to re-build your toolchain later, you will - have to save your C library tarball by yourself. +if LIBC_EGLIBC +source config/libc/eglibc.in +endif + +# Hack: mconf does not allow to include a file multiple times, +# so include glibc and eglibc common options from here, rather +# than from each config files. +if LIBC_GLIBC || LIBC_EGLIBC +source config/libc/glibc-eglibc-common.in +endif + +if LIBC_UCLIBC +source config/libc/uClibc.in +endif endmenu diff --git a/config/libc/eglibc-glibc-common.in b/config/libc/eglibc-glibc-common.in deleted file mode 120000 index b1ac70d..0000000 --- a/config/libc/eglibc-glibc-common.in +++ /dev/null @@ -1 +0,0 @@ -glibc-eglibc-common.in \ No newline at end of file diff --git a/config/libc/eglibc.in b/config/libc/eglibc.in index df9e782..0a0a8b3 100644 --- a/config/libc/eglibc.in +++ b/config/libc/eglibc.in @@ -1,5 +1,7 @@ # eglibc options +comment "eglibc specific options" + choice bool prompt "eglibc version" @@ -68,5 +70,3 @@ config EGLIBC_CHECKOUT Note that crosstool-NG will *not* update your working copy, you will have to do that yourself. - -source config/libc/eglibc-glibc-common.in diff --git a/config/libc/glibc-eglibc-common.in b/config/libc/glibc-eglibc-common.in index 6037fad..007c524 100644 --- a/config/libc/glibc-eglibc-common.in +++ b/config/libc/glibc-eglibc-common.in @@ -7,6 +7,8 @@ # If mconf is updated to accept multiple inclusion of the same # file, then the symlink can go (and the includers be updated). +comment "glibc/eglibc common options" + config LIBC_GLIBC_EXTRA_CONFIG string prompt "extra config" @@ -68,30 +70,57 @@ config LIBC_ADDONS_LIST Eg.: crypt (for very old libces) -config LIBC_GLIBC_USE_HEADERS_MIN_KERNEL +if KERNEL_LINUX + +choice bool - prompt "Use headers version for minimum kernel version supported" - default y + prompt "Minimum supported kernel version" + default LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS + +config LIBC_GLIBC_KERNEL_VERSION_NONE + bool + prompt "Let ./configure decide" help + Let ./configure decide what minimum kernel version glibc/eglibc + will be able to run against. + + This will inclde legacy compatibility code for older kernels in + the C library, thus ensuring that it will run on a large number + of old kernels. + + The minimum kernel version supported will be dependent upon the + target you build for. For example: + alpha*-*-linux-gnu Requires Linux 2.6.9 for NPTL + sh[34]-*-linux-gnu Requires Linux 2.6.11 + powerpc* Requires Linux 2.4.19 + arm*-*-linux-*gnueabi Requires Linux 2.6.16 + +config LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS + bool + prompt "Same as kernel headers (default)" + help + Normaly, you'll want glibc/eglibc to run against the same kernel + version as the one used for the headers. + + This is the default. + 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 +config LIBC_GLIBC_KERNEL_VERSION_CHOSEN + bool + prompt "Specific kernel version" help Specify the earliest Linux kernel version you want glibc to include support for. This does not have to match the kernel @@ -107,7 +136,34 @@ config LIBC_GLIBC_MIN_KERNEL_CHOSEN Most people can leave this at the default value of "2.6.9". +if LIBC_GLIBC_KERNEL_VERSION_CHOSEN + +config LIBC_GLIBC_MIN_KERNEL_VERSION + string + prompt "Minimum kernel version to support" + default "2.6.9" + help + Enter here the lowest kernel version glibc/eglibc will be able to + run against. + + The minimum kernel version supported will be dependent upon the + target you build for. For example: + alpha*-*-linux-gnu Requires Linux 2.6.9 for NPTL + sh[34]-*-linux-gnu Requires Linux 2.6.11 + powerpc* Requires Linux 2.4.19 + arm*-*-linux-*gnueabi Requires Linux 2.6.16 + + Note that no sanity check is performed by crosstool-NG to ensure + that the value you enter here is appropriate for your target. + +endif # LIBC_GLIBC_KERNEL_VERSION_CHOSEN + +endchoice + 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 + default "" if LIBC_GLIBC_KERNEL_VERSION_NONE + default KERNEL_VERSION if LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS + default LIBC_GLIBC_MIN_KERNEL_VERSION if LIBC_GLIBC_USE_HEADERS_MIN_KERNEL + +endif # KERNEL_LINUX diff --git a/config/libc/glibc.in b/config/libc/glibc.in index 546463b..9b25f17 100644 --- a/config/libc/glibc.in +++ b/config/libc/glibc.in @@ -1,5 +1,7 @@ # glibc options +comment "glibc specific options" + choice bool prompt "glibc version" @@ -72,5 +74,3 @@ config LIBC_GLIBC_CONFIGPARMS Note: this is awkward, doesn't work well if you need more than one line in configparms - -source config/libc/glibc-eglibc-common.in diff --git a/config/libc/uClibc.in b/config/libc/uClibc.in index 8de2755..885cc82 100644 --- a/config/libc/uClibc.in +++ b/config/libc/uClibc.in @@ -1,5 +1,7 @@ # uClibc options +comment "uClibc specific options" + choice bool prompt "uClibc version" diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index b864a5b..4873ed0 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -89,9 +89,21 @@ do_libc_headers() { addons_config="${addons_config//linuxthreads/}" addons_config=$(echo "${addons_config}" |sed -r -e 's/^,+//; s/,+$//; s/,+/,/g;') + extra_config="${addons_config}" + min_kernel_config= + case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in + *enable-kernel*) ;; + *) if [ "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" \ + -o "${CT_LIBC_GLIBC_USE_HEADERS_MIN_KERNEL}" = "y" ]; then + min_kernel_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" + fi + ;; + esac + extra_config="${extra_config} ${min_kernel_config}" + cross_cc=$(CT_Which "${CT_TARGET}-gcc") CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'" - CT_DoLog DEBUG "Extra config passed : '${addons_config}'" + CT_DoLog DEBUG "Extra config passed : '${extra_config}'" libc_cv_ppc_machine=yes \ CC=${cross_cc} \ @@ -104,7 +116,7 @@ do_libc_headers() { --without-cvs \ --disable-sanity-checks \ --enable-hacker-mode \ - ${addons_config} \ + ${extra_config} \ --without-nptl CT_DoLog EXTRA "Installing C library headers" @@ -208,11 +220,17 @@ do_libc_start_files() { CT_DoLog EXTRA "Configuring C library" # Add some default glibc config options if not given by user. - extra_config="" + extra_config= + min_kernel_config= case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in *enable-kernel*) ;; - *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" + *) if [ "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" \ + -o "${CT_LIBC_GLIBC_USE_HEADERS_MIN_KERNEL}" = "y" ]; then + min_kernel_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" + fi + ;; esac + extra_config="${extra_config} ${min_kernel_config}" case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in *-tls*) ;; *) extra_config="${extra_config} --with-tls" @@ -314,7 +332,17 @@ do_libc() { # 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_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" + extra_config= + min_kernel_config="" + case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in + *enable-kernel*) ;; + *) if [ "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" \ + -o "${CT_LIBC_GLIBC_USE_HEADERS_MIN_KERNEL}" = "y" ]; then + min_kernel_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" + fi + ;; + esac + extra_config="${extra_config} ${min_kernel_config}" case "${CT_THREADS}" in nptl) extra_config="${extra_config} --with-__thread --with-tls";; -- cgit v0.10.2-6-g49f6