Compare commits

...

2 Commits

Author SHA1 Message Date
bin456789
d7540ff59c
windows: 更新 vmd 驱动 2025-03-26 00:27:04 +08:00
bin456789
c42fee9204
windows: 修复无法正确解析 UTF-16LE 编码的 inf 2025-03-26 00:27:03 +08:00
5 changed files with 45 additions and 13 deletions

View File

@ -414,7 +414,7 @@ bash reinstall.sh windows \
[gcp-gvnic]: https://cloud.google.com/compute/docs/networking/using-gvnic
[gcp-gga]: https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display
[azure-mana]: https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows
[intel-vmd]: https://www.intel.com/content/www/us/en/download/720755/intel-rapid-storage-technology-driver-installation-software-with-intel-optane-memory-11th-up-to-13th-gen-platforms.html
[intel-vmd]: https://www.intel.com/content/www/us/en/download/849936/intel-rapid-storage-technology-driver-installation-software-with-intel-optane-memory-12th-to-15th-gen-platforms.html
[intel-nic-7-sha1]: https://www.intel.com/content/www/us/en/download/15590/29323/intel-network-adapter-driver-for-windows-7-final-release.html
[intel-nic-7-sha256]: https://www.intel.com/content/www/us/en/download/15590/intel-network-adapter-driver-for-windows-7-final-release.html
[intel-nic-8]: https://www.intel.com/content/www/us/en/download/16765/intel-network-adapter-driver-for-windows-8-final-release.html

View File

@ -414,7 +414,7 @@ bash reinstall.sh windows \
[gcp-gvnic]: https://cloud.google.com/compute/docs/networking/using-gvnic
[gcp-gga]: https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display
[azure-mana]: https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows
[intel-vmd]: https://www.intel.com/content/www/us/en/download/720755/intel-rapid-storage-technology-driver-installation-software-with-intel-optane-memory-11th-up-to-13th-gen-platforms.html
[intel-vmd]: https://www.intel.com/content/www/us/en/download/849936/intel-rapid-storage-technology-driver-installation-software-with-intel-optane-memory-12th-to-15th-gen-platforms.html
[intel-nic-7-sha1]: https://www.intel.com/content/www/us/en/download/15590/29323/intel-network-adapter-driver-for-windows-7-final-release.html
[intel-nic-7-sha256]: https://www.intel.com/content/www/us/en/download/15590/intel-network-adapter-driver-for-windows-7-final-release.html
[intel-nic-8]: https://www.intel.com/content/www/us/en/download/16765/intel-network-adapter-driver-for-windows-8-final-release.html

View File

@ -2164,7 +2164,7 @@ to_lower() {
}
del_cr() {
sed 's/\r//g'
sed 's/\r$//'
}
del_empty_lines() {

View File

@ -776,7 +776,7 @@ to_lower() {
}
del_cr() {
sed 's/\r//g'
sed 's/\r$//'
}
del_comment_lines() {
@ -5456,10 +5456,11 @@ install_windows() {
fi
# vmd
# 改进: 像检测 virtio 那样直接从 /sys 检测设备
# inf 有要求 19041 或以上
if [ "$build_ver" -ge 19041 ] && [ "$arch_wim" = x86_64 ] &&
is_lspci_contains 'Volume Management Device'; then
# RST v17 不支持 vmd
# RST v18 inf 要求 15063 或以上
# RST v19 inf 要求 15063 或以上
# RST v20 inf 要求 19041 或以上
if [ -d /sys/module/vmd ] && [ "$build_ver" -ge 15063 ] && [ "$arch_wim" = x86_64 ]; then
add_driver_vmd
fi
@ -6049,7 +6050,12 @@ EOF
add_driver_vmd() {
apk add 7zip
download https://downloadmirror.intel.com/820815/SetupRST.exe $drv/SetupRST.exe
if [ "$build_ver" -ge 19041 ]; then
url=https://downloadmirror.intel.com/849939/SetupRST.exe # RST v20
elif [ "$build_ver" -ge 15063 ]; then
url=https://downloadmirror.intel.com/849934/SetupRST.exe # RST v19
fi
download $url $drv/SetupRST.exe
7z x $drv/SetupRST.exe -o$drv/SetupRST -i!.text
7z x $drv/SetupRST/.text -o$drv/vmd
cp_drivers $drv/vmd

View File

@ -1,16 +1,42 @@
#!/bin/ash
# shellcheck shell=dash
# shellcheck disable=SC3001,SC3010
# shellcheck disable=SC3001,SC3003,SC3010
# reinstall.sh / trans.sh 共用此文件
# inf 是 utf-16-le 编码会有问题?要用 rg 或者 grep -a a.b.c.d ?
# grep 无法处理 UTF-16LE 编码的 inf有以下几种解决方法
# 1. 使用 ripgrep (rg) 或者 ugrep但 cygwin 没有
# 2. grep -a a.b.c.d
# 3. iconv -f UTF-16 -t UTF-8
del_inf_comment() {
sed 's/;.*//'
}
simply_inf() {
del_cr | del_inf_comment | trim | del_empty_lines
convert_file_to_utf8 "$1" | del_cr | del_inf_comment | trim | del_empty_lines
}
convert_file_to_utf8() {
# ash 用 * 比较字符串有问题
# [[ $'\xEF\xBB' = $'\xEF\xBB*' ]] && echo 1
# UTF-16LE without BOM 要处理吗? windows 支持这种编码的 inf?
# UTF-16LE with BOM
if [ "$(head -c2 "$1")" = $'\xFF\xFE' ]; then
# -f UTF-16LE -t UTF-8 会添加 UTF-8 BOM
iconv -f UTF-16 -t UTF-8 "$1"
# UTF-8 with BOM
elif [ "$(head -c3 "$1")" = $'\xEF\xBB\xBF' ]; then
# busybox sed 不支持
# sed '1s/^\xEF\xBB\xBF//' "$1"
tail -c +4 "$1"
# 其它
else
cat "$1"
fi
}
simply_inf_word() {
@ -35,7 +61,7 @@ list_files_from_inf() {
local mix_x86_x86_64=$3
# 所有字段不区分大小写
inf_txts=$(simply_inf <"$inf" | to_lower)
inf_txts=$(simply_inf "$inf" | to_lower)
is_match_section() {
local section=$1