From d105d109e2f21ee779b6cce8a9addfc5e6ed1d54 Mon Sep 17 00:00:00 2001 From: theofficialgman <28281419+theofficialgman@users.noreply.github.com> Date: Tue, 31 Oct 2023 16:22:34 -0400 Subject: [PATCH] Wine (x64) and Box86: add/update function to automatically change kernel pagesize on PiOS closes https://github.com/Botspot/pi-apps/issues/2475 --- apps/Box86/install-64 | 19 ++++++++++++++++++- apps/Wine (x64)/install-64 | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/apps/Box86/install-64 b/apps/Box86/install-64 index 89d2e4de2c..df651ebf33 100755 --- a/apps/Box86/install-64 +++ b/apps/Box86/install-64 @@ -2,7 +2,24 @@ PAGE_SIZE="$(getconf PAGE_SIZE)" if [[ "$PAGE_SIZE" == "16384" ]]; then - error "User error (reporting allowed): 16K pagesize not supported on box86. Check if your system supports running 32bit ARM binaries and open an issue on Box86 GitHub if it can." + #switch to 4K pagesize kernel + if [ -f /boot/config.txt ]; then + text="Raspberry Pi 5 PiOS images ship by default with a 16K PageSize Linux Kernel. +This kernel causes incompatibilities with some software including Box86 https://github.com/raspberrypi/bookworm-feedback/issues/107 + +Would you like to automatically switch to a 4K PageSize Linux Kernel?" + userinput_func "$text" "No, keep 16K PageSize Kernel and Exit" "Yes, switch to 4K PageSize Kernel" + if [ "$output" == "No, keep 16K PageSize Kernel and Exit" ]; then + error "User error: Your current running kernel is build with 16K PageSize and is incompatible with Box86. You chose not to do so automatically and you must switch to a 4K PageSize kernel before installing Box86." + fi + echo "[pi5]" | sudo tee --append /boot/config.txt >/dev/null + echo "kernel=kernel8.img" | sudo tee --append /boot/config.txt >/dev/null + "${DIRECTORY}/manage" uninstall "Box64" + echo -e "The 4K PageSize Kernel has been enabled by adding 'kernel=kernel8.img' to /boot/config.txt\nPlease reboot and install the Box86 (and Box64 if you had it previously installed) app again." + sleep infinity + else + error "User error (reporting allowed): Your current running kernel is build with 16K PageSize and is incompatible with Box86. Changing kernels automatically cannot be done since no /boot/config.txt file was found." + fi fi function check-armhf() { diff --git a/apps/Wine (x64)/install-64 b/apps/Wine (x64)/install-64 index 811d8991bc..c398d51b67 100755 --- a/apps/Wine (x64)/install-64 +++ b/apps/Wine (x64)/install-64 @@ -8,6 +8,14 @@ PAGE_SIZE="$(getconf PAGE_SIZE)" if [[ "$PAGE_SIZE" == "16384" ]]; then #switch to 4K pagesize kernel if [ -f /boot/config.txt ]; then + text="Raspberry Pi 5 PiOS images ship by default with a 16K PageSize Linux Kernel. +This kernel causes incompatibilities with some software including Wine https://github.com/raspberrypi/bookworm-feedback/issues/107 + +Would you like to automatically switch to a 4K PageSize Linux Kernel?" + userinput_func "$text" "No, keep 16K PageSize Kernel and Exit" "Yes, switch to 4K PageSize Kernel" + if [ "$output" == "No, keep 16K PageSize Kernel and Exit" ]; then + error "User error: Your current running kernel is build with 16K PageSize and is incompatible with Wine (x64) with Box64. You chose not to do so automatically and you must switch to a 4K PageSize kernel before installing Wine (x64)." + fi echo "[pi5]" | sudo tee --append /boot/config.txt >/dev/null echo "kernel=kernel8.img" | sudo tee --append /boot/config.txt >/dev/null "${DIRECTORY}/manage" uninstall "Box64"