ipxe 装 alpine 再装 win

1.ipxe启动 netboot

set net0/ip <ip>
set net0/netmask <netmask>
set net0/gateway <gateway>
set dns <nameserver>
ifopen net0
chain --autofree http://boot.netboot.xyz

2.禁用ipv6

echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6

3.alpine安装

setup-alpine
setup-disk -s 0 /dev/vda

4.分区调整

apk add e2fsprogs-extra
apk add ntfs-3g-progs
apk add cfdisk

一定要先

e2fsck -f /dev/vda2
resize2fs -f /dev/vda2 35G

再用cfdisk

5.换grub启动

apk del syslinux
apk add grub grub-bios
grub-install /dev/vda
blkid 
cat <<EOF >> /etc/grub.d/40_custom
menuentry "Alpine Linux" {
    set root=(hd0,1)
    linux /boot/vmlinuz root=UUID=caff7641-b9d3-435a-8282-fc3b15ae8b3a modules=sd-mod,usb-storage4,ext3 quiet
    initrd /boot/initramfs-vanilla
}
EOF

UUID为blkid显示的vda2

grub-mkconfig -o /boot/grub/grub.cfg

6.把memdisk复制到/boot,启动grub时按c
linux16 (hd0,msdos1)/boot/memdisk iso raw
initrd16 (hd0,msdos2)/win10.iso
boot

docker Daemon 代理

sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf <<-'EOF'
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:8080"
Environment="HTTPS_PROXY=http://proxy.example.com:8080"
Environment="NO_PROXY=localhost,127.0.0.1,.example.com"
EOF

bcdedit 启动 win10pe

bcdedit /create {ramdiskoptions} /d "win 10 pe"
bcdedit /set {radiopticons} ramdisksdidevice partition=D:
bcdedit /set {ramdiskoptions} ramdisksdipath \win10\Boot\boot.sdi
Bcdedit /create /d "Boot from Wim" /application osloader

运行完上面会生成guid,替换下面的guid

bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} device ramdisk=[D:]\win10\Sources\boot.wim,{ramdiskoptions}
bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} osdevice ramdisk=[D:]\win10\Sources\boot.wim,{ramdiskoptions}
bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} path \windows\system32\boot\winload.exe
bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} systemroot \windows
bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} winpe yes
bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} detecthal yes
bcdedit /displayorder {acd191c6-69d3-11ed-80cd-c9ce13ba6396} /addlast

windows 更新时间

https://learn.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings?tabs=config

1.更新time server

w32tm /config /manualpeerlist:"3.openwrt.pool.ntp.org time.ustc.edu.cn ntp1.aliyun.com" /syncfromflags:manual /update


w32tm /config /update /manualpeerlist:"0.pool.ntp.org,0x8 1.pool.ntp.org,0x8 2.pool.ntp.org,0x8 3.pool.ntp.org,0x8" /syncfromflags:manual

2.更新一次时间

w32tm /resync

hyper添加nvdia虚拟显卡

#如虚拟机名称为win10
Set-VM -Name "win10" -AutomaticStopAction TurnOff
Set-VM -GuestControlledCacheTypes $true -VMName "win10"

# 设置MMIO,总的io映射内存,我们直接设置为32GB(通用大小),出现其他问题再扩大即可
Set-VM -LowMemoryMappedIoSpace 1Gb -VMName "win10"
Set-VM -HighMemoryMappedIoSpace 32Gb -VMName "win10"

# 添加虚拟化,
Add-VMGpuPartitionAdapter -VMName "win10"

# 指定显卡添加,这个显卡ID通过Get-VMHostPartitionableGpu命令获取到的“Name”字段值
# 注意,低版本的window10是无法使用这个命令指定的
# Add-VMGpuPartitionAdapter -VMName "win10" -InstancePath "显卡ID"
# 例如我的显卡ID是:\\?\PCI#VEN_10DE&DEV_1F91&SUBSYS_1AB11043&REV_A1#4&1885b93c&0&0008#{064092b3-625e-43bf-9eb5-dc845897dd59}\GPUPARAV


# 添加后,设置自动配置显卡
Set-VMGpuPartitionAdapter -VMName "win10"


# 删除虚拟显卡的分配,配置错误可重新来
Remove-VMGpuPartitionAdapter -VMName "win10"


我们先复制物理机系统的
C:\Windows\System32\nvapi64.dll
放到虚拟机的:
C:\Windows\System32\nvapi64.dll

再复制物理机中的
C:\Windows\System32\DriverStore\FileRepository
目录中以nv开头的文件夹到虚拟机中的
C:\Windows\System32\HostDriverStore\FileRepository
目录下,其中HostDriverStore\FileRepository目录需要自己创建:
重启虚拟机即可

$vm = "你的虚拟机名称"
Remove-VMGpuPartitionAdapter -VMName $vm
Add-VMGpuPartitionAdapter -VMName $vm
Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionVRAM 1
Set-VMGpuPartitionAdapter -VMName $vm -MaxPartitionVRAM 11
Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionVRAM 10
Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionEncode 1
Set-VMGpuPartitionAdapter -VMName $vm -MaxPartitionEncode 11
Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionEncode 10
Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionDecode 1
Set-VMGpuPartitionAdapter -VMName $vm -MaxPartitionDecode 11
Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionDecode 10
Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionCompute 1
Set-VMGpuPartitionAdapter -VMName $vm -MaxPartitionCompute 11
Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionCompute 10
Set-VM -GuestControlledCacheTypes $true -VMName $vm
Set-VM -LowMemoryMappedIoSpace 1GB -VMName $vm
Set-VM -HighMemoryMappedIoSpace 32GB -VMName $vm
Start-VM -Name $vm