This creates a bootable Windows Installer device for booting on UEFI systems.
You can use this to make a bootable Windows USB drive.
This is not something I use very often, so don't expect much development.
You need the following stuff:
- zsh
- 7-Zip / p7zip (for
7z) - fdisk / gptfdisk (for
sgfdisk) - dosfstools (for
mkfs.vfat) - ntfs-3g (for
mkfs.ntfs) - gawk (for
awk)
Most distros will have the majority by default.
On Arch Linux you can install all these with:
pacman -Sy --needed zsh p7zip ntfs-3g parted dosfstools gptfdisk gawkUsage: mkwinimg.sh ISO DEVICE
ISO is the path to the ISO you wish to use.
DEVICE is the path to the device you wish to use. You can use loop devices with this.
Make a bootable USB drive (/dev/sdb) using an ISO:
mkwinimg.sh 'Win10_21H2_English_x64.iso' /dev/sdbCreate an image file for dd-ing later.
truncate --size 8G win10.img
losetup --show -P -f win10.img
# ↑ gives you the name (eg. /dev/loop1)
mkwinimg.sh 'CMGE_V2020-L.1207.iso' /dev/loop1
losetup -d /dev/loop1To make it as small as possible:
fdisk -l win10.img # multiply sector size by last end sector
truncate --size (result_goes_here) win10.imgTo apply it to a device (/dev/sdb here):
dd if=win10.img of=/dev/sdb bs=1M status=progress oflag=syncThis will not work with BIOS/Legacy systems.
You can't make anything of the sort work cleanly with BIOS because the "people" responsible for the Windows Installer are either idiots or (if they broke it on purpose) cunts. I won't elaborate on that.