windows: 添加 aws nitro 实例驱动

This commit is contained in:
bin456789 2023-07-03 13:51:59 +08:00
parent ef6c5f7aec
commit 3852dee143
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 22 additions and 4 deletions

View File

@ -68,7 +68,7 @@
<component name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="%arch%" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <component name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="%arch%" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DriverPaths> <DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="1"> <PathAndCredentials wcm:action="add" wcm:keyValue="1">
<Path>X:\virtio</Path> <Path>X:\drivers</Path>
</PathAndCredentials> </PathAndCredentials>
</DriverPaths> </DriverPaths>
</component> </component>

View File

@ -150,6 +150,7 @@ elif [ "$distro" = "dd" ]; then
# alpine busybox 自带 gzip xz但官方版也许性能更好 # alpine busybox 自带 gzip xz但官方版也许性能更好
# wget -O- $img | $prog -dc >/dev/$xda # wget -O- $img | $prog -dc >/dev/$xda
apk add curl $prog apk add curl $prog
# curl -L $img | $prog -dc | dd of=/dev/$xda bs=1M
curl -L $img | $prog -dc >/dev/$xda curl -L $img | $prog -dc >/dev/$xda
sync sync
else else
@ -299,7 +300,15 @@ if [ "$distro" = "windows" ]; then
# 下载 virtio 驱动 # 下载 virtio 驱动
# virt-what 可能返回多个结果,因此配合 grep 使用 # virt-what 可能返回多个结果,因此配合 grep 使用
if virt-what | grep kvm; then # aws lightsail t3 (nitro) 输出结果是 kvm aws
if virt-what | grep aws; then
# https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/migrating-latest-types.html
apk add unzip
download https://s3.amazonaws.com/ec2-windows-drivers-downloads/NVMe/Latest/AWSNVMe.zip /os/AWSNVMe.zip
unzip -o -d /aws /os/AWSNVMe.zip
download https://s3.amazonaws.com/ec2-windows-drivers-downloads/ENA/Latest/AwsEnaNetworkDriver.zip /os/AwsEnaNetworkDriver.zip
unzip -o -d /aws /os/AwsEnaNetworkDriver.zip
elif virt-what | grep kvm; then
case $(echo "$image_name" | tr '[:upper:]' '[:lower:]') in case $(echo "$image_name" | tr '[:upper:]' '[:lower:]') in
'windows server 2022'*) sys=2k22 ;; 'windows server 2022'*) sys=2k22 ;;
'windows server 2019'*) sys=2k19 ;; 'windows server 2019'*) sys=2k19 ;;
@ -394,12 +403,17 @@ EOF
# virtio 驱动 # virtio 驱动
if [ -d /virtio ]; then if [ -d /virtio ]; then
mkdir -p /wim/virtio mkdir -p /wim/drivers/
find /virtio \ find /virtio \
-ipath "*/$sys/$arch/*" \ -ipath "*/$sys/$arch/*" \
-not -iname '*.pdb' \ -not -iname '*.pdb' \
-not -iname '*.doc' \ -not -iname '*.doc' \
-exec /bin/cp -rf {} /wim/virtio/ \; -exec /bin/cp -rf {} /wim/drivers/ \;
fi
# aws 驱动
if [ -d /aws ]; then
mkdir -p /wim/drivers/
/bin/cp -rf /aws/* /wim/drivers/
fi fi
# win7 要添加 bootx64.efi 到 efi 目录 # win7 要添加 bootx64.efi 到 efi 目录
@ -439,6 +453,10 @@ EOF
} }
EOF EOF
fi fi
if [ "$sleep" = 2 ]; then
cd /
sleep infinity
fi
exec reboot exec reboot
fi fi