summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-01-22 21:35:02 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-01-22 21:35:02 (GMT)
commita150a97e4468caf1ef6167ee3a61b8fbaaac35d8 (patch)
tree686fd8eec106ae0fe6b58205e05c11f992e72906
parentb560936e0955bffbbc2959f30cddfc0bce41999f (diff)
libc/glibc: commonalise setting of the minimum supported kernel version
It will be possible to use that also with eglibc, so this hunk belongs to the common code. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
-rw-r--r--scripts/build/libc/glibc-eglibc.sh-common36
-rw-r--r--scripts/build/libc/glibc.sh29
2 files changed, 35 insertions, 30 deletions
diff --git a/scripts/build/libc/glibc-eglibc.sh-common b/scripts/build/libc/glibc-eglibc.sh-common
index 152d27a..75521cc 100644
--- a/scripts/build/libc/glibc-eglibc.sh-common
+++ b/scripts/build/libc/glibc-eglibc.sh-common
@@ -134,7 +134,7 @@ 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+=("$(do_libc_min_kernel_config)")
case "${CT_THREADS}" in
nptl) extra_config+=("--with-__thread" "--with-tls");;
@@ -252,3 +252,37 @@ do_libc_add_ons_list() {
addons_list="${addons_list%%${sep}}"
echo "${addons_list##${sep}}"
}
+
+# Compute up the minimum supported Linux kernel version
+do_libc_min_kernel_config() {
+ local min_kernel_config
+
+ case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
+ *--enable-kernel*) ;;
+ *) if [ "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" ]; then
+ # We can't rely on the kernel version from the configuration,
+ # because it might not be available if the user uses pre-installed
+ # headers. On the other hand, both method will have the kernel
+ # version installed in "usr/include/linux/version.h" in the sys-root.
+ # Parse that instead of having two code-paths.
+ version_code_file="${CT_SYSROOT_DIR}/usr/include/linux/version.h"
+ if [ ! -f "${version_code_file}" -o ! -r "${version_code_file}" ]; then
+ CT_Abort "Linux version is unavailable in installed headers files"
+ fi
+ version_code="$( grep -E LINUX_VERSION_CODE "${version_code_file}" \
+ |cut -d ' ' -f 3 \
+ )"
+ version=$(((version_code>>16)&0xFF))
+ patchlevel=$(((version_code>>8)&0xFF))
+ sublevel=$((version_code&0xFF))
+ min_kernel_config="${version}.${patchlevel}.${sublevel}"
+ elif [ "${CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then
+ # Trim the fourth part of the linux version, keeping only the first three numbers
+ min_kernel_config="$( echo "${CT_LIBC_GLIBC_MIN_KERNEL_VERSION}" \
+ |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')" \
+ )"
+ fi
+ echo "--enable-kernel=${min_kernel_config}"
+ ;;
+ esac
+}
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index fc30ada..d06a9a1 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -276,32 +276,3 @@ do_libc_add_ons_list() {
# Remove duplicate, leading and trailing separators
echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
}
-
-# Builds up the minimum supported Linux kernel version
-do_libc_min_kernel_config() {
- local min_kernel_config=
- case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
- *enable-kernel*) ;;
- *) if [ "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" ]; then
- # We can't rely on the kernel version from the configuration,
- # because it might not be available if the user uses pre-installed
- # headers. On the other hand, both method will have the kernel
- # version installed in "usr/include/linux/version.h" in the sys-root.
- # Parse that instead of having two code-paths.
- version_code_file="${CT_SYSROOT_DIR}/usr/include/linux/version.h"
- if [ ! -f "${version_code_file}" -o ! -r "${version_code_file}" ]; then
- CT_Abort "Linux version is unavailable in installed headers files"
- fi
- version_code=$(grep -E LINUX_VERSION_CODE "${version_code_file}" |cut -d ' ' -f 3)
- version=$(((version_code>>16)&0xFF))
- patchlevel=$(((version_code>>8)&0xFF))
- sublevel=$((version_code&0xFF))
- min_kernel_config="--enable-kernel=${version}.${patchlevel}.${sublevel}"
- elif [ "${CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then
- # Trim the fourth part of the linux version, keeping only the first three numbers
- min_kernel_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
- fi
- ;;
- esac
- echo "${min_kernel_config}"
-}