From 64d804c4f65b4257b1507491cdc9a103c38999d4 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Mon, 7 May 2007 15:57:02 +0000 Subject: Fix glibc and uClibc downloading and extracting. Although we no longer need the kernel config file, we now need to specify the kernel source directory when installing headers. Re-order components downloading to match build order. Fix the saveSample.sh script in case the referenced files are the same as the destination files. diff --git a/scripts/build/kernel_linux.sh b/scripts/build/kernel_linux.sh index 985cd86..617740b 100644 --- a/scripts/build/kernel_linux.sh +++ b/scripts/build/kernel_linux.sh @@ -102,13 +102,17 @@ do_kernel_install() { esac CT_DoLog EXTRA "Installing kernel headers" - make ARCH=${CT_KERNEL_ARCH} \ + make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" \ + O="`pwd`" \ + ARCH=${CT_KERNEL_ARCH} \ INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ ${V_OPT} \ headers_install 2>&1 |CT_DoLog DEBUG CT_DoLog EXTRA "Checking installed headers" - make ARCH=${CT_KERNEL_ARCH} \ + make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}" \ + O="`pwd`" \ + ARCH=${CT_KERNEL_ARCH} \ INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \ ${V_OPT} \ headers_check 2>&1 |CT_DoLog DEBUG diff --git a/scripts/build/libc_glibc.sh b/scripts/build/libc_glibc.sh index 8b3a6d0..4100ca0 100644 --- a/scripts/build/libc_glibc.sh +++ b/scripts/build/libc_glibc.sh @@ -3,7 +3,7 @@ # Licensed under the GPL v2. See COPYING in the root of this package # Download glibc -do_libc_download() { +do_libc_get() { # Ah! Not all GNU folks seem stupid. All glibc releases are in the same # directory. Good. Alas, there is no snapshot there. I'll deal with them # later on... :-/ @@ -15,6 +15,8 @@ do_libc_download() { CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ftp://ftp.gnu.org/gnu/glibc done [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && CT_GetFile "${CT_LIBC}-ports-${CT_LIBC_VERSION}" ftp://ftp.gnu.org/gnu/glibc + + return 0 } # Extract glibc @@ -27,6 +29,8 @@ do_libc_extract() { CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" done [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && CT_ExtractAndPatch "${CT_LIBC}-ports-${CT_LIBC_VERSION}" + + return 0 } # There is nothing to do for glibc check config diff --git a/scripts/build/libc_uClibc.sh b/scripts/build/libc_uClibc.sh index 5b1504c..0981ce9 100644 --- a/scripts/build/libc_uClibc.sh +++ b/scripts/build/libc_uClibc.sh @@ -13,6 +13,8 @@ do_libc_get() { CT_GetFile "${CT_LIBC_FILE}" ${libc_src} # uClibc locales [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_GetFile "uClibc-locale-030818" ${libc_src} + + return 0 } # Extract uClibc @@ -20,6 +22,8 @@ do_libc_extract() { CT_ExtractAndPatch "${CT_LIBC_FILE}" # uClibc locales [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_ExtractAndPatch "uClibc-locale-030818" + + return 0 } # Check that uClibc has been previously configured diff --git a/scripts/crosstool.sh b/scripts/crosstool.sh index d12654e..d5feecb 100755 --- a/scripts/crosstool.sh +++ b/scripts/crosstool.sh @@ -330,9 +330,9 @@ if [ "${CT_NO_DOWNLOAD}" != "y" ]; then CT_DoStep INFO "Retrieving needed toolchain components' tarballs" do_kernel_get do_binutils_get - do_libc_get - do_libfloat_get do_cc_core_get + do_libfloat_get + do_libc_get do_cc_get CT_EndStep fi diff --git a/scripts/saveSample.sh b/scripts/saveSample.sh index 1d01c66..14d27d1 100755 --- a/scripts/saveSample.sh +++ b/scripts/saveSample.sh @@ -27,17 +27,34 @@ CT_LOG_LEVEL_MAX="INFO" # Target triplet: CT_TARGET needs a little love: CT_DoBuildTargetTriplet +# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR, +# re-parse them: +. "${CT_TOP_DIR}/.config" + # Create the sample directory [ -d "${CT_TOP_DIR}/samples/${CT_TARGET}" ] || svn mkdir "${CT_TOP_DIR}/samples/${CT_TARGET}" >/dev/null 2>&1 # Save the crosstool-NG config file cp "${CT_TOP_DIR}/.config" "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config" +# Function to copy a file to the sample directory +# Needed in case the file is already there (think of a previously available sample) +# Usage: CT_DoAddFileToSample +CT_DoAddFileToSample() { + source="$1" + dest="$2" + inode_s=`ls -i "${source}"` + inode_d=`ls -i "${dest}"` + if [ "${inode_s}" != "${inode_d}" ]; then + cp "${source}" "${dest}" + fi + svn add "${dest}" >/dev/null 2>&1 +} + # Save the kernel .config file if [ -n "${CT_KERNEL_LINUX_CONFIG_FILE}" ]; then # We save the file, and then point the saved sample to this file - cp "${CT_KERNEL_LINUX_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config" - svn add "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config" >/dev/null 2>&1 + CT_DoAddFileToSample "${CT_KERNEL_LINUX_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config" sed -r -i -e 's|^(CT_KERNEL_LINUX_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"|;' \ "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config" else @@ -50,8 +67,7 @@ fi # Save the uClibc .config file if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then # We save the file, and then point the saved sample to this file - cp "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config" - svn add "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config" >/dev/null 2>&1 + CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config" sed -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \ "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config" else -- cgit v0.10.2-6-g49f6