debian: 虚拟机使用 cloud 内核

This commit is contained in:
bin456789 2023-08-27 23:52:06 +08:00
parent 8a7aa18a81
commit 5c5b2ae81c
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 12 additions and 4 deletions

View File

@ -69,12 +69,14 @@ d-i preseed/early_command string \
debconf-set mirror/http/hostname $hostname
d-i partman/early_command string \
debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
debconf-set partman-auto/disk "$(list-devices disk | head -n1)"; \
d-i partman/early_command string \
confhome="$(grep -o 'extra\.confhome=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
ttys=$(wget $confhome/ttys.sh -O- | sh -s console=); \
debconf-set debian-installer/add-kernel-opts "$ttys"
debconf-set debian-installer/add-kernel-opts "$ttys"; \
kernel="$(grep -o 'extra\.kernel=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
debconf-set base-installer/kernel/image "$kernel"
# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹
d-i preseed/late_command string \

View File

@ -260,6 +260,12 @@ setos() {
eval ${step}_initrd=$mirror/initrd.gz
fi
eval ${step}_ks=$confhome/debian.cfg
is_virt && flavour=-cloud
# 甲骨文 debian 10 amd64 cloud 内核 vnc 没有显示
[ "$releasever" -eq 10 ] && [ "$basearch_alt" = amd64 ] && flavour=
# shellcheck disable=SC2034
kernel=linux-image$flavour-$basearch_alt
fi
}
@ -861,7 +867,7 @@ build_finalos_cmdline() {
}
build_extra_cmdline() {
for key in localtest confhome sleep cloud_image; do
for key in localtest confhome sleep cloud_image kernel; do
value=${!key}
if [ -n "$value" ]; then
extra_cmdline+=" extra.$key='$value'"