引言

preseedDebianUbuntu操作系统中用于自动化安装过程的一种方式。通过编写一个包含预定义答案的配置文件(称为preseed文件),可以在安装过程中自动回答安装程序的各种问题,从而实现无人值守或自定义化的安装。preseed文件包含了安装过程中可能涉及到的各种问题的答案,比如语言选择、时区设置、分区方案、软件包选择、用户账户等等。

使用preseed可以大大简化大规模部署系统的过程,提高效率并减少可能出错的几率。结合genisoimage等工具,可以将preseed文件与安装介质打包在一起,以便进行自动化安装。这样就能够轻松地实现定制化安装,节省时间和精力。

2024-04-09:文档更新
更新内容:

  • 如何替换官版iso镜像内核为自定义内核(可选)
  • 如何为官版iso镜像注入指定的硬件驱动(可选)

安装工具

1
apt -y install genisoimage

下载镜像

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[root@nvm-jscs02-cloud-dev-01 /data/isomake]# wget https://mirrors.huaweicloud.com/repository/debian-cd/12.0.0/amd64/iso-cd/debian-12.0.0-amd64-netinst.iso
[root@nvm-jscs02-cloud-dev-01 /data/isomake]# mount debian-12.0.0-amd64-netinst.iso mnt/
mount: /dev/loop0 is write-protected, mounting read-only
[root@nvm-jscs02-cloud-dev-01 /data/isomake]# tree ./ -L 2
./
├── debian-12.0.0-amd64-netinst.iso
├── isofiles
└── mnt
├── boot
├── css
├── debian -> .
├── dists
├── doc
├── EFI
├── firmware
├── install
├── install.amd
├── isolinux
├── md5sum.txt
├── pics
├── pool
├── README.html
├── README.mirrors.html
├── README.mirrors.txt
├── README.source
└── README.txt

编辑镜像

1
2
3
4
[root@nvm-jscs02-cloud-dev-01 /data/isomake]# cp -rT mnt/ isofiles/
[root@nvm-jscs02-cloud-dev-01 /data/isomake]# ls isofiles/
boot debian doc firmware install.amd md5sum.txt pool README.mirrors.html README.source
css dists EFI install isolinux pics README.html README.mirrors.txt README.txt

添加预设文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles]# cat conf/auto.preseed  

### 本地化
# 中文
d-i debian-installer/locale string zh_CN.UTF-8
d-i keyboard-configuration/xkb-keymap select us
d-i localechooser/supported-locales multiselect en_US.UTF-8, zh_CN.UTF-8


### 网络
d-i netcfg/choose_interface select auto
d-i netcfg/enable boolean true
#d-i netcfg/disable_autoconfig boolean true
#d-i netcfg/confirm_static boolean true
#d-i netcfg/get_ipaddress string 192.168.10.20
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.10.1
#d-i netcfg/get_nameservers string 8.8.8.8
d-i netcfg/get_hostname string debian
d-i netcfg/get_domain string


### Network console
#d-i anna/choose_modules string network-console
#d-i network-console/password password passwd
#d-i network-console/password-again password passwd


### Mirror
d-i mirror/country string manual
d-i mirror/http/hostname string mirrors.aliyun.com
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string


### Account setup
#d-i passwd/root-login boolean false
#d-i passwd/user-fullname string VDI
#d-i passwd/username string vdi
#d-i passwd/user-password-crypted password $6$tqS.VkgdFyXhE7Zd$gAbPpQ.fD8Zb0A3AjDuWzfYuwNntQ9fUHHqCmjmthNyIGbdfKCdrtgEi4hfuaZulx16BTuGMbvNe4K/v/B58Q/
d-i passwd/root-login boolean true
d-i passwd/make-user boolean false
d-i passwd/root-password password 123456
d-i passwd/root-password-again password 123456


### 时区
d-i clock-setup/utc boolean true
d-i time/zone string Asia/Shanghai
d-i clock-setup/ntp boolean true

### 分区
d-i partman-auto/disk string /dev/[sv]da
# 用第一块盘来操作分区
#d-i partman/early_command string \
# ONEDISK="$(lsblk -l -n -o NAME -d -p | grep '/dev/vda\|/dev/nvme0n1\|/dev/sda\|/dev/xvda'|sort|tail -n 1)"; \
# debconf-set partman-auto/disk "$ONEDISK"; \
# debconf-set grub-installer/bootdev "$ONEDISK";
# 常规分区
d-i partman-auto/method string regular
# 禁止swap分区
d-i partman-basicfilesystems/no_swap boolean false
# 如果硬盘内之前有lvm或是raid的分区,全部删除
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true

# 分区,一个boot分区最小512M,1优先级,最大1024M
d-i partman-auto/expert_recipe string \
boot-root :: \
512 1 1024 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
1 2 -1 xfs \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
mountpoint{ / } \
.

# 非交互式完成分区
## 确认是否写入新的分区标签。设置为"true"表示允许写入新的分区标签。
d-i partman-partitioning/confirm_write_new_label boolean true
## 安装程序在选择分区时选择“完成”选项,即跳过手动选择分区的步骤。
d-i partman/choose_partition select finish
## 确认分区的操作。设置为"true"表示允许自动确认分区操作。
d-i partman/confirm boolean true
## 确认是否覆盖分区。设置为"true"表示允许自动确认分区操作
d-i partman/confirm_nooverwrite boolean true

