/[gentoo-x86]/eclass/linux-info.eclass
Gentoo

Diff of /eclass/linux-info.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.78 Revision 1.79
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.78 2010/01/10 08:47:01 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.79 2010/01/10 09:01:38 robbat2 Exp $
4# 4#
5# Original author: John Mylchreest <johnm@gentoo.org> 5# Original author: John Mylchreest <johnm@gentoo.org>
6# Maintainer: kernel-misc@gentoo.org 6# Maintainer: kernel-misc@gentoo.org
7# 7#
8# Please direct your bugs to the current eclass maintainer :) 8# Please direct your bugs to the current eclass maintainer :)
99# @ECLASS-VARIABLE: KV_OUT_DIR 99# @ECLASS-VARIABLE: KV_OUT_DIR
100# @DESCRIPTION: 100# @DESCRIPTION:
101# A read-only variable. It's a string containing the kernel object directory, will be KV_DIR unless 101# A read-only variable. It's a string containing the kernel object directory, will be KV_DIR unless
102# KBUILD_OUTPUT is used. This should be used for referencing .config. 102# KBUILD_OUTPUT is used. This should be used for referencing .config.
103 103
104# @ECLASS-VARIABLE: I_KNOW_WHAT_I_AM_DOING
105# @DESCRIPTION:
106# Temporary variable for the migration to making linux-info non-fatal.
107
108# And to ensure all the weirdness with crosscompile 104# And to ensure all the weirdness with crosscompile
109inherit toolchain-funcs versionator 105inherit toolchain-funcs versionator
110 106
111EXPORT_FUNCTIONS pkg_setup 107EXPORT_FUNCTIONS pkg_setup
112 108
113DEPEND="" 109DEPEND=""
114RDEPEND="" 110RDEPEND=""
115
116[ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && \
117DEPEND="kernel_linux? ( virtual/linux-sources )"
118 111
119# Overwritable environment Var's 112# Overwritable environment Var's
120# --------------------------------------- 113# ---------------------------------------
121KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}" 114KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}"
122 115
252# @RETURN: true or false 245# @RETURN: true or false
253# @DESCRIPTION: 246# @DESCRIPTION:
254# It returns true if .config exists in /proc, otherwise false 247# It returns true if .config exists in /proc, otherwise false
255linux_config_bin_exists() { 248linux_config_bin_exists() {
256 export _LINUX_CONFIG_EXISTS_DONE=1 249 export _LINUX_CONFIG_EXISTS_DONE=1
257 [ -n "${I_KNOW_WHAT_I_AM_DOING}" -a -s "/proc/config.gz" ] 250 [ -s "/proc/config.gz" ]
258} 251}
259 252
260# @FUNCTION: linux_config_exists 253# @FUNCTION: linux_config_exists
261# @RETURN: true or false 254# @RETURN: true or false
262# @DESCRIPTION: 255# @DESCRIPTION:
290# If linux_config_exists returns false, the results of this are UNDEFINED. You 283# If linux_config_exists returns false, the results of this are UNDEFINED. You
291# MUST call linux_config_exists first. 284# MUST call linux_config_exists first.
292linux_chkconfig_present() { 285linux_chkconfig_present() {
293 linux_config_qa_check linux_chkconfig_present 286 linux_config_qa_check linux_chkconfig_present
294 local RESULT 287 local RESULT
295 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
296 local config 288 local config
297 config="${KV_OUT_DIR}/.config" 289 config="${KV_OUT_DIR}/.config"
298 [ ! -f "${config}" ] && config="/proc/config.gz" 290 [ ! -f "${config}" ] && config="/proc/config.gz"
299 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")" 291 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")"
300 [ "${RESULT}" = "m" -o "${RESULT}" = "y" ] && return 0 || return 1 292 [ "${RESULT}" = "m" -o "${RESULT}" = "y" ] && return 0 || return 1
308# If linux_config_exists returns false, the results of this are UNDEFINED. You 300# If linux_config_exists returns false, the results of this are UNDEFINED. You
309# MUST call linux_config_exists first. 301# MUST call linux_config_exists first.
310linux_chkconfig_module() { 302linux_chkconfig_module() {
311 linux_config_qa_check linux_chkconfig_module 303 linux_config_qa_check linux_chkconfig_module
312 local RESULT 304 local RESULT
313 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
314 local config 305 local config
315 config="${KV_OUT_DIR}/.config" 306 config="${KV_OUT_DIR}/.config"
316 [ ! -f "${config}" ] && config="/proc/config.gz" 307 [ ! -f "${config}" ] && config="/proc/config.gz"
317 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")" 308 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")"
318 [ "${RESULT}" = "m" ] && return 0 || return 1 309 [ "${RESULT}" = "m" ] && return 0 || return 1
326# If linux_config_exists returns false, the results of this are UNDEFINED. You 317# If linux_config_exists returns false, the results of this are UNDEFINED. You
327# MUST call linux_config_exists first. 318# MUST call linux_config_exists first.
328linux_chkconfig_builtin() { 319linux_chkconfig_builtin() {
329 linux_config_qa_check linux_chkconfig_builtin 320 linux_config_qa_check linux_chkconfig_builtin
330 local RESULT 321 local RESULT
331 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
332 local config 322 local config
333 config="${KV_OUT_DIR}/.config" 323 config="${KV_OUT_DIR}/.config"
334 [ ! -f "${config}" ] && config="/proc/config.gz" 324 [ ! -f "${config}" ] && config="/proc/config.gz"
335 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")" 325 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")"
336 [ "${RESULT}" = "y" ] && return 0 || return 1 326 [ "${RESULT}" = "y" ] && return 0 || return 1
343# It prints the CONFIG_<option> value of the current kernel .config (it requires a configured kernel). 333# It prints the CONFIG_<option> value of the current kernel .config (it requires a configured kernel).
344# If linux_config_exists returns false, the results of this are UNDEFINED. You 334# If linux_config_exists returns false, the results of this are UNDEFINED. You
345# MUST call linux_config_exists first. 335# MUST call linux_config_exists first.
346linux_chkconfig_string() { 336linux_chkconfig_string() {
347 linux_config_qa_check linux_chkconfig_string 337 linux_config_qa_check linux_chkconfig_string
348 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
349 local config 338 local config
350 config="${KV_OUT_DIR}/.config" 339 config="${KV_OUT_DIR}/.config"
351 [ ! -f "${config}" ] && config="/proc/config.gz" 340 [ ! -f "${config}" ] && config="/proc/config.gz"
352 getfilevar_noexec "CONFIG_${1}" "${config}" 341 getfilevar_noexec "CONFIG_${1}" "${config}"
353} 342}
676 config_required=1 665 config_required=1
677 break 666 break
678 fi 667 fi
679 done 668 done
680 669
681 # TODO: After we enable the new code for /proc/config.gz, we need to
682 # change this back to linux_config_exists.
683 if [[ ${config_required} == 0 ]]; then 670 if [[ ${config_required} == 0 ]]; then
684 # In the case where we don't require a .config, we can now bail out 671 # In the case where we don't require a .config, we can now bail out
685 # if the user has no .config as there is nothing to do. Otherwise 672 # if the user has no .config as there is nothing to do. Otherwise
686 # code later will cause a failure due to missing .config. 673 # code later will cause a failure due to missing .config.
687 if ! linux_config_src_exists; then 674 if ! linux_config_exists; then
688 ewarn "Unable to check for the following kernel config options due" 675 ewarn "Unable to check for the following kernel config options due"
689 ewarn "to absence of any configured kernel sources or compiled" 676 ewarn "to absence of any configured kernel sources or compiled"
690 ewarn "config:" 677 ewarn "config:"
691 for config in ${CONFIG_CHECK}; do 678 for config in ${CONFIG_CHECK}; do
692 local_error="ERROR_${config#\~}" 679 local_error="ERROR_${config#\~}"
700 ewarn "You're on your own to make sure they are set if needed." 687 ewarn "You're on your own to make sure they are set if needed."
701 export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}" 688 export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
702 return 0 689 return 0
703 fi 690 fi
704 else 691 else
705 [ -n "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel 692 require_configured_kernel
706 fi 693 fi
707 694
708 einfo "Checking for suitable kernel configuration options..." 695 einfo "Checking for suitable kernel configuration options..."
709 696
710 for config in ${CONFIG_CHECK} 697 for config in ${CONFIG_CHECK}

Legend:
Removed from v.1.78  
changed lines
  Added in v.1.79

  ViewVC Help
Powered by ViewVC 1.1.20