linux内核编译相关注意点
在编译内核的时候可以使用config 、menuconfig 、make allyesconfig 等辅助内核的配置参数。
具体可能常用可选编译配置参数如下:
make config
make menuconfig
make oldconfig
make localmodconfig
make xconfig
make defconfig
make gconfig
make olddefconfig
1、make config
是文本式,对话式,基于命令行的一种配置。 一个一个的询问,比较麻烦。
2、make menuconfig
这是有菜单选项以及有辅助图形界面的配置,基于ncurses库。(常常使用)
3、make oldconfig
使用旧的(之前)的配置,当前存在的 .config 文件直接进行内核编译
4、make xconfig
真正意义上的用到了图形界面的配置,使用的是QT的库。由于会加载额外的库,并不是用得很多。
5、make deconfig
直接使用某个默认的配置,和配置内容相关,与使用何种配置方式无关。
6、make gconfig
使用的图形界面进行内核配置,可能看起来好看一些?使用的是GTK的库。
7、make localmodconfig
自动检测当前linux内核加载的内核模块,根据当前的linux内核加载模块情况自动添加相关的参数到 .config 文件中,然后用 make menuconfig 等手动配置内核的方式进行内核配置,可以简化部分内核模块的选择。
下面附上make 编译内核可选参数的有关内容。
"make config" Plain text interface.
"make menuconfig" Text based color menus, radiolists & dialogs.
"make nconfig" Enhanced text based color menus.
"make xconfig" Qt based configuration tool.
"make gconfig" GTK+ based configuration tool.
"make oldconfig" Default all questions based on the contents of
your existing ./.config file and asking about
new config symbols.
"make olddefconfig"
Like above, but sets new symbols to their default
values without prompting.
"make defconfig" Create a ./.config file by using the default
symbol values from either arch/$ARCH/defconfig
or arch/$ARCH/configs/${PLATFORM}_defconfig,
depending on the architecture.
"make ${PLATFORM}_defconfig"
Create a ./.config file by using the default
symbol values from
arch/$ARCH/configs/${PLATFORM}_defconfig.
Use "make help" to get a list of all available
platforms of your architecture.
"make allyesconfig"
Create a ./.config file by setting symbol
values to 'y' as much as possible.
"make allmodconfig"
Create a ./.config file by setting symbol
values to 'm' as much as possible.
"make allnoconfig" Create a ./.config file by setting symbol
values to 'n' as much as possible.
"make randconfig" Create a ./.config file by setting symbol
values to random values.
"make localmodconfig" Create a config based on current config and
loaded modules (lsmod). Disables any module
option that is not needed for the loaded modules.
To create a localmodconfig for another machine,
store the lsmod of that machine into a file
and pass it in as a LSMOD parameter.
Also, you can preserve modules in certain folders
or kconfig files by specifying their paths in
parameter LMC_KEEP.
target$ lsmod > /tmp/mylsmod
target$ scp /tmp/mylsmod host:/tmp
host$ make LSMOD=/tmp/mylsmod \
LMC_KEEP="drivers/usb:drivers/gpu:fs" \
localmodconfig
The above also works when cross compiling.
"make localyesconfig" Similar to localmodconfig, except it will convert