From 83c044da72a3055d2ce7b975a09b817bbec0ffa5 Mon Sep 17 00:00:00 2001 From: Jose Cerrejon Date: Mon, 6 Jul 2020 19:05:19 +0200 Subject: [PATCH 1/2] Raspberry 4 suppot. Refactor code. --- pisetup.sh | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/pisetup.sh b/pisetup.sh index e4a92623..095cc94d 100755 --- a/pisetup.sh +++ b/pisetup.sh @@ -1,6 +1,7 @@ #!/bin/bash # Super Mario 64 PC on Raspberry Pi -# Find latest updates and code on https://www.github.com/sm64pc/sm64pc +# Find latest updates and code on https://www.github.com/sm64pc/sm64pc +# NOTE: If you clone the repo, source must be copied in ~/src/sm64pi/sm64pc/ # ToDo: Test on more Pi models with fresh Raspbian and allow existing src folders to be updated. # clear @@ -11,11 +12,11 @@ lowmem=0 pi=0 pimodel=$(uname -m 2>/dev/null || echo unknown) pitype=$(tr -d '\0' < /sys/firmware/devicetree/base/model) +repo_url="https://github.com/sm64pc/sm64pc" if [[ $pimodel =~ "armv6" ]] then - echo "" - echo "Raspberry Pi Model 1/0(W) detected (LOWMEM)" + echo -e "\nRaspberry Pi Model 1/0(W) detected (LOWMEM)" echo "Warning: Additional steps may be required to safely compile and maximize performance" pi=1; lowmem=1; @@ -24,16 +25,14 @@ fi if [[ $pimodel =~ "armv7" ]] then - echo - echo "Raspberry Pi Model 2/3 detected (32bit)" + echo -e "\nRaspberry Pi Model 2/3/4 detected (32bit)" pi=2; lowmem=0; fi if [[ $pimodel =~ "aarch64" && $pitype =~ "4" ]] then - echo - echo "Raspberry Pi Model 4 detected" + echo -e "\nRaspberry Pi Model 4 (64 bits) detected" echo "Audio errors reported" echo "Fixing audio config, reboot after compilation completes to activate" sudo sed -i 's/load-module module-udev-detect/load-module module-udev-detect tsched=0/' /etc/pulse/default.pa @@ -51,14 +50,14 @@ then echo "Further steps may be required and software / driver compatibility is not guaranteed." read -p "Continue setup & compilation (Y/N): " exp - if [[ $exp =~ "Y" ]] + if [[ $exp =~ [Yy] ]] then echo "" else exit fi - echo "Please report any problems encountered to https://github.com/sm64pc/sm64pc issue tracker." + echo "Please report any problems encountered to ${repo_url} issue tracker." echo "" sleep 7 fi @@ -79,7 +78,7 @@ if [[ $inxinf =~ "not found" ]] then echo "Error: inxi not installed. Installing..." sudo apt-get update -sudo apt-get install inxi +sudo apt-get install -y inxi inxi=$(inxi -Gx) if [[ $inxinf =~ "not found" ]] @@ -130,7 +129,7 @@ fixmem=$(cat /boot/cmdline.txt | grep cma=128M) echo "" read -p "Fix mem? (Y/N): " fixmem - if [[ $fixmem =~ "Y" ]] + if [[ $fixmem =~ [Yy] ]] then sudo sh -c "echo 'gpu_mem=48' >> /boot/config.txt" sudo sh -c "echo 'cma=128M' >> /boot/cmdline.txt" @@ -146,12 +145,12 @@ fixmem=$(cat /boot/cmdline.txt | grep cma=128M) fi fi -if [[ $fixmem =~ "Y" || $vc4add =~ "vc4" ]] +if [[ $fixmem =~ [Yy] || $vc4add =~ "vc4" ]] then clear echo "System configuration has changed!" read -p "Reboot to enable changes? (Y/N): " fixstart - if [[ $fixstart =~ "Y" ]] + if [[ $fixstart =~ [Yy] ]] then echo "" echo "Rebooting RasPi in 4 seconds! Press Control-C to cancel." @@ -170,11 +169,11 @@ echo "Step 1. Installing latest dependencies" echo "Allow installation & checking of Super Mario 64 compile dependencies?" read -p "Install? (Y/N): " instdep -if [[ $instdep =~ "Y" ]] +if [[ $instdep =~ [Yy] ]] then echo "" sudo apt-get update -sudo apt install build-essential git python3 libaudiofile-dev libglew-dev libsdl2-dev +sudo apt install -y build-essential git python3 libaudiofile-dev libglew-dev libsdl2-dev sync else echo "" @@ -193,14 +192,14 @@ echo "" echo "Warning: Compile could take up to an hour on older Raspberry Pi models" read -p "Proceed? (Y/N): " sdlcomp -if [[ $sdlcomp =~ "Y" ]] +if [[ $sdlcomp =~ [Yy] ]] then echo "" echo "Installing dependencies for SDL2 compilation" sudo sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list" sudo apt build-dep libsdl2 -sudo apt install libdrm-dev libgbm-dev +sudo apt install -y libdrm-dev libgbm-dev sync echo "" @@ -265,13 +264,13 @@ fi #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ -if [[ $sm64git =~ "Y" || $sm64dir == 0 || $curdir == 0 ]] #If user wants to redownload or NOT git-zip execution +if [[ $sm64git =~ [Yy] || $sm64dir == 0 || $curdir == 0 ]] #If user wants to redownload or NOT git-zip execution then echo "Step 2. Super Mario 64 PC-Port will now be downloaded from github" echo "Current folder will NOT be compiled." read -p "Proceed? (Y/N): " gitins -if [[ $gitins =~ "Y" ]] +if [[ $gitins =~ [Yy] ]] then echo "" echo "Creating directory "$HOME"/src/sm64pi" @@ -282,7 +281,7 @@ cd $HOME/src/sm64pi echo "" echo "Downloading latest Super Mario 64 PC-port code" -git clone https://github.com/sm64pc/sm64pc +git clone ${repo_url} cd $HOME/src/sm64pi/sm64pc/ echo "Download complete" echo "" @@ -358,7 +357,12 @@ echo "At least 300MB of free storage AND RAM is recommended" echo "" make clean sync +if [[ $pimodel =~ "armv6" ]] +then make TARGET_RPI=1 +else +make TARGET_RPI=1 -j4 +fi sync @@ -391,7 +395,7 @@ echo "" echo "Execute compiled Super Mario 64 RasPi?" read -p "Run game (Y/N): " sm64run -if [[ $sm64run =~ "Y" ]] +if [[ $sm64run =~ [Yy] ]] then cd chmod +x $sm64loc @@ -402,7 +406,7 @@ fi else echo "Cannot find compiled sm64*.arm binary..." echo "Please note of any errors during compilation process and report them to" -echo "https://github.com/sm64pc/sm64pc" +echo "${repo_url}" sleep 5 fi From d30a923e28ef639933fbe52edd100fa33ec9deb4 Mon Sep 17 00:00:00 2001 From: Jose Cerrejon Date: Mon, 6 Jul 2020 19:29:52 +0200 Subject: [PATCH 2/2] Update repo_url. Rename /sm64pi/sm64pc -> /sm64pc/sm64ex --- pisetup.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pisetup.sh b/pisetup.sh index 095cc94d..57a07ea3 100755 --- a/pisetup.sh +++ b/pisetup.sh @@ -1,7 +1,7 @@ #!/bin/bash # Super Mario 64 PC on Raspberry Pi -# Find latest updates and code on https://www.github.com/sm64pc/sm64pc -# NOTE: If you clone the repo, source must be copied in ~/src/sm64pi/sm64pc/ +# Find latest updates and code on https://www.github.com/sm64pc/sm64ex +# NOTE: If you clone the repo, source must be copied in ~/src/sm64pc/sm64ex/ # ToDo: Test on more Pi models with fresh Raspbian and allow existing src folders to be updated. # clear @@ -12,7 +12,7 @@ lowmem=0 pi=0 pimodel=$(uname -m 2>/dev/null || echo unknown) pitype=$(tr -d '\0' < /sys/firmware/devicetree/base/model) -repo_url="https://github.com/sm64pc/sm64pc" +repo_url="https://github.com/sm64pc/sm64ex" if [[ $pimodel =~ "armv6" ]] then @@ -233,10 +233,10 @@ clear echo "Super Mario 64 RPi preparation & downloader" echo "" echo "Checking in current directory and" -echo "checking in "$HOME"/src/sm64pi/sm64pc/ for existing Super Mario 64 PC files" +echo "checking in "$HOME"/src/sm64pc/sm64ex/ for existing Super Mario 64 PC files" echo "" sm64dircur=$(ls ./Makefile) -sm64dir=$(ls $HOME/src/sm64pi/sm64pc/Makefile) +sm64dir=$(ls $HOME/src/sm64pc/sm64ex/Makefile) if [[ $sm64dircur =~ "Makefile" ]] #If current directory has a makefile then @@ -256,7 +256,7 @@ then curdir=1 fi -else #Do a fresh compile in HOME/src/sm64pi/sm64pc/ +else #Do a fresh compile in HOME/src/sm64pc/sm64ex/ sm64dir=0; curdir=0; fi @@ -273,16 +273,16 @@ read -p "Proceed? (Y/N): " gitins if [[ $gitins =~ [Yy] ]] then echo "" -echo "Creating directory "$HOME"/src/sm64pi" +echo "Creating directory "$HOME"/src/sm64pc" mkdir $HOME/src/ cd $HOME/src/ -mkdir $HOME/src/sm64pi -cd $HOME/src/sm64pi +mkdir $HOME/src/sm64pc +cd $HOME/src/sm64pc echo "" echo "Downloading latest Super Mario 64 PC-port code" git clone ${repo_url} -cd $HOME/src/sm64pi/sm64pc/ +cd $HOME/src/sm64pc/sm64ex/ echo "Download complete" echo "" sleep 2 @@ -302,14 +302,14 @@ if [[ $curdir == 1 ]] then echo "Assets will be extracted from "$PWD" " else -echo "Assets will be extracted from $HOME/src/sm64pi/sm64pc/baserom.(us/eu/jp).z64 " +echo "Assets will be extracted from $HOME/src/sm64pc/sm64ex/baserom.(us/eu/jp).z64 " fi if [[ $curdir == 1 ]] then sm64z64=$(find ./* | grep baserom) #See if current directory is prepped else -sm64z64=$(find $HOME/src/sm64pi/sm64pc/* | grep baserom) #see if fresh compile directory is prepped +sm64z64=$(find $HOME/src/sm64pc/sm64ex/* | grep baserom) #see if fresh compile directory is prepped fi if [[ $sm64z64 =~ "baserom" ]] @@ -331,7 +331,7 @@ echo $PWD echo "" else echo "" -echo $HOME/src/sm64pi/sm64pc/ +echo $HOME/src/sm64pc/sm64ex/ fi sleep 5 @@ -347,7 +347,7 @@ echo "" if [[ $curdir != 1 ]] # If we're not compiling from a git zip / random directory then -cd $HOME/src/sm64pi/sm64pc/ +cd $HOME/src/sm64pc/sm64ex/ fi echo "Beginning Super Mario 64 RasPi compilation!" @@ -373,7 +373,7 @@ if [[ $curdir == 1 ]] then sm64done=$(find ./build/*/* | grep .arm) else -sm64done=$(find $HOME/src/sm64pi/sm64pc/build/*/* | grep .arm) +sm64done=$(find $HOME/src/sm64pc/sm64ex/build/*/* | grep .arm) fi echo "" @@ -386,7 +386,7 @@ if [[ $curdir == 1 ]] then $sm64loc=$(ls ./build/*pc/*.arm) else -$sm64loc=$(ls $HOME/src/sm64pi/sm64pc/build/*pc/*.arm) +$sm64loc=$(ls $HOME/src/sm64pc/sm64ex/build/*pc/*.arm) fi echo $sm64loc