Linux kernel documentation翻译

英语原文链接:https://www.kernel.org/doc/Documentation/kbuild/kconfig.txt

This file contains some assistance for using “make *config”.
这篇文档包含了一些使用"make *config"相关语句进行编译配置时的帮助。

"make *config"指在编译uboot或者kernel时,将某些指代模块的字符串,写入如路径为include/linux/autoconf.h头文件中,从而被如include/linux/config.h头文件包含,从而使得,一些关心内核配置的驱动读取到config.h后,使得对应指定模块使能。

此段解释参考了[config]关于make *config文章。

Use “make help” to list all of the possible configuration targets.
使用“make help”命令可以列出所有可能的配置目标。

The xconfig (‘qconf’), menuconfig (‘mconf’), and nconfig (‘nconf’)
programs also have embedded help text. Be sure to check that for
navigation, search, and other general help text.
其它编译配置指令也包含帮助文档。最好去查看一下对应的引导、调查和一些别的概括性的帮助文档。


General
总述

New kernel releases often introduce new config symbols. Often more important, new kernel releases may rename config symbols. When this happens, using a previously working .config file and running “make oldconfig” won’t necessarily produce a working new kernel for you, so you may find that you need to see what NEW kernel symbols have been introduced.

新的内核版本发布往往引进了新的配置标识。往往更值得注意的是,随着新版本的内核发布,一些之前存在的配置标识名会发改变。当这一情况出现时,使用之前使用的.config配置文件且执行“make oldconfig”命令就不一定会生成那个按照你的想法运行的新内核了,所以你可能就发现,你需要清楚哪些新的内核标识被引进了。

To see a list of new config symbols, use
使用以下命令能够列出新的配置标识:

cp user/some/old.config .config
make listnewconfig

and the config program will list any new symbols, one per line.
并且这一指令将以每个新标识占一行的方式将其列出。

Alternatively, you can use the brute force method:
或者,你也可以使用比较直接的野蛮方法:

make oldconfig
scripts/diffconfig .config.old .config | less

Environment variables for ‘*config’
针对’*config’指令的环境变量

KCONFIG_CONFIG

This environment variable can be used to specify a default kernel config file name to override the default name of “.config”.
这一环境变量被用于指定一个默认的内核配置文件名(路径)以覆盖".config"这一原本默认名。

KCONFIG_OVERWRITECONFIG

If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not break symlinks when .config is a symlink to somewhere else.
如果你在环境中设置了这一变量,当.config文件是一个指向别处的符号链接时,Kconfig就不会断开它(符号链接)。

关于符号链接symlink
Symbolic Links are also known as Symlinks. Symlinks are used to create a shortcut for a given file or folder. Symlinks are very useful for different purposes which also prevents copy the same data over and over again.

符号链接可以叫做Symbolic Links或者Symlinks,作用是给一个存在的文件或者文件夹创建快捷方式。其在不同目的下都十分有用,也能防止同样的数据被往复多次地复制。

英文文本来自文章What Is Symbolic or Symlinks? How To Create Symlink For Windows and Linux?

关于Kconfig
其为各种配置界面的源文件,用于配置内核。在内核的配置工具读取了各个Kconfig后,生成配置界面,以供开发人员配置内核,最后生成配置文件.config。

该解释参考了文章Kconfig详解

CONFIG_

If you set CONFIG_ in the environment, Kconfig will prefix all symbols with its value when saving the configuration, instead of using the default,“CONFIG_”.
如果你在环境中设置了该变量,Kconfig将会在保存配置时,将所有的标识前加上它自己的前缀,而不是使用默认的"CONFIG_"情况。

这里的instead后的翻译我也没有很清楚…


Environment variables for ‘{allyes/allmod/allno/rand}config’
针对’{allyes/allmod/allno/rand}config’的环境变量

KCONFIG_ALLCONFIG

(partially based on lkml email from/by Rob Landley, re: miniconfig)
部分内容基于Rob Landley的邮件。


