提取 Debian 内核文件(源码、头文件、二进制包等)有多种方式,取决于你想要什么内容。下面按常见需求分类说明。
apt-get source(最标准)sudo apt update
sudo apt install dpkg-dev
apt-get source linux
说明:
.orig.tar.xz(上游源码).debian.tar.xz(Debian 补丁).dsc(描述文件)适合:
git clone https://salsa.debian.org/kernel-team/linux.git
适合:
uname -r
例如:
5.10.0-23-amd64
ls /boot/vmlinuz-*
ls /lib/modules/$(uname -r)
ls /usr/src/linux-headers-$(uname -r)
apt-get download linux-image-5.10.0-23-amd64
apt-get download linux-headers-5.10.0-23-amd64
dpkg-debdpkg-deb -x linux-image-5.10.0-23-amd64.deb ./kernel-extract
ar x linux-image-*.deb
tar -xf data.tar.*
解压后常见路径:
./boot/vmlinuz-*
./lib/modules/*
cat /boot/config-$(uname -r)
或:
zcat /proc/config.gz
(需开启 CONFIG_IKCONFIG_PROC)
cp /boot/initrd.img-$(uname -r) .
解包查看内容:
mkdir initrd
cd initrd
zcat ../initrd.img-5.10.0-23-amd64 | cpio -idmv
| 需求 | 推荐方式 |
|---|---|
| 获取 Debian 内核源码 | apt-get source linux |
| 获取内核补丁 | Debian 源码包 |
| 提取内核镜像 | /boot/vmlinuz-* |
| 提取内核模块 | /lib/modules/ |
| 提取 deb 包内容 | dpkg-deb -x |
| 内核配置 | /boot/config-* |
/boot 下的内核,除非你知道自己在做什么如果你能具体说明:
我可以给你更精确的命令和步骤。