Build
Convert Img to VMDK
# Uncompress the .img.gz File
cd /path/to/your/file
gunzip openwrt-23.05.4-x86-64-generic-squashfs-combined-efi.img.gz
# convert the .img file to .vmdk:
brew install qemu
qemu-img convert -O vmdk openwrt-23.05.4-x86-64-generic-squashfs-combined-efi.img openwrt-23.05.4-x86-64-generic-squashfs-combined-efi.vmdk
Convert VMDK to ESXi
Enable ESXi SSH
Find the path
# 在ESXi主机上,使用vmkfstools将上传的openwrt.vmdk再次转换
[root@localhost:~] cd /vmfs/volumes/62371dc9-d12b4174-4dab-60beb4007eae
[root@localhost:/vmfs/volumes/62371dc9-d12b4174-4dab-60beb4007eae] cd op
[root@localhost:/vmfs/volumes/62371dc9-d12b4174-4dab-60beb4007eae/op] ls
openwrt-23.05.4-x86-64-generic-squashfs-combined-efi-s001.vmdk
openwrt-23.05.4-x86-64-generic-squashfs-combined-efi.vmdk
[root@localhost:/vmfs/volumes/62371dc9-d12b4174-4dab-60beb4007eae/op] vmkfstools -i openwrt-23.05.4-x86-64-generic-squashfs-combined-efi.vmdk -d thin openwrt-23.05.4-x86-64-generic-squashfs-combined-efi-esxi7.vmdk
Destination disk format: VMFS thin-provisioned
Cloning disk 'openwrt-23.05.4-x86-64-generic-squashfs-combined-efi.vmdk'...
Clone: 100% done.
# for ext4
# vmkfstools -i openwrt-23.05.4-x86-64-generic-ext4-combined-efi.vmdk -d thin openwrt-23.05.4-x86-64-generic-ext4-combined-efi-esxi7.vmdk
[root@localhost:/vmfs/volumes/62371dc9-d12b4174-4dab-60beb4007eae/op] ls
openwrt-23.05.4-x86-64-generic-squashfs-combined-efi-esxi7-flat.vmdk
openwrt-23.05.4-x86-64-generic-squashfs-combined-efi-esxi7.vmdk
openwrt-23.05.4-x86-64-generic-squashfs-combined-efi-s001.vmdk
openwrt-23.05.4-x86-64-generic-squashfs-combined-efi.vmdk
可见转换后有两个文件,一个是openwrt_lan.vmdk
,此时它实际上只是一个配置文件,如果感兴趣查看一下里面的参数;另一个是openwrt_lan-flat.vmdk
,这个才是虚拟磁盘文件。但是在esxi中是看不到-flat
文件的,所以不要误将其删除。
可以将转换前的vmdk删除,以免后期维护时搞不清楚用的是哪个vmdk磁盘。
Set NICs Pass Through
Install OpenWrt
Add a Disk for OpenWrt Img by selecting Add hard disk
- Existing hard disk
, and then select the vmdk
Reference
- https://www.youtube.com/watch?v=zADQKWkjmTc&t=65s
- https://www.youtube.com/watch?v=kcvkp1ckSmM
- https://http.ooo/7.html
- https://www.youtube.com/watch?v=Yvij4mdHvMw