The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also use the environment variable KCONFIG_ALLCONFIG as a flag or a filename that contains config symbols that the user requires to be set to a specific value.
这些变量也能够将KCONFIG_ALLCONFIG这一环境变量作为判断变化的标识(flag)或者一个文件名,其会包含使用者所需要设置为特定值的配置标识。
If KCONFIG_ALLCONFIG is used without a filename where KCONFIG_ALLCONFIG == “” or KCONFIG_ALLCONFIG == “1”, “make *config” checks for a file named “all{yes/mod/no/def/random}.config” (corresponding to the *config command that was used) for symbol values that are to be forced. If this file is not found, it checks for a file named “all.config” to contain forced values.
如果KCONFIG_ALLCONFIG在类如KCONFIG_ALLCONFIG == “” 或 KCONFIG_ALLCONFIG == “1”,这般使用时,没有指定文件名,
“make config”
指令将在名为“all{yes/mod/no/def/random}.config”的文件(相当于
config被使用了)中检查得到将被强制使用的的标识值。

This enables you to create “miniature” config (miniconfig) or custom config files containing just the config symbols that you are interested in. Then the kernel config system generates the full .config file, including symbols of your miniconfig file.
这允许你创建迷你的或专属定制的配置文件,在其中你可以进包含你感兴趣的配置标识。在此之后,内核配置系统将生成完整的.config文件,其也会包含你自己的专属配置文件。

This ‘KCONFIG_ALLCONFIG’ file is a config file which contains
(usually a subset of all) preset config symbols. These variable
settings are still subject to normal dependency checks.
这一’KCONFIG_ALLCONFIG’文件是包含这预置的配置标识的一个配置文件(往往是所有标识的子集)。这些可变的设置选项也是依赖检查的目标。

Examples:
KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig
or
KCONFIG_ALLCONFIG=mini.config make allnoconfig
or
make KCONFIG_ALLCONFIG=mini.config allnoconfig

These examples will disable most options (allnoconfig) but enable or disable the options that are explicitly listed in the specified
mini-config files.
这些例子将使得大部分的选项无效,但也使得在迷你专属的配置文件中的特别列出的选项得到对应使能。


Environment variables for ‘randconfig’
'randconfig’涉及的环境变量

KCONFIG_SEED

You can set this to the integer value used to seed the RNG, if you want to somehow debug the behaviour of the kconfig parser/frontends.
你可以将这一变量设置为整数值,以其作为随机数生成器的种子,如果你希望调试某一kconfig文件分析(解析)器或前端?或者直接翻译为:在某个前后的时间?

RNG随机数生成器(random number generators)
其种子也就是生成伪随机数的式子中的一个系数。

Parser
将某种格式的文本(字符串)转换为某种数据结构的过程,如把程序文本转换为编译器内部的“抽象语法树”(AST)的数据结构。是编译器中必不可少的一个部分。
“我喜欢把 parser 称为“万里长征的第 0 步”,因为等你 parse 完毕得到了 AST,真正精华的编译技术才算开始。一个先进的编译器包含许多的步骤:语义分析,类型检查/推导,代码优化,机器代码生成,…… 这每个步骤都是在对某种中间数据结构(比如 AST)进行分析或者转化,它们完全不需要知道代码的字符串形式。也就是说,一旦代码通过了 parser,在后面的编译过程里,你就可以完全忘记 parser 的存在。所以 parser 对于编译器的地位,其实就像 ZIP 之于 JVM,就像 JPEG 之于 PhotoShop。Parser 虽然必不可少,然而它比起编译器里面最重要的过程,是处于一种辅助性,工具性,次要的地位。”

参考王垠:谈谈Parser

If not set, the current time will be used.
否则,将使用当前的时间。

KCONFIG_PROBABILITY

This variable can be used to skew the probabilities. This variable can be unset or empty, or set to three different formats:
这一变量可以用于影响概率(?)。这一变量可以不设置、被设置为空或者设置为以下三种格式。
KCONFIG_PROBABILITY y:n split yⓂ️n split
-----------------------------------------------------------------
unset or empty 50 : 50 33 : 33 : 34
N N : 100-N N/2 : N/2 : 100-N
[1] N:M N+M : 100-(N+M) N : M : 100-(N+M)
[2] N:M:L N : 100-N M : L : 100-(M+L)

where N, M and L are integers (in base 10) in the range [0,100], and so that:
[1] N+M is in the range [0,100]
[2] M+L is in the range [0,100]

Examples:
KCONFIG_PROBABILITY=10
10% of booleans will be set to ‘y’, 90% to ‘n’
5% of tristates will be set to ‘y’, 5% to ‘m’, 90% to ‘n’
KCONFIG_PROBABILITY=15:25
40% of booleans will be set to ‘y’, 60% to ‘n’
15% of tristates will be set to ‘y’, 25% to ‘m’, 60% to ‘n’
KCONFIG_PROBABILITY=10:15:15
10% of booleans will be set to ‘y’, 90% to ‘n’
15% of tristates will be set to ‘y’, 15% to ‘m’, 70% to ‘n’


