Gentoo安装详解(二)-- 编译内核
编译内核
可选 安装firmware
emerge --ask sys-kernel/linux-firmware
package.license
sys-kernel/linux-firmware linux-fw-redistributable no-source-code
安装内核源码
选择内核:如gentoo-sources
emerge --ask sys-kernel/gentoo-sources
eselect kernel list
eselect kernel set x
ls -l /usr/src/linux
手动编译内核
Most information can be gathered by emerging sys-apps/pciutils which contains the
lspci
command
配置内核
cd /usr/src/linux
make menuconfig
[Configuring the Linux kernel - Gentoo Wiki](%3Ca href="https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel"%3EConfiguring the Linux kernel - Gentoo Wiki%3C/a%3E)
-
必须启用的选项:
-
声卡:ALSA
-
网卡:根据具体网卡芯片型号,查看wiki。
-
无线网卡芯片驱动查询:Linux Wireless
其他选项根据需要添加,不了解保持默认即可.
编译内核与模块
make && make modules_install
安装内核到启动分区
make install
cp arch/x86_64/boot/bzImage /boot/kernel-3.10.10-gentoo
This will copy the kernel image into /boot together with the System.map file and the kernel configuration file.
可选 安装initramfs
To install an initramfs, install sys-kernel/genkernel first, then have it generate an initramfs:
emerge --ask sys-kernel/genkernel
genkernel --install --kernel-config=/path/to/used/kernel.config initramfs
The initramfs will be stored in /boot/. The resulting file can be found by simply listing the files starting with initramfs:
ls /boot/initramfs*
可选 使用发行版内核
Distribution Kernels are ebuilds that cover the complete process of unpacking, configuring, compiling, and installing the kernel. The primary advantage of this method is that the kernels are upgraded to new versions as part of @world
upgrade without a need for manual action. Distribution kernels default to a configuration supporting the majority of hardware but they can be customized via /etc/portage/savedconfig
.
emerge --ask sys-kernel/installkernel-gentoo
emerge --ask sys-kernel/gentoo-kernel
System administrators who want to avoid compiling the kernel sources locally can instead use precompiled kernel images:
emerge --ask sys-kernel/gentoo-kernel-bin
可选 使用genkernel编译内核
emerge genkernel
- 可选:复制安装光盘上的内核配置文件:
zcat /proc/config.gz > /usr/share/genkernel/arch/x86_64/kernel-config
- 编译:
genkernel --menuconfig all
一旦genkernel运行完成,一个包括全部模块和initrd的内核将被建立。在后面配置引导程序时我们将会用到这个内核和initrd。请记下内核和initrd的名字,因为您将在配置引导程序的时候用到他们(Grub Legacy使用)。initrd将会在启动真正的系统前自动识别硬件(如同安装光盘一样)。
ls /boot/kernel* /boot/initramfs*
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)