### Apt setup
# 不启用非自由(non-free)软件包源。
d-i apt-setup/non-free boolean true
# 启用贡献(contrib)软件包源。
d-i apt-setup/contrib boolean true
# 选择了主要(main)软件包源,以确保安装基本软件。
d-i apt-setup/services-select multiselect main
# 允许在安装过程中使用未经身份验证的软件包源。
d-i debian-installer/allow_unauthenticated boolean true
# 光盘相关
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false
d-i apt-setup/cdrom/set-failed boolean false


### Package selection
# 标准安装
tasksel tasksel/first multiselect standard
d-i pkgsel/upgrade select none
d-i pkgsel/language-packs multiselect en, zh
d-i pkgsel/include string openssh-server
d-i pkgsel/update-policy select none

# 禁止在安装的时候弹出popularity
popularity-contest popularity-contest/participate boolean false

### Boot loader installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string /dev/[sv]da

# 安装完成之后不要弹出安装完成的界面,直接重启
d-i finish-install/reboot_in_progress note

# 允许ssh服务使用root用户登录
d-i preseed/late_command string in-target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config

修改启动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 背景图修改
[root@nvm-jscs02-cloud-dev-01 /data/isomake]# ls -l isofiles/isolinux/splash.png


[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles]# cp isolinux/gtk.cfg isolinux/gtk_auto.cfg

# 去掉默认选项
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles]# vim isolinux/gtk.cfg
label installgui
menu label ^Graphical install
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/gtk/initrd.gz --- quiet

# 添加表单选项
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles]# vim isolinux/gtk_auto.cfg
default autoinstallgui
label autoinstallgui
menu label ^Auto Install
menu default
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/gtk/initrd.gz auto=true file=/cdrom/conf/auto.preseed --- quiet

timeout 10

ontimeout /install.amd/vmlinuz vga=788 initrd=/install.amd/gtk/initrd.gz auto=true file=/cdrom/conf/auto.preseed --- quiet

[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles/isolinux]# vim isolinux/menu.cfg
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles/isolinux]# cat menu.cfg
menu hshift 4
menu width 70

menu title Bli Debian 12 Installer (BIOS mode)
include stdmenu.cfg
include gtk_auto.cfg #加这一行
include gtk.cfg
include txt.cfg

# 删掉默认超时配置
[root@nvm-jscs02-cloud-dev-01 /data/isomake]# rm -rf isofiles/isolinux/spkgtk.cfg

修改内核为自研内核(可选)

这里为B站内部自研内核不方便挂链接,可以替换为你们自己编译的内核

1
2
3
4
5
6
7
8
9
10
11
[root@nvm-jscs02-cloud-dev-01 /data/isomake]# mkdir kernel
[root@nvm-jscs02-cloud-dev-01 /data/isomake]# cd kernel/
[root@nvm-jscs02-cloud-dev-01 /data/isomake/kernel]#
wget http://mirrors.bilixxx.xxx/debian-custom/pool/main-stretch/l/linux/5.10.0-103/linux-headers-5.10.0-103-bili_20220321162725-96b29d4680e3_amd64.deb
wget http://mirrors.bilixxx.xxx/debian-custom/pool/main-stretch/l/linux/5.10.0-103/linux-image-5.10.0-103-bili_20220321162725-96b29d4680e3_amd64.deb
wget http://mirrors.bilixxx.xxx/debian-custom/pool/main-stretch/l/linux/5.10.0-103/linux-libc-dev_20220321162725-96b29d4680e3_amd64.deb
wget http://mirrors.bilixxx.xxx/debian-custom/pool/main-stretch/l/linux/5.10.0-103/linux-tools-5.10.0-103-bili_20220321162725-96b29d4680e3_amd64.deb

# 重命名
[root@nvm-jscs02-cloud-dev-01 /data/isomake/kernel]# ls
linux-headers-5.10.0-103-bili_amd64.deb linux-image-5.10.0-103-bili_amd64.deb linux-libc-dev_amd64.deb linux-tools-5.10.0-103-bili_amd64.deb

删除替换镜像内原内核

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 原内核
[root@nvm-jscs02-cloud-dev-01 /data/isomake/kernel]# ls ../isofiles/pool/main/l/linux/
linux-compiler-gcc-12-x86_6.1.27-1_amd64.deb linux-headers-6.1.0-9-common_6.1.27-1_all.deb linux-libc-dev_6.1.27-1_amd64.deb
linux-headers-6.1.0-9-amd64_6.1.27-1_amd64.deb linux-kbuild-6.1_6.1.27-1_amd64.deb

# 删除原内核
[root@nvm-jscs02-cloud-dev-01 /data/isomake/kernel]# rm -rf ../isofiles/pool/main/l/linux/*
[root@nvm-jscs02-cloud-dev-01 /data/isomake/kernel]# ls ../isofiles/pool/main/l/linux/