Environment variables for ‘syncconfig’
'syncconfig’相关环境变量

KCONFIG_NOSILENTUPDATE

If this variable has a non-blank value, it prevents silent kernel config updates (requires explicit updates).
如果这一变量非空值,就会运行(要求是特定的更新)自动静默更新。

KCONFIG_AUTOCONFIG

This environment variable can be set to specify the path & name of the “auto.conf” file. Its default value is “include/config/auto.conf”.
这一环境变量可以设置"auto.conf"文件特定的路径或文件名。该变量的默认值为“include/config/auto.conf”。

KCONFIG_TRISTATE

This environment variable can be set to specify the path & name of the “tristate.conf” file. Its default value is “include/config/tristate.conf”.
这一环境变量可以设置"tristate.conf"文件特定的路径或文件名。该变量的默认值为“include/config/tristate.conf”。

KCONFIG_AUTOHEADER

This environment variable can be set to specify the path & name of the “autoconf.h” (header) file.Its default value is “include/generated/autoconf.h”.
这一环境变量可以设置"autoconf.h"文件特定的路径或文件名。该变量的默认值为“include/generated/autoconf.h”。

======================================================================

菜单配置
menuconfig

SEARCHING for CONFIG symbols
配置标识的搜索

Searching in menuconfig:

The Search function searches for kernel configuration symbol names, so you have to know something close to what you are looking for.

这一搜索功能能够搜索内核配置中的配置标识名,借此你可以尽量接近你所寻找的内容。

Example:
/hotplug
This lists all config symbols that contain “hotplug”,
e.g., HOTPLUG_CPU, MEMORY_HOTPLUG.
这将列出包含"hotplug"的配置标识,比如这两个。

For search help, enter / followed by TAB-TAB (to highlight ) and Enter. This will tell you that you can also use regular expressions (regexes) in the search string, so if you are not interested in MEMORY_HOTPLUG, you could try

/^hotplug

进一步地帮助搜索:请输入左斜杠“/”,并随即双击Tab键以高亮,然后输入回车键Enter。你也可以在搜索字符串中使用正则表达式,所以,如果你对MEMORY_HOTPLUG文件不感兴趣,你就可以试着使用:
这将滤掉以关键字hotplug结尾的配置标识。

正则表达式regular expression,又名regex,是一种文本模式,包括普通字符(如字母)和特殊字符(元字符如转义\),常用于匹配。
例子中的表达式/^hotplug表示仅接受hotplug开头的字符集合。

When searching, symbols are sorted thus:
- first, exact matches, sorted alphabetically (an exact match
is when the search matches the complete symbol name);
- then, other matches, sorted alphabetically.
For example: ^ATH.K matches:
ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG […] ATH6KL ATH6KL_DEBUG
[…] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON […]
of which only ATH5K and ATH9K match exactly and so are sorted
first (and in alphabetical order), then come all other symbols,
sorted in alphabetical order.

在搜索过程中,字符会被排序,一般以此方式:

首先,准配匹配的,按照字母表顺序进行排序,(准确匹配指搜索与完整的标识名匹配,不会多或少);
其次,其它匹配结果,也按照字母表顺序进行排序。

例子中的式子即表示从头开始为ATH,中间一个普通的位置字符,紧跟着有一个K。
准确匹配的结果为ATH5K ATH9K,它们按照第一种情况,字母表顺序进行了排序,其余的未准确匹配的也随其后按照字母表进行了排序。


User interface options for ‘menuconfig’
用户关于’menuconfig’的界面选项

MENUCONFIG_COLOR

It is possible to select different color themes using the variable MENUCONFIG_COLOR. To select a theme use:
通过MENUCONFIG_COLOR变量应该可以选择不同的颜色主题。选择一种主题可以使用:
make MENUCONFIG_COLOR= menuconfig

Available themes are:可使用的主题包括
mono => selects colors suitable for monochrome displays
blackbg => selects a color scheme with black background
classic => theme with blue background. The classic look
bluetitle => a LCD friendly version of classic. (default)

