Skip to content

/proc 目录 ​

/proc 目录的组件名称为 proc, 相关内核选项为

ini
# File systems
# -> Pseudo filesystems
# -> /proc file system support
CONFIG_PROC_FS=y

检查工具为

bash
#!/bin/bash

source ./kernel_config_utils.sh

proc_check() {
    is_error=false
    if ! kernel_config_check CONFIG_PROC_FS; then
        is_error=true
    fi
    if [ "$is_error" == "true" ]; then
        return 1
    fi

    if ! [ -d /proc ]; then
        echo "missing dir /proc"
        return 1
    fi

    return 0
}

/proc/kcore 文件 ​

/proc/kcore 文件的组件名称为 proc_kcore, 依赖于组件 /proc 目录, 相关内核选项为

ini
# System Type
# -> MMU-based Paged Memory Management Support
CONFIG_MMU=y

# File systems
# -> Pseudo filesystems
# -> /proc file system support
# -> /proc/kcore support
CONFIG_PROC_KCORE=y

检查工具为

bash
#!/bin/bash

source ./kernel_config_utils.sh

proc_kcore_check() {
    is_error=false
    if ! kernel_config_check CONFIG_MMU; then
        is_error=true
    fi
    if ! kernel_config_check CONFIG_PROC_KCORE; then
        is_error=true
    fi
    if [ "$is_error" == "true" ]; then
        return 1
    fi

    if ! [ -e /proc/kcore ]; then
        echo "missing file /proc/kcore"
        return 1
    fi

    return 0
}

根据 Linux 内核源码的 fs/proc/Kconfig 文件中 symbol PROC_KCORE 的定义可知, CPU 架构为 armv7l 时此选项不可见.

/proc/config.gz 文件 ​

/proc/config.gz 文件的组件名称为 proc_config_gz, 依赖于组件 /proc 目录, 相关内核选项为

ini
# General setup
# -> Kernel .config support
CONFIG_IKCONFIG=y

# General setup
# -> Kernel .config support
# -> Enable access to .config through /proc/config.gz
CONFIG_IKCONFIG_PROC=y

检查工具为

bash
#!/bin/bash

source ./kernel_config_utils.sh

proc_config_gz_check() {
    is_error=false
    if ! kernel_config_check CONFIG_IKCONFIG configs; then
        is_error=true
    fi
    if ! kernel_config_check CONFIG_IKCONFIG_PROC; then
        is_error=true
    fi
    if [ "$is_error" == "true" ]; then
        return 1
    fi

    if ! [ -e /proc/config.gz ]; then
        echo "missing file /proc/config.gz"
        return 1
    fi

    return 0
}