1. Partition and Format the USB

1.1 Partition the USB in MBR using util-linux cfdisk and create a single FAT32 partition (MBR partition type code 0x0c).

1.2 Format the USB partition to FAT32 in linux

mkfs.vfat -F32 /dev/[USB_DEVICE_PART]

1.3 Mount the USB FAT32 partition using

mount -t vfat -o rw,flush /dev/[USB_DEVICE_PART] [MOUNTPOINT]

2. Extract Microsoft Windows x86_64 ISO to the USB

2.1 Extract the Windows x86_64 iso into [MOUNTPOINT] using 7-zip (p7zip) or bsdtar.

2.2 (Optional) Rename [MOUNTPOINT]/sources/ei.cfg to [MOUNTPOINT]/sources/ei.cfg_ .

2.3 Extract bootmgfw.efi from [WINDOWS_x86_64_ISO]/sources/install.wim => [INSTALL.WIM]/1/Windows/Boot/EFI/bootmgfw.efi (using 7-zip aka p7zip for both the files), or copy it from C:\Windows\Boot\EFI\bootmgfw.efi from a working Windows x86_64 installation.

2.4 Copy the extracted bootmgfw.efi file to [MOUNTPOINT]/efi/microsoft/boot/bootmgfw.efi .


3. Extract Linux ISO to USB


3.1 Arch Linux

3.1.1 Archboot ISO (maintained by Tobias Powalowski aka tpowa)

3.1.1.1 Extract the Archboot iso into [MOUNTPOINT] using bsdtar or 7-zip (p7zip).

3.1.1.2 If [MOUNTPOINT]/efi/boot/bootx64.efi file does not exist, extract [MOUNTPOINT]/boot/grub/grub_uefi_x86_64.bin => [GRUB_UEFI_X86_64.BIN]/efi/boot/bootx64.efi using p7zip and copy it to [MOUNTPOINT]/efi/boot/bootx64.efi .

3.1.1.3 [GRUB_UEFI_CONFIG]=[MOUNTPOINT]/boot/grub/grub_archboot.cfg and [SYSLINUX_BIOS_CONFIG]=[MOUNTPOINT]/boot/syslinux/syslinux.cfg .


3.2 Ubuntu x86_64 ISO

3.2.1 Extract the Ubuntu x86_64 iso into [MOUNTPOINT] using 7-zip (p7zip) or any other appropriate tool.

3.2.2 If [MOUNTPOINT]/efi/boot/bootx64.efi file does not exist, extract [MOUNTPOINT]/boot/grub/efi.img => <EFI.IMG>/efi/boot/bootx64.efi using p7zip and copy it to [MOUNTPOINT]/efi/boot/bootx64.efi .

3.2.3 [GRUB_UEFI_CONFIG]=[MOUNTPOINT]/boot/grub/grub.cfg and [SYSLINUX_BIOS_CONFIG]=[MOUNTPOINT]/isolinux/isolinux.cfg .


3.3 Fedora x86_64 ISO


4. Setup BIOS Syslinux Bootloader in the USB

4.1 Install syslinux package from your distro repo.

4.2 Copy all the files from [SYSLINUX_DIR] (usually /usr/lib/syslinux or /usr/share/syslinux)

mkdir -p [MOUNTPOINT]/boot/syslinux  ## if the directory does not exist
cp [SYSLINUX_DIR]/*.com [SYSLINUX_DIR]/*.bin [SYSLINUX_DIR]/*.c32 [MOUNTPOINT]/boot/syslinux  ## even if [MOUNTPOINT]/boot/syslinux/*.{com,bin,c32} files already exist

4.3 Copy [SYSLINUX_BIOS_CONFIG] file to [MOUNTPOINT]/boot/syslinux/syslinux.cfg .

4.4 Install syslinux to the bootsector of the FAT32 partition of the USB drive.

extlinux --install [MOUNTPOINT]/boot/syslinux

4.5 Activate the USB FAT32 partition’s “Active/Boot” flag/attribute using fdisk from util-linux.

4.6 Write syslinux boot code to the MBR region of the USB drive.

dd if=[SYSLINUX_DIR]/mbr.bin of=/dev/[USB_DEVICE] bs=440 count=1

5. Add Windows Chainload commands

5.1 Find the UUID of the FAT32 filesystem in the USB DEVICE

grub-probe --target=fs_uuid [MOUNTPOINT]/efi/Microsoft/Boot/bootmgfw.efi

5.2 Add the below code (as it is) (using 1ce5-7f28 as an example FS UUID obtained from the step 5.1)

menuentry "Microsoft Windows x86_64 UEFI-GPT Setup" {
    insmod usbms  
    insmod part_gpt  
    insmod part_msdos  
    insmod fat  
    insmod search_fs_uuid  
    insmod chain  
    search --fs-uuid --no-floppy --set=root 1ce5-7f28  
    chainloader /efi/Microsoft/Boot/bootmgfw.efi  
}

to [GRUB_UEFI_CONFIG] .

5.2 Add the below code (as it is)

LABEL windows
MENU LABEL Microsoft Windows x86_64 BIOS-MBR Setup  
COM32 chain.c32  
APPEND fs ntldr=/bootmgr

to [MOUNTPOINT]/boot/syslinux/syslinux.cfg .


Now you have a Linux BIOS+UEFI and Windows x86_64 BIOS+UEFI bootable USB.

To boot Windows x64 Setup in UEFI mode select “Microsoft Windows x86_64 UEFI-GPT Setup” in the GRUB-UEFI menu.
To boot Windows x64 Setup in BIOS mode select “Microsoft Windows x86_64 BIOS-MBR Setup” in the SYSLINUX menu.