From 20b06d5e144a1d4e1c9c0750d968595a32923fde Mon Sep 17 00:00:00 2001 From: bin456789 Date: Tue, 16 Apr 2024 23:34:28 +0800 Subject: [PATCH] =?UTF-8?q?windows:=20=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86?= =?UTF-8?q?=20vista=20=E5=92=8C=20arm=20=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 6 ++-- README.md | 6 ++-- trans.sh | 86 +++++++++++++++++++++++++++++++++++++--------------- windows.xml | 2 +- 4 files changed, 69 insertions(+), 31 deletions(-) diff --git a/README.en.md b/README.en.md index 2bb9c0f..9474240 100644 --- a/README.en.md +++ b/README.en.md @@ -163,10 +163,10 @@ Use `Dism++` File menu > Open Image File, select the iso to be installed to get - Azure Stack HCI 2. The script will install the following drivers as needed: - KVM ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/)) - - XEN ([XEN PV](https://xenproject.org/windows-pv-drivers/), [AWS PV](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/xen-drivers-overview.html)) - - AWS ([ENA Network Adapter](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html), [NVMe Storage Controller](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/aws-nvme-drivers.html)) + - XEN ([XEN](https://xenproject.org/windows-pv-drivers/), [Citrix](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/Upgrading_PV_drivers.html#win2008-citrix-upgrade), [AWS](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/xen-drivers-overview.html)) + - AWS ([ENA Network Adapter](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html), [NVMe Storage Controller](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/aws-nvme-drivers.html)) - GCP ([gVNIC Network Adapter](https://cloud.google.com/compute/docs/networking/using-gvnic), [GGA Graphics](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display)) - - Azure ([MANA Network Adapter](https://learn.microsoft.com/zh-cn/azure/virtual-network/accelerated-networking-mana-windows)) + - Azure ([MANA Network Adapter](https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows)) 3. Vista (Server 2008) and 32-bit systems may lack drivers. 4. For EFI machines without CSM enabled, Windows 7 (Server 2008 R2) cannot be installed. 5. If the machine has a static IP, the IP will be automatically set after installation. diff --git a/README.md b/README.md index 75e266c..61bf966 100644 --- a/README.md +++ b/README.md @@ -163,10 +163,10 @@ Windows Server 2022 SERVERDATACENTER - Azure Stack HCI 2. 脚本会按需安装以下驱动: - KVM ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/)) - - XEN ([XEN PV](https://xenproject.org/windows-pv-drivers/)、[AWS PV](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/xen-drivers-overview.html)) - - AWS ([ENA 网卡](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html)、[NVME 存储控制器](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/aws-nvme-drivers.html)) + - XEN ([XEN](https://xenproject.org/windows-pv-drivers/)、[Citrix](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/Upgrading_PV_drivers.html#win2008-citrix-upgrade)、[AWS](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/xen-drivers-overview.html)) + - AWS ([ENA 网卡](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html)、[NVME 存储控制器](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/aws-nvme-drivers.html)) - GCP ([gVNIC 网卡](https://cloud.google.com/compute/docs/networking/using-gvnic)、[GGA 显卡](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display)) - - Azure ([MANA 网卡](https://learn.microsoft.com/zh-cn/azure/virtual-network/accelerated-networking-mana-windows)) + - Azure ([MANA 网卡](https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows)) 3. Vista (Server 2008) 和 32 位系统可能会缺少驱动 4. 未开启 CSM 的 EFI 机器,无法安装 Windows 7 (Server 2008 R2) 5. 静态 IP 的机器,安装后会自动配置好 IP diff --git a/trans.sh b/trans.sh index d01beb1..5827150 100644 --- a/trans.sh +++ b/trans.sh @@ -1582,9 +1582,9 @@ EOF modify_windows() { os_dir=$1 - # https://learn.microsoft.com/zh-cn/windows-hardware/manufacture/desktop/windows-setup-states - # https://learn.microsoft.com/zh-cn/troubleshoot/azure/virtual-machines/reset-local-password-without-agent - # https://learn.microsoft.com/zh-cn/windows-hardware/manufacture/desktop/add-a-custom-script-to-windows-setup + # https://learn.microsoft.com/windows-hardware/manufacture/desktop/windows-setup-states + # https://learn.microsoft.com/troubleshoot/azure/virtual-machines/reset-local-password-without-agent + # https://learn.microsoft.com/windows-hardware/manufacture/desktop/add-a-custom-script-to-windows-setup # 判断用 SetupComplete 还是组策略 state_ini=$os_dir/Windows/Setup/State/State.ini @@ -2368,6 +2368,14 @@ is_dmi_contains() { echo "$_dmi" | grep -Eiw "$1" } +get_aws_repo() { + if is_in_china >&2; then + echo https://s3.cn-north-1.amazonaws.com.cn/ec2-windows-drivers-downloads-cn + else + echo https://s3.amazonaws.com/ec2-windows-drivers-downloads + fi +} + install_windows() { apk add wimlib pev @@ -2453,54 +2461,76 @@ install_windows() { mkdir -p $drv # aws nitro - # 可能不支持 vista - # https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/aws-nvme-drivers.html - # https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html + # 不支持 vista + # https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/aws-nvme-drivers.html + # https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html if is_virt_contains aws && is_virt_contains kvm && - [ "$arch_wim" = x86_64 ]; then + { [ "$arch_wim" = x86_64 ] || [ "$arch_wim" = arm64 ]; } && + ! [ "$nt_ver" = 6.0 ]; then # 未打补丁的 win7 无法使用 sha256 签名的驱动 nvme_ver=$( case "$nt_ver" in - 6.0 | 6.1) echo 1.3.2 ;; # sha1 签名 + 6.1) echo 1.3.2 ;; # sha1 签名 *) echo Latest ;; esac ) ena_ver=$( case "$nt_ver" in - 6.0 | 6.1) echo 2.1.4 ;; # sha1 签名 - # 6.0 | 6.1) echo 2.2.3 ;; # sha256 签名 + 6.1) echo 2.1.4 ;; # sha1 签名 + # 6.1) echo 2.2.3 ;; # sha256 签名 6.2 | 6.3) echo 2.6.0 ;; *) echo Latest ;; esac ) - download https://s3.amazonaws.com/ec2-windows-drivers-downloads/NVMe/$nvme_ver/AWSNVMe.zip $drv/AWSNVMe.zip - download https://s3.amazonaws.com/ec2-windows-drivers-downloads/ENA/$ena_ver/AwsEnaNetworkDriver.zip $drv/AwsEnaNetworkDriver.zip + [ "$arch_wim" = arm64 ] && arch_dir=/ARM64 || arch_dir= + + download "$(get_aws_repo)/NVMe$arch_dir/$nvme_ver/AWSNVMe.zip" $drv/AWSNVMe.zip + download "$(get_aws_repo)/ENA$arch_dir/$ena_ver/AwsEnaNetworkDriver.zip" $drv/AwsEnaNetworkDriver.zip unzip -o -d $drv/aws/ $drv/AWSNVMe.zip unzip -o -d $drv/aws/ $drv/AwsEnaNetworkDriver.zip fi - # aws xen - # 可能不支持 vista - # https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/xen-drivers-overview.html + # citrix xen + # 仅支持 vista if is_virt_contains xen && - [ "$arch_wim" = x86_64 ]; then + { [ "$arch_wim" = x86 ] || [ "$arch_wim" = x86_64 ]; } && + [ "$nt_ver" = 6.0 ]; then + + apk add 7zip + download https://s3.amazonaws.com/ec2-downloads-windows/Drivers/Citrix-Win_PV.zip $drv/Citrix-Win_PV.zip + unzip -o -d $drv $drv/Citrix-Win_PV.zip + case "$arch_wim" in + x86) override=s ;; # skip + x86_64) override=a ;; # always + esac + # 排除 $PLUGINSDIR $TEMP + exclude='$*' + 7z x $drv/Citrix_xensetup.exe -o$drv/aws/ -ao$override -x!$exclude + fi + + # aws xen + # 不支持 vista + # https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/xen-drivers-overview.html + if is_virt_contains xen && + [ "$arch_wim" = x86_64 ] && + ! [ "$nt_ver" = 6.0 ]; then apk add msitools aws_pv_ver=$( case "$nt_ver" in - 6.0 | 6.1) echo 8.3.2 ;; # sha1 签名 - # 6.0 | 6.1) echo 8.3.5 ;; # sha256 签名 + 6.1) echo 8.3.2 ;; # sha1 签名 + # 6.1) echo 8.3.5 ;; # sha256 签名 *) echo Latest ;; esac ) - download https://s3.amazonaws.com/ec2-windows-drivers-downloads/AWSPV/$aws_pv_ver/AWSPVDriver.zip $drv/AWSPVDriver.zip + download "$(get_aws_repo)/AWSPV/$aws_pv_ver/AWSPVDriver.zip" $drv/AWSPVDriver.zip unzip -o -d $drv $drv/AWSPVDriver.zip msiextract $drv/AWSPVDriverSetup.msi -C $drv @@ -2611,22 +2641,30 @@ install_windows() { fi # gcp - if { is_dmi_contains "Google Compute Engine" || is_dmi_contains "GoogleCloud"; } && - { [ "$arch_wim" = x86 ] || [ "$arch_wim" = x86_64 ]; }; then + # x86 x86_64 arm64 都有 + if { is_dmi_contains "Google Compute Engine" || is_dmi_contains "GoogleCloud"; }; then gce_repo=https://packages.cloud.google.com/yuck download $gce_repo/repos/google-compute-engine-stable/index /tmp/gce.json - # gga 好像只是用于调节后台vnc分辨率 for name in gvnic gga; do + # gvnic 没有 arm64 + if [ "$name" = gvnic ] && [ "$arch_wim" = arm64 ]; then + continue + fi + mkdir -p $drv/gce/$name link=$(grep -o "/pool/.*-google-compute-engine-driver-$name\.goo" /tmp/gce.json) wget $gce_repo$link -O- | tar -xzf- -C $drv/gce/$name # 没有 win6.0 文件夹 + # 但 inf 没限制 # TODO: 测试是否可用 if false; then - mkdir -p $drv/gce/$name/win6.0/ - cp -r $drv/gce/$name/win6.1/* $drv/gce/$name/win6.0/ + for suffix in '' '-32'; do + if [ -d "$drv/gce/$name/win6.1$suffix" ]; then + cp -r "$drv/gce/$name/win6.1$suffix" "$drv/gce/$name/win6.0$suffix" + fi + done fi done fi diff --git a/windows.xml b/windows.xml index cb3523a..ac6e6fe 100644 --- a/windows.xml +++ b/windows.xml @@ -56,7 +56,7 @@ 1