# 拷贝自研内核
[root@nvm-jscs02-cloud-dev-01 /data/isomake/kernel]# cp ./* ../isofiles/pool/main/l/linux/
[root@nvm-jscs02-cloud-dev-01 /data/isomake/kernel]# ls ../isofiles/pool/main/l/linux/
linux-headers-5.10.0-103-bili_amd64.deb linux-image-5.10.0-103-bili_amd64.deb linux-libc-dev_amd64.deb linux-tools-5.10.0-103-bili_amd64.deb
[root@nvm-jscs02-cloud-dev-01 /data/isomake/kernel]# ls -l ../isofiles/pool/main/l/linux/
total 65384
-rw-r--r-- 1 root root 8021830 Apr 7 17:52 linux-headers-5.10.0-103-bili_amd64.deb
-rw-r--r-- 1 root root 52777856 Apr 7 17:52 linux-image-5.10.0-103-bili_amd64.deb
-rw-r--r-- 1 root root 1138684 Apr 7 17:52 linux-libc-dev_amd64.deb
-rw-r--r-- 1 root root 5006500 Apr 7 17:52 linux-tools-5.10.0-103-bili_amd64.deb
[root@nvm-jscs02-cloud-dev-01 /data/isomake/kernel]# cd ../isofiles/pool/main/l/linux/

[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles/pool/main/l/linux]# chmod 555 ./*
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles/pool/main/l/linux]# ls -l
total 65384
-r-xr-xr-x 1 root root 8021830 Apr 7 17:52 linux-headers-5.10.0-103-bili_amd64.deb
-r-xr-xr-x 1 root root 52777856 Apr 7 17:52 linux-image-5.10.0-103-bili_amd64.deb
-r-xr-xr-x 1 root root 1138684 Apr 7 17:52 linux-libc-dev_amd64.deb
-r-xr-xr-x 1 root root 5006500 Apr 7 17:52 linux-tools-5.10.0-103-bili_amd64.deb

更改官版iso镜像安装的目标内核

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles/pool/main/l/linux-signed-amd64]# rm -rf linux-image-6.1.0-9-amd64_6.1.27-1_amd64.deb
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles/pool/main/l/linux-signed-amd64]# mkdir ./linux-image ./linux-headers

# 宿主机为centos 没有dpkg 这里用docker启动一个debian镜像继续操作
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64# ls
btrfs-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb mtd-core-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
crc-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb multipath-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
crypto-dm-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb nbd-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
crypto-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb nic-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
efi-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb nic-pcmcia-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
event-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb nic-shared-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
ext4-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb nic-usb-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
f2fs-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb nic-wireless-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
firewire-core-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb pata-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
fuse-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb pcmcia-storage-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
i2c-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb ppp-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
jfs-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb rfkill-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
linux-headers scsi-nic-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
linux-headers-amd64_6.1.27-1_amd64.deb sound-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
linux-image squashfs-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
linux-image-amd64_6.1.27-1_amd64.deb udf-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
loop-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb uinput-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
md-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb xfs-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb
mmc-core-modules-6.1.0-9-amd64-di_6.1.27-1_amd64.udeb

# 解压包
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64# dpkg -X linux-image-amd64_6.1.27-1_amd64.deb linux-image
./
./usr/
./usr/share/
./usr/share/bug/
./usr/share/bug/linux-image-amd64/
./usr/share/bug/linux-image-amd64/presubj
./usr/share/doc/
./usr/share/doc/linux-image-amd64
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64# dpkg -X linux-headers-amd64_6.1.27-1_amd64.deb linux-headers
./
./usr/
./usr/share/
./usr/share/doc/
./usr/share/lintian/
./usr/share/lintian/overrides/
./usr/share/lintian/overrides/linux-headers-amd64
./usr/share/doc/linux-headers-amd64

# dpkg -e 从一个 Debian 软件包中提取控制信息并解压缩软件包的数据。在这个命令中,../linux-image-amd64_4.9+80+deb9u6_amd64.deb 是指定的 Debian 软件包文件。通过该命令,你可以提取软件包的控制信息,比如包名、版本号、依赖关系等,并将软件包的数据解压缩到当前目录。
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-headers# ls
usr
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-headers# dpkg -e ../linux-headers-amd64_6.1.27-1_amd64.deb
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-headers# ls
DEBIAN usr
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-headers# cd ../linux-image
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-image# dpkg -e ../linux-image-amd64_6.1.27-1_amd64.deb
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-image# ls
DEBIAN usr

root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-image# cat DEBIAN/control
Package: linux-image-amd64
Source: linux-signed-amd64 (6.1.27+1)
Version: 6.1.27-1
Architecture: amd64
Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org>
Installed-Size: 13
Depends: linux-image-6.1.0-9-amd64 (= 6.1.27-1) #改这里,将版本号
Provides: linux-image-generic, linux-latest-modules-6.1.0-9-amd64, virtualbox-guest-modules, wireguard-modules (= 1.0.0)
Built-Using: linux (= 6.1.27-1)
Section: kernel
Priority: optional
Homepage: https://www.kernel.org/
Description: Linux for 64-bit PCs (meta-package)
This package depends on the latest Linux kernel and modules for use on PCs
with AMD64, Intel 64 or VIA Nano processors.


#编辑
image包
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-image# sed -i 's#Depends: linux-image-6.1.0-9-amd64 (= 6.1.27-1)#Depends: linux-image-5.10.0-103-bili#g' DEBIAN/control
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-image# dpkg -b ./ linux-image-amd64_6.1.27-1_amd64.deb

#head包
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-headers# sed -i 's#Depends: linux-headers-6.1.0-9-amd64 (= 6.1.27-1)#Depends: linux-headers-5.10.0-103-bili#g' DEBIAN/control
root@d1f49e856234:/data/isofiles/pool/main/l/linux-signed-amd64/linux-headers# dpkg -b ./ linux-headers-amd64_6.1.27-1_amd64.deb

替换掉上级目录的linux image和head包

更新索引(如果修改了内核)

