mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-22 14:12:26 +00:00
kernel/linux: simplify custom tarball handling
Simplify the way the custom tarball is handled: - fake version="custom" - at download, simply link the custom tarball to: "linux-custom.${custom_extension}" - at extract, the above allows to simply extract "linux-${LINUX_VERSION}" where LINUX_VERISON is set to the fake version="custom" Not that much convoluted, in fact... :-/ Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
parent
47229f15af
commit
59499a2cda
@ -18,11 +18,7 @@ config KERNEL_LINUX_USE_CUSTOM_HEADERS
|
|||||||
If you want to use your own full kernel tree, then you want to say 'N'
|
If you want to use your own full kernel tree, then you want to say 'N'
|
||||||
here, and select KERNEL_LINUX_CUSTOM, in the versions list, below.
|
here, and select KERNEL_LINUX_CUSTOM, in the versions list, below.
|
||||||
|
|
||||||
config KERNEL_LINUX_INSTALL
|
if ! KERNEL_LINUX_USE_CUSTOM_HEADERS
|
||||||
bool
|
|
||||||
default y if ! KERNEL_LINUX_USE_CUSTOM_HEADERS
|
|
||||||
|
|
||||||
if KERNEL_LINUX_INSTALL
|
|
||||||
|
|
||||||
choice
|
choice
|
||||||
bool
|
bool
|
||||||
@ -161,8 +157,9 @@ config KERNEL_VERSION
|
|||||||
default "2.6.32.44" if KERNEL_V_2_6_32_44
|
default "2.6.32.44" if KERNEL_V_2_6_32_44
|
||||||
default "2.6.31.14" if KERNEL_V_2_6_31_14
|
default "2.6.31.14" if KERNEL_V_2_6_31_14
|
||||||
default "2.6.27.59" if KERNEL_V_2_6_27_59
|
default "2.6.27.59" if KERNEL_V_2_6_27_59
|
||||||
|
default "custom" if KERNEL_LINUX_CUSTOM
|
||||||
|
|
||||||
endif # KERNEL_LINUX_INSTALL
|
endif # ! KERNEL_LINUX_USE_CUSTOM_HEADERS
|
||||||
|
|
||||||
if KERNEL_LINUX_USE_CUSTOM_HEADERS
|
if KERNEL_LINUX_USE_CUSTOM_HEADERS
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Linux kernel options
|
# Linux kernel options
|
||||||
|
|
||||||
if KERNEL_LINUX_INSTALL
|
if ! KERNEL_LINUX_USE_CUSTOM_HEADERS
|
||||||
|
|
||||||
choice
|
choice
|
||||||
bool
|
bool
|
||||||
@ -41,4 +41,4 @@ config KERNEL_LINUX_INSTALL_CHECK
|
|||||||
If you are in doubt that installed headers are buggy, say 'Y'
|
If you are in doubt that installed headers are buggy, say 'Y'
|
||||||
here to have an extra check passed onto the headers.
|
here to have an extra check passed onto the headers.
|
||||||
|
|
||||||
endif # KERNEL_LINUX_INSTALL
|
endif # ! KERNEL_LINUX_USE_CUSTOM_HEADERS
|
||||||
|
@ -18,9 +18,25 @@ CT_DoKernelTupleValues() {
|
|||||||
# Download the kernel
|
# Download the kernel
|
||||||
do_kernel_get() {
|
do_kernel_get() {
|
||||||
local k_ver
|
local k_ver
|
||||||
if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" \
|
local custom_name
|
||||||
-a "${CT_KERNEL_LINUX_CUSTOM}" != "y" \
|
|
||||||
]; then
|
if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
|
||||||
|
# Wee need to know the custom tarball extension,
|
||||||
|
# so we can cerate a properly-named symlink, which
|
||||||
|
# we use later on in 'extract'
|
||||||
|
case "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" in
|
||||||
|
*.tar.bz2) custom_name="linux-custom.tar.bz2";;
|
||||||
|
*.tar.gz|*.tgz) custom_name="linux-custom.tar.gz";;
|
||||||
|
*.tar) custom_name="linux-custom.tar";;
|
||||||
|
*) CT_Abort "Unknown extension for custom linux tarball '${CT_KERNEL_LINUX_CUSTOM_TARBALL}'";;
|
||||||
|
esac
|
||||||
|
CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" \
|
||||||
|
"${CT_SRC_DIR}/${custom_name}"
|
||||||
|
else # Not a custom tarball
|
||||||
case "${CT_KERNEL_VERSION}" in
|
case "${CT_KERNEL_VERSION}" in
|
||||||
2.6.*.*|3.*.*)
|
2.6.*.*|3.*.*)
|
||||||
# 4-part versions (for 2.6 stables and long-terms), and
|
# 4-part versions (for 2.6 stables and long-terms), and
|
||||||
@ -44,54 +60,22 @@ do_kernel_get() {
|
|||||||
|
|
||||||
# Extract kernel
|
# Extract kernel
|
||||||
do_kernel_extract() {
|
do_kernel_extract() {
|
||||||
local tar_opt
|
if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
|
||||||
if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then
|
return 0
|
||||||
if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
|
|
||||||
# We extract the custom linux tree into a directory with a
|
|
||||||
# well-known name, and strip the leading directory component
|
|
||||||
# of the extracted pathes. This is needed because we do not
|
|
||||||
# know the value for this first component, because it is a
|
|
||||||
# _custom_ tree.
|
|
||||||
# Also, we have to protect from partial extraction using the
|
|
||||||
# .extracting and .extracted locks (not using .patching and
|
|
||||||
# .patched as we are *not* patching that kernel).
|
|
||||||
|
|
||||||
if [ -e "${CT_SRC_DIR}/.linux-custom.extracted" ]; then
|
|
||||||
CT_DoLog DEBUG "Custom linux kernel tree already extracted"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
CT_TestAndAbort "Custom kernel tree partially extracted. Remove before resuming" -f "${CT_SRC_DIR}/.linux-custom.extracting"
|
|
||||||
CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.linux-custom.extracting"
|
|
||||||
CT_DoExecLog DEBUG mkdir "${CT_SRC_DIR}/linux-custom"
|
|
||||||
|
|
||||||
case "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" in
|
|
||||||
*.tar.bz2) tar_opt=-j;;
|
|
||||||
*.tar.gz|*.tgz) tar_opt=-z;;
|
|
||||||
*.tar) ;;
|
|
||||||
*) CT_Abort "Don't know how to handle '${CT_KERNEL_LINUX_CUSTOM_TARBALL}': unknown extension";;
|
|
||||||
esac
|
|
||||||
CT_DoLog EXTRA "Extracting custom linux kernel"
|
|
||||||
CT_DoExecLog ALL tar x -C "${CT_SRC_DIR}/linux-custom" \
|
|
||||||
--strip-components 1 -v ${tar_opt} \
|
|
||||||
-f "${CT_KERNEL_LINUX_CUSTOM_TARBALL}"
|
|
||||||
|
|
||||||
CT_DoExecLog ALL mv -v "${CT_SRC_DIR}/.linux-custom.extracting" "${CT_SRC_DIR}/.linux-custom.extracted"
|
|
||||||
else
|
|
||||||
CT_Extract "linux-${CT_KERNEL_VERSION}"
|
|
||||||
CT_Patch "linux" "${CT_KERNEL_VERSION}"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
# This also handles the custom tarball
|
||||||
|
CT_Extract "linux-${CT_KERNEL_VERSION}"
|
||||||
|
CT_Patch "linux" "${CT_KERNEL_VERSION}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wrapper to the actual headers install method
|
# Wrapper to the actual headers install method
|
||||||
do_kernel_headers() {
|
do_kernel_headers() {
|
||||||
CT_DoStep INFO "Installing kernel headers"
|
CT_DoStep INFO "Installing kernel headers"
|
||||||
|
|
||||||
if [ "${CT_KERNEL_LINUX_INSTALL}" = "y" ]; then
|
if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y" ]; then
|
||||||
do_kernel_install
|
|
||||||
else
|
|
||||||
do_kernel_custom
|
do_kernel_custom
|
||||||
|
else
|
||||||
|
do_kernel_install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CT_EndStep
|
CT_EndStep
|
||||||
|
Loading…
Reference in New Issue
Block a user