-
Notifications
You must be signed in to change notification settings - Fork 86
Linux 内核编译指南
Mike Wang edited this page Jun 15, 2025
·
1 revision
如果您当前的 Linux 内核缺少 FakeHTTP 的相关依赖,那么重新编译内核是一个解决途径。
如果您是第一次编译 Linux 内核,建议结合相关教程阅读下文。
-
准备好 Linux 内核源码,并进入源码目录。
如果使用主线(mainline)源码,可以从 https://www.kernel.org/pub/linux/kernel/ 下载到。
-
导出当前的内核配置至
.config
文件zcat /proc/config.gz > .config
-
使用以下命令启用相关内核配置。也可以将
--enable
改为--module
以内核模块形式编译。scripts/config --enable CONFIG_INET scripts/config --enable CONFIG_NET scripts/config --enable CONFIG_NETFILTER scripts/config --enable CONFIG_NETFILTER_NETLINK scripts/config --enable CONFIG_NETFILTER_NETLINK_QUEUE scripts/config --enable CONFIG_NETFILTER_XTABLES scripts/config --enable CONFIG_NETFILTER_XT_CONNMARK scripts/config --enable CONFIG_NETFILTER_XT_MARK scripts/config --enable CONFIG_NETFILTER_XT_MATCH_CONNBYTES scripts/config --enable CONFIG_NETFILTER_XT_MATCH_LENGTH scripts/config --enable CONFIG_NFT_CT scripts/config --enable CONFIG_NFT_QUEUE scripts/config --enable CONFIG_NF_CONNTRACK scripts/config --enable CONFIG_NF_TABLES
-
执行以下命令应用上述修改
make oldconfig
-
检查
.config
文件,确认上述选项均已启用:CONFIG_X=y
或者CONFIG_X=m
。cat .config
-
开始编译
make -j$(nproc)