更新Packages.gz文件
Packages.gz 文件是 Debian 软件包索引文件的一种压缩形式。它包含了软件源中所有可用软件包的信息,如软件包名称、版本号、描述、依赖关系等。具体来说,Packages.gz 文件的作用包括:

  • 软件包索引Packages.gz 文件是软件源的索引文件,列出了软件源中可用的所有软件包的详细信息。
  • 软件包信息:每个软件包的信息包括软件包的名称、版本、大小、依赖关系、描述等内容,帮助用户了解和选择合适的软件包进行安装。
  • 提供给包管理器使用:当用户使用包管理器(如 apt)搜索、安装或更新软件时,会通过读取 Packages.gz 文件来获取软件包信息,并根据其中的数据进行操作。
  • 减少数据传输量:压缩后的 Packages.gz 文件可以减少网络数据传输量,提高下载速度并减少带宽占用。

总的来说,Packages.gz 文件是 Debian 软件包管理系统中重要的组成部分,用于提供软件包的元数据信息,使用户能够方便地管理和安装软件包。

1
2
3
4
5
root@d1f49e856234:/data/isofiles# ls
EFI README.mirrors.html README.source boot css dists firmware install.amd md5sum.txt pool
README.html README.mirrors.txt README.txt conf debian doc install isolinux pics

root@d1f49e856234:/data/isofiles# dpkg-scanpackages pool/main/ /dev/null |tee dists/bookworm/main/binary-amd64/Packages |gzip > dists/bookworm/main/binary-amd64/Packages.gz

更新Release文件

dists/bookworm/Release 是 Debian 发行版中的一个文件,用于指示软件源(repository)中可用软件包的版本和其他相关信息。具体来说,它的作用包括:

  • 版本信息Release 文件会列出软件源中各个软件包的版本号,以及它们所属的分支(如 stable、testing、unstable 等)。
  • 数字签名Release 文件中通常包含软件源的数字签名,用于验证软件包的完整性和真实性。这有助于防止恶意软件注入或篡改。
  • 其他元数据:除了版本信息外,Release 文件还可能包含其他元数据,如软件包的依赖关系、建议安装的软件包等。
  • 提供给包管理器使用:当用户使用包管理器(如 apt)来更新软件包列表或安装新软件包时,系统会根据 dists/bookworm/Release 文件中的信息来确定可用的软件包版本和来源。

总的来说,dists/bookworm/Release 文件是 Debian 发行版中用于描述软件源中可用软件包的元数据文件之一,对软件包的管理和维护起着重要的作用。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 备份源文件
root@d1f49e856234:/data/isofiles/dists/bookworm# ls
Release main non-free-firmware
root@d1f49e856234:/data/isofiles/dists/bookworm# mv Release{,.bak}
root@d1f49e856234:/data/isofiles/dists/bookworm# ls
Release.bak main non-free-firmware

root@d1f49e856234:/data/isofiles/dists/bookworm# cat > makedb.sh <<'EOF'
> #!/bin/bash

if [ "$1" == "checksum_md5" ]; then
printf ' '$(md5sum $2 | cut --delimiter=' ' --fields=1)' %16d '$2'\n' $(wc --bytes $2 | cut --delimiter=' ' --fields=1)
exit
elif [ "$1" == "checksum_sha1" ]; then
printf ' '$(sha1sum $2 | cut --delimiter=' ' --fields=1)' %16d '$2'\n' $(wc --bytes $2 | cut --delimiter=' ' --fields=1)
exit
elif [ "$1" == "checksum_sha256" ]; then
printf ' '$(sha256sum $2 | cut --delimiter=' ' --fields=1)' %16d '$2'\n' $(wc --bytes $2 | cut --delimiter=' ' --fields=1)
exit
elif [ "$1" == "checksum_sha512" ]; then
printf ' '$(sha512sum $2 | cut --delimiter=' ' --fields=1)' %16d '$2'\n' $(wc --bytes $2 | cut --delimiter=' ' --fields=1)
exit
fi

SELF_SCRIPT="`pwd`/$0"

echo "Calculing hash for packages..."
echo "MD5Sum:" >> Release
find main/ -type f | xargs -n 1 $SELF_SCRIPT checksum_md5 >> Release
echo "SHA1:" >> Release
find main/ -type f | xargs -n 1 $SELF_SCRIPT checksum_sha1 >> Release
echo "SHA256:" >> Release
find main/ -type f | xargs -n 1 $SELF_SCRIPT checksum_sha256 >> Release
echo "SHA512:" >> Release
find main/ -type f | xargs -n 1 $SELF_SCRIPT checksum_sha512 >> Release
> EOF

root@d1f49e856234:/data/isofiles/dists/bookworm# ls
Release.bak main makedb.sh non-free-firmware
root@d1f49e856234:/data/isofiles/dists/bookworm# ./makedb.sh

root@d1f49e856234:/data/isofiles/dists/bookworm# head -n 12 Release.bak
Origin: Debian
Label: Debian
Suite: stable
Version: 12.0
Codename: bookworm
Changelogs: https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog
Date: Sat, 10 Jun 2023 08:51:17 UTC
Acquire-By-Hash: yes
No-Support-for-Architecture-all: Packages
Architectures: amd64
Components: main
Description: Debian 12.0 Released 10 June 2023
root@d1f49e856234:/data/isofiles/dists/bookworm# head -n 12 Release
Origin: Debian
Label: Debian
Suite: stable
Version: 12.0
Codename: bookworm
Changelogs: https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog
Date: Sat, 10 Jun 2023 08:51:17 UTC
Acquire-By-Hash: yes
No-Support-for-Architecture-all: Packages
Architectures: amd64
Components: main
Description: Debian 12.0 Released 10 June 2023