mono挑选了适合黑白的外观;blackbg选择了一种以黑色为背景色的颜色主题;classic是以蓝色为背景的经典外观主题;bluetitle是一种液晶显示屏友好的经典类型主题,也是默认主题。

MENUCONFIG_MODE

This mode shows all sub-menus in one large tree.
这一模式下,以树形图的模式,展开所有子菜单。
Example:
make MENUCONFIG_MODE=single_menu menuconfig

nconfig

nconfig is an alternate text-based configurator. It lists function keys across the bottom of the terminal (window) that execute commands.
You can also just use the corresponding numeric key to execute the commands unless you are in a data entry window. E.g., instead of F6 for Save, you can just press 6.
nconfig是另一个(alternate暂时翻译为另一个吧,感觉挺适合的)基于文本的配置器。它在终端(窗口)底层横列出能够执行命令的功能关键字。
你也可以使用相关的数字关键字来执行命令,除非你处于一个数据输入窗口。比如,可以直接键入6进行存储,而不是F6。
Use F1 for Global help or F3 for the Short help menu.
使用F1获取全局帮助或者F3获取简洁帮助菜单。
Searching in nconfig:

You can search either in the menu entry “prompt” strings or in the configuration symbols.
你可以选择在菜单项提示字符串或者配置标识中进行搜索。
Use / to begin a search through the menu entries. This does not support regular expressions. Use or for Next hit and Previous hit, respectively. Use to terminate the search mode.
使用“/”在菜单项开始一次搜索。但这种方式不支持正则表达式。使用上键或下键分别获取上一次或下一次访问。
F8 (SymSearch) searches the configuration symbols for the given string or regular expression (regex).
F8会根据所给的字符串或正则表达式搜索配置标识。

NCONFIG_MODE

This mode shows all sub-menus in one large tree.

Example:
make NCONFIG_MODE=single_menu nconfig

xconfig

Searching in xconfig:

The Search function searches for kernel configuration symbol names, so you have to know something close to what you are looking for.
这一搜索功能能够搜索内核配置标识名,所以你必须知晓你将要寻找的内容的相关内容
Example:
Ctrl-F hotplug
or
Menu: File, Search, hotplug

lists all config symbol entries that contain “hotplug” in the symbol name. In this Search dialog, you may change the config setting for any of the entries that are not grayed out.
You can also enter a different search string without having to return to the main menu.
列出包含 “hotplug” 的所有的配置标识词目。在搜索日志中,你可以选择更改配置设置所有没有被灰色化的词条项。你也可以输入一个不同的搜索字符串,且不一定要返回主菜单。

gconfig

Searching in gconfig:

There is no search command in gconfig. However, gconfig does have several different viewing choices, modes, and options.
在gconfig中没有搜索命令,但是,gconfig确实有着一些不同的浏览选项、模式。

全志R16平台编译linux系统V1.0.txt 2017/4/11 13:36 (编译请使用编译android的lichee的选项编译生成的.config文件,不然直接编译会报错!!!!) rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ tar zxvf lichee_parrotv1.1_20161202.tar.gz rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ cd lichee/ rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh config Welcome to mkscript setup progress All available chips: 0. sun8iw5p1 Choice: 0 All available platforms: 0. android 1. dragonboard 2. linux 3. tina Choice: 2 All available kernel: 0. linux-3.4 Choice: 0 All available boards: 0. bell-one 1. evb 2. evb-20 3. evb-30 4. evb-rtl8723bs 5. sc3813r Choice: 3 rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh 错误1: KCONFIG_AUTOCONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/auto.conf KCONFIG_AUTOHEADER=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/autoconf.h KCONFIG_TRISTATE=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/tristate.config BUILDROOT_CONFIG=/home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/.config /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/conf --silentoldconfig Config.in # # make dependencies written to .auto.deps # ATTENTION buildroot devels! # See top of this file before playing with this auto-preprequisites! # make[1]:正在离开目录 `/home/wwt/linux_r16/lichee/buildroot' You must install 'makeinfo' on your build machine makeinfo is usually part of the texinfo package in your distribution make: *** [dependencies] 错误 1 make:离开目录“/home/wwt/linux_r16/lichee/buildroot” ERROR: build buildroot Failed rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ d/buildroot-config/conf.o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buildroot/build/buildroot-config/zconf.tab.o -o /home/wwt/linux_r16/lichee/out/sun8iw5p1/linux/common/buil
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值