scripts/functions: Fix CT_ExtractGit function.
Change CT_ExtractGit so that it clones the repository, instead of just
symlinking it. After cloning, any given ref is checked out, or if no
ref is given, the HEAD of the repository is checked out.
This makes CT_Extract behave similar for git repositories as it does
for tarballs, so that it for example can be used for passing glibc-ports
as a git repository.
Signed-off-by: "Esben Haabendal" <esben.haabendal@prevas.dk>
[yann.morin.1998@anciens.enib.fr: fix incomplete var rename]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
1 # This file declares functions to install the kernel headers for linux
2 # Copyright 2007 Yann E. MORIN
3 # Licensed under the GPL v2. See COPYING in the root of this package
5 CT_DoKernelTupleValues() {
6 if [ "${CT_ARCH_USE_MMU}" = "y" ]; then
7 CT_TARGET_KERNEL="linux"
9 # Sometime, noMMU linux targets have a -uclinux tuple, while
10 # sometime it's -linux. We currently have only one noMMU linux
11 # target, and it uses -linux, so let's just use that. Time
12 # to fix that later...
13 # CT_TARGET_KERNEL="uclinux"
14 CT_TARGET_KERNEL="linux"
23 local korg_base mirror_base
25 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
29 if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
30 if [ ! -d "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
31 # Wee need to know the custom tarball extension,
32 # so we can create a properly-named symlink, which
33 # we use later on in 'extract'
34 case "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" in
35 *.tar.bz2) custom_name="linux-custom.tar.bz2";;
36 *.tar.gz|*.tgz) custom_name="linux-custom.tar.gz";;
37 *.tar) custom_name="linux-custom.tar";;
38 *) CT_Abort "Unknown extension for custom linux tarball '${CT_KERNEL_LINUX_CUSTOM_LOCATION}'";;
40 CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" \
41 "${CT_TARBALLS_DIR}/${custom_name}"
43 custom_name="linux-custom"
44 CT_DoExecLog DEBUG ln -s "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" \
45 "${CT_SRC_DIR}/${custom_name}"
47 else # Not a custom tarball
48 case "${CT_KERNEL_VERSION}" in
50 # 4-part versions (for 2.6 stables and long-terms), and
51 # 3-part versions (for 3.x.y stables and long-terms),
52 # we need to trash the last digit
53 k_ver="${CT_KERNEL_VERSION%.*}"
56 # 3-part version (for 2.6.x initial releases), and 2-part
57 # versions (for 3.x initial releases), use all of it
58 k_ver="${CT_KERNEL_VERSION}"
61 case "${CT_KERNEL_VERSION}" in
65 korg_base="http://ftp.kernel.org/pub/linux/kernel/${rel_dir}"
66 mirror_base="http://ftp.free.fr/mirrors/ftp.kernel.org//linux/kernel/${rel_dir}"
67 CT_GetFile "linux-${CT_KERNEL_VERSION}" \
68 "${korg_base}" "${korg_base}/longterm/v${k_ver}" \
69 "${mirror_base}" "${mirror_base}/longterm/v${k_ver}"
75 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" \
76 -o -d "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
80 # This also handles the custom tarball
81 CT_Extract "linux-${CT_KERNEL_VERSION}"
82 CT_Patch "linux" "${CT_KERNEL_VERSION}"
85 # Wrapper to the actual headers install method
87 CT_DoStep INFO "Installing kernel headers"
89 if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
98 # Install kernel headers using headers_install from kernel sources.
102 CT_DoLog DEBUG "Using kernel's headers_install"
104 mkdir -p "${CT_BUILD_DIR}/build-kernel-headers"
106 kernel_path="${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"
107 if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
108 kernel_path="${CT_SRC_DIR}/linux-custom"
110 V_OPT="V=${CT_KERNEL_LINUX_VERBOSE_LEVEL}"
112 CT_DoLog EXTRA "Installing kernel headers"
114 make -C "${kernel_path}" \
115 O="${CT_BUILD_DIR}/build-kernel-headers" \
117 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
121 if [ "${CT_KERNEL_LINUX_INSTALL_CHECK}" = "y" ]; then
122 CT_DoLog EXTRA "Checking installed headers"
124 make -C "${kernel_path}" \
125 O="${CT_BUILD_DIR}/build-kernel-headers" \
127 INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr" \
133 find "${CT_SYSROOT_DIR}" -type f \
134 \( -name '.install' \
135 -o -name '..install.cmd' \
137 -o -name '..check.cmd' \
142 # Use custom headers (most probably by using make headers_install in a
143 # modified (read: customised) kernel tree, or using pre-2.6.18 headers, such
144 # as 2.4). In this case, simply copy the headers in place
148 CT_DoLog EXTRA "Installing custom kernel headers"
150 mkdir -p "${CT_SYSROOT_DIR}/usr"
151 cd "${CT_SYSROOT_DIR}/usr"
152 if [ "${CT_KERNEL_LINUX_CUSTOM_IS_TARBALL}" = "y" ]; then
153 case "${CT_KERNEL_LINUX_CUSTOM_PATH}" in
155 *.tgz) tar_opt=--gzip;;
156 *.tar.gz) tar_opt=--gzip;;
157 *.tar.bz2) tar_opt=--bzip2;;
159 CT_DoExecLog ALL tar x ${tar_opt} -vf ${CT_KERNEL_LINUX_CUSTOM_PATH}
161 CT_DoExecLog ALL cp -rv "${CT_KERNEL_LINUX_CUSTOM_PATH}/include" .