You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support Pi4 and other non-A76 ARM cores with old windows build
Fixes honoring disable_updates value
Adds non-A76 core detection, and downloading of windows 11 version 22631
if detected
Adds wimtools dependency
Ensure vmdir is not FAT partition
Try to support Rockchip RK3399 by only running on performance cores
(untested)
Closes#5
da-dk:Danish\nnl-nl:Dutch\nen-us:English (United States)\nen-gb:English International\net-ee:Estonian\nfi-fi:Finnish\nfr-fr:French\nfr-ca:French Canadian
#convert from pretty language name to short-code used by esd releases - example: en-us
189
+
local WIN_LANG="$(list_download_languages | grep ":${download_language}$"| awk -F: '{print $1}')"
190
+
[ -z"$WIN_LANG" ] && error "download_windows_11arm64_22631: language must be specified in download_language variable. Get list of available languages by running $DIRECTORY/bvm list-languages"
191
+
[ -z"$vmdir" ] && error "download_windows_11arm64_22631: download folder for installer.iso must be specified in vmdir variable"
192
+
193
+
status "Downloading Windows 11 ARM64 (${download_language})"
catalog="$(echo "$catalog"| sed 's/></>\n</g'| sed -n '/<Languages>/q;p'| sed -n '/^<LanguageCode>'"${WIN_LANG}"'/,${p;/^<\/File>/q}')"
198
+
199
+
[ -z"$catalog" ] && error "Could not get list of Windows ESD releases. If you ran this step several times recently, the site likely temporarily banned your IP address. Give it time, and check if this site is accessible from your network: https://worproject.com/dldserv/esd/getcatalog.php"
200
+
201
+
rm -rf "$vmdir/esdextract"|| error "Failed to remove esdextract folder"
local LOCAL_SHA1="$(sha1sum "$SOURCE_FILE"| awk '{print $1}')"
217
+
if [ "$SHA1"!="$LOCAL_SHA1" ];then
218
+
error "\nSuccessfully downloaded ESD image $SOURCE_FILE, but it appears to be corrupted. Please run this script again.\n(Expected SHA1 hash is $SHA1, but downloaded file has SHA1 hash $LOCAL_SHA1"
219
+
fi
220
+
echo"Done"
221
+
fi
222
+
223
+
echo" - Scanning ESD image for partitions... "
224
+
#should always be 6, but doubles as a validity check
225
+
local professional_partition_num="$(wiminfo "$SOURCE_FILE"| grep -xB1 'Name: *Windows 11 Pro'| head -n1 | awk '{print $2}')"
226
+
[ -z"$professional_partition_num" ] && error "\nCould not find Windows Professional in image.esd"
227
+
228
+
status "Extracting Windows Setup Media to esdextract"
download_windows_11arm64() { #download latest stable windows 11 ISO language $download_language to $vmdir
182
251
# This function is adapted from the Mido project:
183
252
# https://github.com/ElliotKillick/Mido
@@ -197,8 +266,8 @@ download_windows_11arm64() { #download latest stable windows 11 ISO language $do
197
266
Make sure the file is named installer.iso
198
267
Then run this action again."
199
268
200
-
[ -z"$download_language" ] && error "download_windows_11arm64: language must be specified in download_language variable Available languages:\n$(list_download_languages | tr '\n''\t'| sed 's/\t/, \t/g')"
201
-
list_download_languages | grep -qF"$download_language"|| error "download_windows_11arm64: unrecognized language '$download_language'. Available languages:\n$(list_download_languages | tr '\n''\t'| sed 's/\t/, \t/g')"
269
+
[ -z"$download_language" ] && error "download_windows_11arm64: language must be specified in download_language variable. Get list of available languages by running $DIRECTORY/bvm list-languages"
270
+
list_download_languages |sed 's/.*://g'|grep -qFx"$download_language"|| error "download_windows_11arm64: unrecognized language '$download_language'. Get list of available languages by running $DIRECTORY/bvm list-language"
202
271
[ -z"$vmdir" ] && error "download_windows_11arm64: download folder for installer.iso must be specified in vmdir variable"
203
272
204
273
status "Downloading Windows 11 ARM64 (${download_language})"
echo"Updates available, but you have auto-updates disabled."
521
+
return 0
452
522
fi
453
523
echo"Auto-updating BVM for the latest features and improvements..."
454
524
(cd "$DIRECTORY"
@@ -476,6 +546,23 @@ copy_icons() { #install icons to a location where the panel will notice them
476
546
#for wf-panel-pi at least, updating icon caches seems to do no good
477
547
}
478
548
549
+
find_a76_cores() { #Some rockchip CPUs have A55 and A76 cores, and latest Windows will only support A76. Return 1 if not all cores are the same, list the A76 ones no matter what
550
+
local cores="$(cat /proc/cpuinfo | grep 'processor\|Features\|^$'| tr '\n''\r'| sed 's/\r\r/\n/g ; s/\r/ /g')"
551
+
552
+
local a76_cores="$(echo "$cores"| grep -w fphp | awk '{print $3}')"
553
+
local non_a76_cores="$(echo "$cores"| grep -vw fphp | awk '{print $3}')"
554
+
555
+
if [ -z"$a76_cores" ] || [ -z"$non_a76_cores" ];then
error "Your system needs at least 2 GB of RAM. Be aware that a VM might be able to boot on 1 GB of RAM, but it cannot install Windows with less than 2 GB."
error "The $DL_DIR directory is on a FAT32/FAT16/vfat partition. This type of partition cannot contain files larger than 4GB, however the Windows image will be larger than that.\nPlease format the drive with an Ext4 partition, or use another drive."
563
654
fi
564
655
565
656
install_dependencies ||exit 1
@@ -599,7 +690,7 @@ To get a fresh VM up and running, use a sequence like this:
599
690
;;
600
691
601
692
list-languages)
602
-
list_download_languages
693
+
list_download_languages| sed 's/.*://g'
603
694
;;
604
695
605
696
gui)
@@ -772,8 +863,19 @@ To get a fresh VM up and running, use a sequence like this:
772
863
error "Insufficient free disk space. $disksize GB is needed, but you only have $(($(get_space_free "$vmdir")/1024/1024/1024)) GB. You can try reducing the desired disk size in the config file to get around this error."
773
864
fi
774
865
775
-
#vmdir and $download_language must be set for this function
776
-
download_windows_11arm64 ||exit 1
866
+
#get either latest ISO if CPU supports it, or W11 22631 if CPU is not ARMv8.1+
867
+
if grep -wq fphp /proc/cpuinfo ;then
868
+
#ARMv8.1+, get latest windows (Pi5, A76 core)
869
+
#vmdir and $download_language must be set for this function
870
+
download_windows_11arm64 ||exit 1
871
+
872
+
#Patch the ISO to not require a keypress to boot
873
+
patch_iso_noprompt "$vmdir/installer.iso"||exit 1
874
+
else
875
+
warning "Downloading an older Windows version that is compatible with your device. Later versions of Windows 11 require ARM instructions that your CPU lacks."
876
+
#get Windows build 22631 for Pi4s and other A53 CPUs
#function returned 0, so all cores are the same and taskset is not needed
976
+
num_cores=$(nproc)#give QEMU all cores the CPU has
977
+
use_taskset=false
978
+
else
979
+
#some cores are performance cores, use them
980
+
warning "CPU detected with 2 types of cores. Trying to only use the performance cores, but this is untested code. PLEASE reach out to Botspot if it works, or if it does not work."
@@ -888,7 +1000,12 @@ To get a fresh VM up and running, use a sequence like this:
888
1000
889
1001
status "Windows should install 100% automatically. This will take several hours."
890
1002
#run qemu with these flags
891
-
qemu-system-aarch64 "${full_qemu_flags[@]}"|| error "QEMU did not exit successfully."
1003
+
if [ "$use_taskset"==false ];then
1004
+
qemu-system-aarch64 "${full_qemu_flags[@]}"|| error "QEMU did not exit successfully."
1005
+
else
1006
+
#For rockchip (untested but based on https://gist.github.com/Vogtinator/293c4f90c5e92838f7e72610725905fd?permalink_comment_id=5378278#gistcomment-5378278)
1007
+
taskset -c "$(echo "$a76_cores"| tr '\n'','| sed 's/,$//g')" qemu-system-aarch64 "${full_qemu_flags[@]}"|| error "QEMU did not exit successfully."
1008
+
fi
892
1009
status "QEMU closed."
893
1010
894
1011
#check disk.qcow2 and remove microsoft defender if debloat enabled
@@ -961,20 +1078,23 @@ To get a fresh VM up and running, use a sequence like this:
#function returned 0, so all cores are the same and taskset is not needed
1084
+
num_cores=$(nproc)#give QEMU all cores the CPU has
1085
+
use_taskset=false
1086
+
else
1087
+
#some cores are performance cores, use them
1088
+
warning "CPU detected with 2 types of cores. Trying to only use the performance cores, but this is untested code. PLEASE reach out to Botspot if it works, or if it does not work."
1089
+
num_cores="$(echo "$a76_cores"| wc -l)"
1090
+
use_taskset=true
1091
+
fi
972
1092
973
1093
#forward guest's port 3389 to localhost port of our choice (handled by config file now)
@@ -994,8 +1114,13 @@ To get a fresh VM up and running, use a sequence like this:
994
1114
debug "full_qemu_flags: ""${full_qemu_flags[@]}"
995
1115
996
1116
#run qemu with these flags
997
-
qemu-system-aarch64 "${full_qemu_flags[@]}"|| error "QEMU did not exit successfully."
998
-
1117
+
if [ "$use_taskset"==false ];then
1118
+
qemu-system-aarch64 "${full_qemu_flags[@]}"|| error "QEMU did not exit successfully."
1119
+
else
1120
+
#For rockchip (untested but based on https://gist.github.com/Vogtinator/293c4f90c5e92838f7e72610725905fd?permalink_comment_id=5378278#gistcomment-5378278)
1121
+
taskset -c "$(echo "$a76_cores"| tr '\n'','| sed 's/,$//g')" qemu-system-aarch64 "${full_qemu_flags[@]}"|| error "QEMU did not exit successfully."
0 commit comments