将Release.bak文件头12行粘贴到新Release中

重新生成md5sum.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles]# chmod +w md5sum.txt
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles]# find -follow -type f ! -name md5sum.txt -print0 | xargs -0 md5sum > md5sum.txt
find: File system loop detected; ‘./debian’ is part of the same file system loop as ‘.’.
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles]# ls -lh
total 176K
dr-xr-xr-x 3 root root 4.0K Feb 26 14:29 boot
drwxr-xr-x 2 root root 4.0K Feb 26 14:48 conf
dr-xr-xr-x 2 root root 4.0K Feb 26 14:29 css
lrwxrwxrwx 1 root root 1 Feb 26 14:29 debian -> .
dr-xr-xr-x 3 root root 4.0K Feb 26 14:29 dists
dr-xr-xr-x 4 root root 4.0K Feb 26 14:29 doc
dr-xr-xr-x 4 root root 4.0K Feb 26 14:29 EFI
dr-xr-xr-x 3 root root 4.0K Feb 26 14:29 firmware
dr-xr-xr-x 2 root root 4.0K Feb 26 14:29 install
dr-xr-xr-x 4 root root 4.0K Feb 26 14:29 install.amd
dr-xr-xr-x 2 root root 4.0K Feb 26 15:05 isolinux
-rw-r--r-- 1 root root 93K Feb 26 15:09 md5sum.txt
dr-xr-xr-x 2 root root 4.0K Feb 26 14:29 pics
dr-xr-xr-x 4 root root 4.0K Feb 26 14:29 pool
-r--r--r-- 1 root root 8.6K Feb 26 14:29 README.html
-r--r--r-- 1 root root 291 Feb 26 14:29 README.mirrors.html
-r--r--r-- 1 root root 86 Feb 26 14:29 README.mirrors.txt
-r--r--r-- 1 root root 543 Feb 26 14:29 README.source
-r--r--r-- 1 root root 5.3K Feb 26 14:29 README.txt
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles]# chmod -w md5sum.txt
[root@nvm-jscs02-cloud-dev-01 /data/isomake/isofiles]# cd ..

打包

1
genisoimage -r -J -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o preseed-debian-12.0.0-amd64-netinst.iso isofiles

genisoimage是一个用于创建ISO映像文件的工具。

  • -r: 生成Rock Ridge目录结构,以支持长文件名和符号链接等UNIX特性。
  • -J: 生成Joliet目录信息,以支持Windows系统对长文件名的识别。
  • -b isolinux/isolinux.bin: 指定引导映像的位置和名称。
  • -c isolinux/boot.cat: 指定引导目录表的位置和名称。
  • -no-emul-boot: 指定不使用光盘仿真模式来引导。
  • -boot-load-size 4: 指定引导加载程序的大小为4扇区。
  • -boot-info-table: 生成引导信息表,用于在ISO中保存引导信息。
  • -o preseed-debian-12.0.0-amd64-netinst.iso: 指定生成的ISO文件的名称。
  • isofiles: 指定需要添加到ISO中的文件和目录。
    通过这些参数,genisoimage将创建一个包含指定文件和目录的ISO映像文件,并设置好引导相关的信息,以便在启动时正确加载操作系统或其他内容。

测试

内核替换测试

内核测试

驱动添加/更新

在上面测试镜像所安装的测试机器上对需要加入的驱动编译安装,否则编译内核版本与实际封装的版本不一致可能会出问题(需要安装内核同版本的linux-header 和 gcc工具)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
intel i40e网卡驱动
下载地址:https://www.intel.cn/content/www/cn/zh/download/18026/intel-network-adapter-driver-for-pcie-40-gigabit-ethernet-network-connections-under-linux.html

root@debian:~# tar -xf i40e-2.24.6.tar.gz
root@debian:~# cd i40e-2.24.6/src/

root@debian:~/i40e-2.24.6/src# make
filtering include/net/flow_keys.h out
filtering include/linux/jump_label_type.h out
filtering include/linux/jump_label_type.h out
make[1]: Entering directory '/usr/src/linux-headers-5.10.0-103-bili'
/root/i40e-2.24.6/src/Makefile:39: 2
CC [M] /root/i40e-2.24.6/src/i40e_main.o
CC [M] /root/i40e-2.24.6/src/i40e_ethtool.o
CC [M] /root/i40e-2.24.6/src/i40e_xsk.o
CC [M] /root/i40e-2.24.6/src/i40e_adminq.o
CC [M] /root/i40e-2.24.6/src/i40e_common.o
CC [M] /root/i40e-2.24.6/src/i40e_hmc.o
CC [M] /root/i40e-2.24.6/src/i40e_lan_hmc.o
CC [M] /root/i40e-2.24.6/src/i40e_nvm.o
CC [M] /root/i40e-2.24.6/src/i40e_debugfs.o
CC [M] /root/i40e-2.24.6/src/i40e_diag.o
CC [M] /root/i40e-2.24.6/src/i40e_txrx.o
CC [M] /root/i40e-2.24.6/src/i40e_ptp.o
CC [M] /root/i40e-2.24.6/src/i40e_filters.o
CC [M] /root/i40e-2.24.6/src/i40e_ddp.o
CC [M] /root/i40e-2.24.6/src/i40e_client.o
CC [M] /root/i40e-2.24.6/src/i40e_virtchnl_pf.o
CC [M] /root/i40e-2.24.6/src/i40e_dcb.o
CC [M] /root/i40e-2.24.6/src/i40e_dcb_nl.o
CC [M] /root/i40e-2.24.6/src/kcompat.o
CC [M] /root/i40e-2.24.6/src/kcompat_vfd.o
LD [M] /root/i40e-2.24.6/src/i40e.o
CC [M] /root/i40e-2.24.6/src/auxiliary.o
LD [M] /root/i40e-2.24.6/src/intel_auxiliary.o
/root/i40e-2.24.6/src/Makefile:39: 2
MODPOST /root/i40e-2.24.6/src/Module.symvers
CC [M] /root/i40e-2.24.6/src/i40e.mod.o
LD [M] /root/i40e-2.24.6/src/i40e.ko
CC [M] /root/i40e-2.24.6/src/intel_auxiliary.mod.o
LD [M] /root/i40e-2.24.6/src/intel_auxiliary.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.10.0-103-bili'

