Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f855faabd | ||
|
|
905f95ae7b | ||
|
|
2af0bed0df | ||
|
|
bcc7f08832 | ||
|
|
0ad90c7ef7 | ||
|
|
9361a3cd4b | ||
|
|
6fc6f0ad94 | ||
|
|
8354ffdc14 | ||
|
|
68b616a916 | ||
|
|
fd26a51536 | ||
|
|
00d4a7ea5a | ||
|
|
1786bd582d | ||
|
|
ed82962bae |
@@ -17,9 +17,9 @@ Features:
|
||||
Windows 7/8/8.1/10/11 ISO to Flash Drive burning utility
|
||||
WARNING: this program will delete all existing data on your drive!
|
||||
|
||||
windows2usb <device> <windows iso> <mbr/gpt/gptntfs/gpt+uefintfs>
|
||||
windows2usb <device> <windows iso> [mbr/gpt/gptntfs/gpt+uefintfs]
|
||||
|
||||
mbr mode: the most universal, RECOMMENDED method.
|
||||
mbr mode: the most universal, RECOMMENDED and DEFAULT method.
|
||||
This mode creates MBR partition table with FAT32 partition,
|
||||
installs BIOS and UEFI bootloaders, supports Secure Boot.
|
||||
install.wim file larger than 4 GiB will be split.
|
||||
@@ -44,12 +44,25 @@ gpt+uefintfs mode: alternative hacky installation method, not recommended.
|
||||
|
||||
Download latest [portable AppImage version](https://github.com/ValdikSS/windows2usb/releases) from the **Releases** page, set *execution bit* (`chmod +x windows2usb-*.AppImage`) and run it from the terminal.
|
||||
|
||||
`windows2usb <device> <windows iso> <mbr/gpt/gptntfs/gpt+uefintfs>"`
|
||||
`windows2usb <device> <windows iso>`
|
||||
|
||||
For example:
|
||||
|
||||
`./windows2usb.AppImage /dev/sdz /home/valdikss/windows10.iso`
|
||||
|
||||
The program prints removable storage list if no arguments are supplied.
|
||||
|
||||
If you don't want to use AppImage, you'll need to install all dependencies and download [uefi-ntfs.img](https://github.com/pbatard/rufus/tree/master/res/uefi) from Rufus project.
|
||||
|
||||
### Feature Matrix
|
||||
|
||||
|Modes |Legacy/UEFI-CSM Boot|UEFI Boot|Large ISO (>4GB)|Secure Boot|File System|Part Table|
|
||||
|:----------:|:------------------:|:-------:|:--------------:|:---------:|:---------:|:--------:|
|
||||
|mbr(hybrid) |Supported |Supported|Supported |Supported |FAT32 |MBR |
|
||||
|gpt |No |Supported|Supported |Supported |FAT32 |GPT |
|
||||
|gptntfs |No |Partial |Supported |Supported |NTFS |GPT |
|
||||
|gpt+uefintfs|No |Supported|Supported |No |NTFS |GPT |
|
||||
|
||||
### BIOS Boot
|
||||
|
||||
BIOS Boot (Legacy Boot/UEFI-CSM) uses stock Windows 7 MBR and FAT32 bootloader, courtesy of [ms-sys](http://ms-sys.sourceforge.net/) project.
|
||||
|
||||
+23
-24
@@ -4,7 +4,7 @@ set -f # noglob
|
||||
set +o braceexpand # disable braceexpand
|
||||
shopt -s nocasematch # for "if labeltype"
|
||||
|
||||
export LANG=C
|
||||
export LANG=C.utf8
|
||||
|
||||
bold="$(tput bold)"
|
||||
normal="$(tput sgr0)"
|
||||
@@ -52,6 +52,7 @@ function format_drive() {
|
||||
if [[ "$1" == "dos" ]] || [[ "$1" == "gpt" ]];
|
||||
then
|
||||
echo "label: $1" | sfdisk "$2"
|
||||
sleep 3
|
||||
else
|
||||
echo "${bold} == format_drive: INTERNAL ERROR ==${normal}"
|
||||
exit 101
|
||||
@@ -63,7 +64,7 @@ function get_iso_name() {
|
||||
}
|
||||
|
||||
function check_installwim_gt4gib() {
|
||||
7z l "$1" | awk '($6 ~ /install.wim/) {if ($4 > 4294967296) {exit 0}; exit 1}'
|
||||
7z l "$1" | awk 'BEGIN {doend=1} ($6 ~ /install.wim/) {if ($4 > 4294967296) {doend=0; exit 0}; doend=0; exit 1} END {if (doend) {exit 1}}'
|
||||
}
|
||||
|
||||
function create_partitions() {
|
||||
@@ -94,6 +95,9 @@ function create_partitions() {
|
||||
echo "${bold} == create_partitions: INTERNAL ERROR ==${normal}"
|
||||
exit 102
|
||||
fi
|
||||
# Wait 1 second to settle new partition table
|
||||
# See bug #24
|
||||
sleep 1
|
||||
}
|
||||
|
||||
function get_dev_partition_num() {
|
||||
@@ -147,10 +151,16 @@ function split_wim() {
|
||||
}
|
||||
|
||||
function extract_bootmgfw_from_installwim() {
|
||||
# $1 - install.wim path
|
||||
# $2 - destdir
|
||||
# $1 - isopath
|
||||
# $2 - isomountpath
|
||||
# $3 - destdir
|
||||
|
||||
7z e "$1" -o"$2" 1/Windows/Boot/EFI/bootmgfw.efi
|
||||
local fpath="$2/sources/install.wim"
|
||||
[ ! -a "$fpath" ] && fpath="$2/sources/install.esd"
|
||||
|
||||
mount -o ro "$1" "$2"
|
||||
7z e "$fpath" -o"$3/efi/boot/" '?/Windows/Boot/EFI/bootmgfw.efi'
|
||||
umount "$2"
|
||||
}
|
||||
|
||||
function umount_rm_path() {
|
||||
@@ -169,14 +179,14 @@ function sigint_handler() {
|
||||
umount_rm_path "$partpath" "$isomountpath"
|
||||
}
|
||||
|
||||
if [[ ! "$3" ]];
|
||||
if [[ ! "$2" ]];
|
||||
then
|
||||
echo "${bold}Windows 7/8/8.1/10/11 ISO to Flash Drive burning utility"
|
||||
echo "WARNING: this program will delete all existing data on your drive!${normal}"
|
||||
echo
|
||||
echo "$(basename "$0")" "<device> <windows iso> <mbr/gpt/gptntfs/gpt+uefintfs>"
|
||||
echo "$(basename "$0")" "<device> <windows iso> [mbr/gpt/gptntfs/gpt+uefintfs]"
|
||||
echo
|
||||
echo "mbr mode: the most universal, RECOMMENDED method."
|
||||
echo "mbr mode: the most universal, RECOMMENDED and DEFAULT method."
|
||||
echo " This mode creates MBR partition table with FAT32 partition,"
|
||||
echo " installs BIOS and UEFI bootloaders, supports Secure Boot."
|
||||
echo " install.wim file larger than 4 GiB will be split."
|
||||
@@ -208,6 +218,7 @@ then
|
||||
isopath="$2"
|
||||
isolabel=""
|
||||
labeltype="$3"
|
||||
[[ ! "$labeltype" ]] && labeltype="mbr"
|
||||
mountntfs_cmd="mount.ntfs-3g"
|
||||
if ! command -v "$mountntfs_cmd" > /dev/null;
|
||||
then
|
||||
@@ -236,19 +247,16 @@ then
|
||||
echo "${bold} == Creating new MBR-formatted partition table ==${normal}"
|
||||
format_drive "dos" "$dev"
|
||||
|
||||
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
|
||||
sleep 3
|
||||
|
||||
echo "${bold} == Creating FAT partition ==${normal}"
|
||||
create_partitions "dos" "$dev"
|
||||
mkfs.vfat -n "${isolabel:0:11}" "$(get_dev_partition_num "${dev}" "1")"
|
||||
|
||||
echo "${bold} == Writing bootloader ==${normal}"
|
||||
ms-sys -7 "${dev}"
|
||||
ms-sys -7 -f "${dev}"
|
||||
ms-sys -e "$(get_dev_partition_num "${dev}" "1")"
|
||||
|
||||
echo "${bold} == Mounting data partition ==${normal}"
|
||||
mount "$(get_dev_partition_num "${dev}" "1")" "$partpath"
|
||||
mount -o utf8=true "$(get_dev_partition_num "${dev}" "1")" "$partpath"
|
||||
|
||||
# GPT FAT32
|
||||
elif [[ "$labeltype" == "gpt" ]];
|
||||
@@ -256,15 +264,12 @@ then
|
||||
echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
|
||||
format_drive "gpt" "$dev"
|
||||
|
||||
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
|
||||
sleep 3
|
||||
|
||||
echo "${bold} == Creating FAT partition ==${normal}"
|
||||
create_partitions "gpt" "$dev"
|
||||
mkfs.vfat -n "${isolabel:0:11}" "$(get_dev_partition_num "${dev}" "1")"
|
||||
|
||||
echo "${bold} == Mounting data partition ==${normal}"
|
||||
mount "$(get_dev_partition_num "${dev}" "1")" "$partpath"
|
||||
mount -o utf8=true "$(get_dev_partition_num "${dev}" "1")" "$partpath"
|
||||
|
||||
# GPT NTFS
|
||||
elif [[ "$labeltype" == "gptntfs" ]];
|
||||
@@ -274,9 +279,6 @@ then
|
||||
echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
|
||||
format_drive "gpt" "$dev"
|
||||
|
||||
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
|
||||
sleep 3
|
||||
|
||||
echo "${bold} == Creating Microsoft NTFS partition ==${normal}"
|
||||
create_partitions "gptntfs" "$dev"
|
||||
mkfs.ntfs -L "$isolabel" -f "$(get_dev_partition_num "${dev}" "1")"
|
||||
@@ -292,9 +294,6 @@ then
|
||||
echo "${bold} == Creating new GPT-formatted partition table ==${normal}"
|
||||
format_drive "gpt" "$dev"
|
||||
|
||||
echo "${bold} == Waiting 3 seconds to settle new partition layout ==${normal}"
|
||||
sleep 3
|
||||
|
||||
echo "${bold} == Creating UEFI FAT and Microsoft NTFS partitions ==${normal}"
|
||||
create_partitions "gpt+uefintfs" "$dev"
|
||||
write_uefintfs "$(get_dev_partition_num "${dev}" "1")"
|
||||
@@ -325,7 +324,7 @@ then
|
||||
then
|
||||
echo "${bold} == Extracting UEFI bootloader from install.wim ==${normal}"
|
||||
mkdir -p "$partpath/efi/boot/" || true
|
||||
extract_bootmgfw_from_installwim "$partpath/sources/install.wim" "$partpath/efi/boot/"
|
||||
extract_bootmgfw_from_installwim "$isopath" "$isomountpath" "$partpath"
|
||||
mv "$partpath/efi/boot/bootmgfw.efi" "$partpath/efi/boot/bootx64.efi"
|
||||
cp "$partpath/efi/boot/bootx64.efi" "$partpath/efi/boot/bootia32.efi"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user