ILD

CONFIG_BUG
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2026-3-24 站点:Inside Linux Development

在自己写的内核模块中,尝试使用WARN_ON(),结果发现没有任何警告。


原来是有一个内核选项控制BUG()和WARN()。

它就是CONFIG_BUG。


General setup

Configure standard kernel features (expert users) (EXPERT [=y]) 

BUG() support (BUG [=y])


Disabling this option eliminates support for BUG and WARN, reducing                                                                       │

the size of your kernel image and potentially quietly ignoring                                                                            │

numerous fatal conditions. You should only consider disabling this                                                                        │

option for embedded systems with no facilities for reporting errors.                                                                      │

Just say Y.


开启后内核镜像有变大180K。

-rwxr-xr-x 1 yuan yuan    5918728 Mar 18 09:42 Image

-rwxr-xr-x 1 yuan yuan    6098952 Mar 24 09:57 Image

Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.