root@debian:~/i40e-2.24.6/src# echo $?
0

root@debian:~/i40e-2.24.6/src# make install
filtering include/net/flow_keys.h out
filtering include/linux/jump_label_type.h out
filtering include/linux/jump_label_type.h out
make[1]: Entering directory '/usr/src/linux-headers-5.10.0-103-bili'
/root/i40e-2.24.6/src/Makefile:39: 2
/root/i40e-2.24.6/src/Makefile:39: 2
make[1]: Leaving directory '/usr/src/linux-headers-5.10.0-103-bili'
Installing modules...
make[1]: Entering directory '/usr/src/linux-headers-5.10.0-103-bili'
INSTALL /root/i40e-2.24.6/src/i40e.ko
INSTALL /root/i40e-2.24.6/src/intel_auxiliary.ko
DEPMOD 5.10.0-103-bili
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[1]: Leaving directory '/usr/src/linux-headers-5.10.0-103-bili'
make auxiliary_install
make[1]: Entering directory '/root/i40e-2.24.6/src'
filtering include/net/flow_keys.h out
filtering include/linux/jump_label_type.h out
filtering include/linux/jump_label_type.h out
Installing auxiliary...
install -D -m 644 Module.symvers /lib/modules/5.10.0-103-bili/extern-symvers/intel_auxiliary.symvers
install -d /lib/modules/5.10.0-103-bili/updates/drivers/net/ethernet/intel/auxiliary
mv -f /lib/modules/5.10.0-103-bili/updates/drivers/net/ethernet/intel/i40e/intel_auxiliary.ko* /lib/modules/5.10.0-103-bili/updates/drivers/net/ethernet/intel/auxiliary/
install -d //lib/modules/5.10.0-103-bili/build/include/linux
install -D -m 644 linux/auxiliary_bus.h auxiliary_compat.h kcompat_generated_defs.h -t //lib/modules/5.10.0-103-bili/build/include/linux
make[1]: Leaving directory '/root/i40e-2.24.6/src'
/sbin/depmod -e -F /boot/System.map-5.10.0-103-bili -a 5.10.0-103-bili
depmod: WARNING: /lib/modules/5.10.0-103-bili/kernel/drivers/infiniband/hw/i40iw/i40iw.ko needs unknown symbol i40e_unregister_client
depmod: WARNING: /lib/modules/5.10.0-103-bili/kernel/drivers/infiniband/hw/i40iw/i40iw.ko needs unknown symbol i40e_register_client
Updating initramfs...
update-initramfs: Generating /boot/initrd.img-5.10.0-103-bili
make mandocs_install
make[1]: Entering directory '/root/i40e-2.24.6/src'
filtering include/net/flow_keys.h out
filtering include/linux/jump_label_type.h out
filtering include/linux/jump_label_type.h out
Copying manpages...
make[1]: Leaving directory '/root/i40e-2.24.6/src'
root@debian:~/i40e-2.24.6/src# echo $?
0

