Jump to content
  • entries
    17
  • comments
    12
  • views
    8,653

bootable windows setup usb on linux , that is capable of  booting in EFI mode and with secureboot enabled

Herr.Hoefkens

1,262 views

making a bootable windows setup usb on linux , that is capable of  booting in EFI mode and with secureboot enabled :

 

01. Connect your USB Flash drive. Please note that you will be erasing all the data on it.
02. Open a disk manament app capable of setting efi guids (cgdisk gdisk parted ,...).
03. Delete all partitions on the USB drive
04. Create a new, 1GB partition and give it a GUID for ESP (EF00 in gdisk). and NAME it "ESP" (this will be  its partlabel)
05. Create a second  partiton comprising the rest of the usb with the type: "ms basic data" (0700 in cgdisk) NAME it DATA
06. wite the partition scheme to the usb and exit.
07. next run 
    

# partprobe


08. format the fist partion as fat32:
 

    # mkfs.vfat -F 32 -n ESP /dev/disk/by-partlabel/ESP


09. format the second partition as NTFS:
 

    # mkfs.ntfs -Q -L DATA /dev/disk/by-partlabel/DATA


10. create a working dir:
 

    # mkdir -p /mnt/mkbootusb/{USB/{ESP,DATA},ISO}


11. Mount the ISO :
 

    # mount -o loop /path/to/[MS WINDOWS ISO].ISO  /mnt/mkbootusb/ISO


12. Mount the 2 usb partitions:
 

    # mount -t vfat  /dev/disk/by-label/ESP  /mnt/mkbootusb/USB/ESP
    # mount -t ntfs3 /dev/disk/by-label/DATA /mnt/mkbootusb/USB/DATA


13     Copy all the files and folders but the sources folder to the ESP of the usb:
 

    # cd /mnt/mkbootusb/ISO
    # ls -1A | awk '$1 != "sources" {print $0}'|xargs -n1 cp -avf -t /mnt/mk.bootusb/USB/ESP/


14. Create the sources folder empty and by hand on the ESP partition:
 

    # mkdir /mnt/mkbootusb/USB/ESP/sources


15. Copy boot.wim  from the  sources folder of the iso into the sources folder on the USB ESP
 

    # cp -vf ./sources/boot.wim  /mnt/mk.bootusb/USB/ESP/sources/


16. copy everything form  Windows 11 ISO again this time including everything to the DATA partition:
 

    #ls -1A  | xargs -n1 cp -avf /mnt/mkbootusb/USB/DATA/


17. Done.

Usb bootable on (U)EFI systems , and with or without secure boot enabled.
 

0 Comments

There are no comments to display.

×