# 拿到编译后的.ko文件
root@debian:/lib/modules/5.10.0-103-bili/updates/drivers/net/ethernet/intel# tree ./
./
|-- auxiliary
| `-- intel_auxiliary.ko
`-- i40e
`-- i40e.ko

# 检查依赖
root@debian:/lib/modules/5.10.0-103-bili/updates/drivers/net/ethernet/intel# modinfo ./i40e/i40e.ko
filename: /lib/modules/5.10.0-103-bili/updates/drivers/net/ethernet/intel/./i40e/i40e.ko
version: 2.24.6
license: GPL
description: Intel(R) 40-10 Gigabit Ethernet Connection Network Driver
author: Intel Corporation, <e1000-devel@lists.sourceforge.net>
srcversion: 3C6B125A18A073136C3A997
alias: pci:v00008086d0000158Bsv*sd*bc*sc*i*
alias: pci:v00008086d0000158Asv*sd*bc*sc*i*
alias: pci:v00008086d00000DDAsv*sd*bc*sc*i*
alias: pci:v00008086d000037D3sv*sd*bc*sc*i*
alias: pci:v00008086d000037D2sv*sd*bc*sc*i*
alias: pci:v00008086d000037D1sv*sd*bc*sc*i*
alias: pci:v00008086d000037D0sv*sd*bc*sc*i*
alias: pci:v00008086d000037CFsv*sd*bc*sc*i*
alias: pci:v00008086d000037CEsv*sd*bc*sc*i*
alias: pci:v00008086d00000D58sv*sd*bc*sc*i*
alias: pci:v00008086d00000CF8sv*sd*bc*sc*i*
alias: pci:v00008086d00001588sv*sd*bc*sc*i*
alias: pci:v00008086d00001587sv*sd*bc*sc*i*
alias: pci:v00008086d0000104Fsv*sd*bc*sc*i*
alias: pci:v00008086d0000104Esv*sd*bc*sc*i*
alias: pci:v00008086d000015FFsv*sd*bc*sc*i*
alias: pci:v00008086d00001589sv*sd*bc*sc*i*
alias: pci:v00008086d00001586sv*sd*bc*sc*i*
alias: pci:v00008086d0000101Fsv*sd*bc*sc*i*
alias: pci:v00008086d00000DD2sv*sd*bc*sc*i*
alias: pci:v00008086d00001585sv*sd*bc*sc*i*
alias: pci:v00008086d00001584sv*sd*bc*sc*i*
alias: pci:v00008086d00001583sv*sd*bc*sc*i*
alias: pci:v00008086d00001581sv*sd*bc*sc*i*
alias: pci:v00008086d00001580sv*sd*bc*sc*i*
alias: pci:v00008086d00001574sv*sd*bc*sc*i*
alias: pci:v00008086d00001572sv*sd*bc*sc*i*
depends: ptp,intel_auxiliary # 依赖intel_auxiliary
name: i40e
vermagic: 5.10.0-103-bili SMP mod_unload modversions
parm: debug:Debug level (0=none,...,16=all) (int)
parm: l4mode:L4 cloud filter mode: 0=UDP,1=TCP,2=Both,-1=Disabled(default) (int)

拷贝两个ko文件备用

进入官方iso解包后的目录,找到我们自定义内核文件的位置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# 解包自研内核包
root@04807b743cb2:/data/isofiles/pool/main/l/linux# mkdir linux-image
root@04807b743cb2:/data/isofiles/pool/main/l/linux# ls
linux-headers-5.10.0-103-bili_amd64.deb linux-image linux-image-5.10.0-103-bili_amd64.deb linux-libc-dev_amd64.deb linux-tools-5.10.0-103-bili_amd64.deb

root@04807b743cb2:/data/isofiles/pool/main/l/linux# dpkg -X linux-image-5.10.0-103-bili_amd64.deb ./linux-image
./
./boot/
./boot/System.map-5.10.0-103-bili
./boot/config-5.10.0-103-bili
./boot/vmlinuz-5.10.0-103-bili
./etc/
./etc/kernel/
./etc/kernel/postinst.d/
./etc/kernel/postrm.d/
./etc/kernel/preinst.d/
./etc/kernel/prerm.d/
./lib/
./lib/modules/
./lib/modules/5.10.0-103-bili/
./lib/modules/5.10.0-103-bili/kernel/
./lib/modules/5.10.0-103-bili/kernel/arch/
./lib/modules/5.10.0-103-bili/kernel/arch/x86/
./lib/modules/5.10.0-103-bili/kernel/arch/x86/crypto/
./lib/modules/5.10.0-103-bili/kernel/arch/x86/crypto/aegis128-aesni.ko
...

root@04807b743cb2:/data/isofiles/pool/main/l/linux# cd linux-image
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# dpkg -e ../linux-image-5.10.0-103-bili_amd64.deb

# 上一步编译好的ko文件
root@04807b743cb2:/data/isofiles/pool/main/l/linux# ls /data/kernel/intel/
auxiliary i40e #目录

# 复制替换
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# find ./ -name "i40e.ko"
./lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/i40e/i40e.ko

root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# ls ./lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/
e100.ko e1000 e1000e i40e iavf ice igb igbvf igc ixgb ixgbe ixgbevf

root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# cp -r /data/kernel/intel/* ./lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# ls -l ./lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/
total 132
drwxr-xr-x 2 root root 4096 Apr 8 08:44 auxiliary #新增
-rw-r--r-- 1 root root 84968 Mar 21 2022 e100.ko
drwxr-xr-x 2 root root 4096 Mar 21 2022 e1000
drwxr-xr-x 2 root root 4096 Mar 21 2022 e1000e
drwxr-xr-x 2 root root 4096 Mar 21 2022 i40e #变更
drwxr-xr-x 2 root root 4096 Mar 21 2022 iavf
drwxr-xr-x 2 root root 4096 Mar 21 2022 ice
drwxr-xr-x 2 root root 4096 Mar 21 2022 igb
drwxr-xr-x 2 root root 4096 Mar 21 2022 igbvf
drwxr-xr-x 2 root root 4096 Mar 21 2022 igc
drwxr-xr-x 2 root root 4096 Mar 21 2022 ixgb
drwxr-xr-x 2 root root 4096 Mar 21 2022 ixgbe
drwxr-xr-x 2 root root 4096 Mar 21 2022 ixgbevf

# 检查是否一致
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# md5sum /data/kernel/intel/i40e/i40e.ko
440a5e906874f9861869100303281222 /data/kernel/intel/i40e/i40e.ko

root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# md5sum /data/kernel/intel/auxiliary/intel_auxiliary.ko
a34fdffe7b827e7606e3b2c6c46d06c0 /data/kernel/intel/auxiliary/intel_auxiliary.ko

--

root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# md5sum ./lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/i40e/i40e.ko
440a5e906874f9861869100303281222 ./lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/i40e/i40e.ko

root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# md5sum ./lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/auxiliary/intel_auxiliary.ko
a34fdffe7b827e7606e3b2c6c46d06c0 ./lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/auxiliary/intel_auxiliary.ko

# 将所需要升级或集成的驱动文件拷贝或替换,然后回到刚刚生成的校验文件。将替换的驱动和集成的驱动的md5值写入解压后内核包的md5sums文件中
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# grep -E "i40e.ko|intel_auxiliary.ko" DEBIAN/md5sums
b11aad828bb0bd6beb41261e7cb1d013 lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/i40e/i40e.ko

# 替换旧驱动和添加新驱动intel_auxiliary.ko
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# sed -i 's#b11aad828bb0bd6beb41261e7cb1d013#440a5e906874f9861869100303281222#g' DEBIAN/md5sums
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# echo "a34fdffe7b827e7606e3b2c6c46d06c0 lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/auxiliary/intel_auxiliary.ko" >> DEBIAN/md5sums
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# grep -E "i40e.ko|intel_auxiliary.ko" DEBIAN/md5sums
440a5e906874f9861869100303281222 lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/i40e/i40e.ko
a34fdffe7b827e7606e3b2c6c46d06c0 lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/auxiliary/intel_auxiliary.ko

# 构建新的image包
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# dpkg -b ./ ../linux-image-5.10.0-103-bili_amd64.deb
dpkg-deb: building package 'linux-image-5.10.0-103-bili' in '../linux-image-5.10.0-103-bili_amd64.deb'.
root@04807b743cb2:/data/isofiles/pool/main/l/linux/linux-image# ls -l ../linux-image-5.10.0-103-bili_amd64.deb
-r-xr-xr-x 1 root root 54929480 Apr 8 08:56 ../linux-image-5.10.0-103-bili_amd64.deb

从更新索引开始往后继续执行,最后打包测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
root@debian:~# uname -a
Linux debian 5.10.0-103-bili #96b29d4680e3 SMP Mon Mar 21 16:28:39 HKT 2022 x86_64 GNU/Linux
root@debian:~# depmod -a
root@debian:~# modinfo intel_auxiliary
filename: /lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/auxiliary/intel_auxiliary.ko
author: linux.nics@intel.com
description: Auxiliary Bus Standalone
license: GPL v2
depends:
name: intel_auxiliary
vermagic: 5.10.0-103-bili SMP mod_unload modversions
root@debian:~# modinfo i40e
filename: /lib/modules/5.10.0-103-bili/kernel/drivers/net/ethernet/intel/i40e/i40e.ko
version: 2.24.6
license: GPL
description: Intel(R) 40-10 Gigabit Ethernet Connection Network Driver
author: Intel Corporation, <e1000-devel@lists.sourceforge.net>
srcversion: 3C6B125A18A073136C3A997
alias: pci:v00008086d0000158Bsv*sd*bc*sc*i*
alias: pci:v00008086d0000158Asv*sd*bc*sc*i*
alias: pci:v00008086d00000DDAsv*sd*bc*sc*i*
alias: pci:v00008086d000037D3sv*sd*bc*sc*i*
alias: pci:v00008086d000037D2sv*sd*bc*sc*i*
alias: pci:v00008086d000037D1sv*sd*bc*sc*i*
alias: pci:v00008086d000037D0sv*sd*bc*sc*i*
alias: pci:v00008086d000037CFsv*sd*bc*sc*i*
alias: pci:v00008086d000037CEsv*sd*bc*sc*i*
alias: pci:v00008086d00000D58sv*sd*bc*sc*i*
alias: pci:v00008086d00000CF8sv*sd*bc*sc*i*
alias: pci:v00008086d00001588sv*sd*bc*sc*i*
alias: pci:v00008086d00001587sv*sd*bc*sc*i*
alias: pci:v00008086d0000104Fsv*sd*bc*sc*i*
alias: pci:v00008086d0000104Esv*sd*bc*sc*i*
alias: pci:v00008086d000015FFsv*sd*bc*sc*i*
alias: pci:v00008086d00001589sv*sd*bc*sc*i*
alias: pci:v00008086d00001586sv*sd*bc*sc*i*
alias: pci:v00008086d0000101Fsv*sd*bc*sc*i*
alias: pci:v00008086d00000DD2sv*sd*bc*sc*i*
alias: pci:v00008086d00001585sv*sd*bc*sc*i*
alias: pci:v00008086d00001584sv*sd*bc*sc*i*
alias: pci:v00008086d00001583sv*sd*bc*sc*i*
alias: pci:v00008086d00001581sv*sd*bc*sc*i*
alias: pci:v00008086d00001580sv*sd*bc*sc*i*
alias: pci:v00008086d00001574sv*sd*bc*sc*i*
alias: pci:v00008086d00001572sv*sd*bc*sc*i*
depends: ptp,intel_auxiliary
name: i40e
vermagic: 5.10.0-103-bili SMP mod_unload modversions
parm: debug:Debug level (0=none,...,16=all) (int)
parm: l4mode:L4 cloud filter mode: 0=UDP,1=TCP,2=Both,-1=Disabled(default) (int)

可以看到更新的i40e 新驱动网卡和新添加的intel_auxiliary(i40e的依赖项)都已经加载成功了~

参考文档: