Skip to content

Instantly share code, notes, and snippets.

@jsm174
Last active April 2, 2024 21:57
Show Gist options
  • Save jsm174/4bae7cb6989922c4c6251bc9a843f97b to your computer and use it in GitHub Desktop.
Save jsm174/4bae7cb6989922c4c6251bc9a843f97b to your computer and use it in GitHub Desktop.
MPF 0.57.0 Orange Pi 5 Instructions

MPF 0.57.0 Mission Pinball - Installation on Orange PI 5

Start with an Armbian image 24.2.1 Jammy Gnome image available here:

https://www.armbian.com/orangepi-5/

Enable 3D Acceleration:

sudo add-apt-repository ppa:liujianfeng1994/panfork-mesa
sudo add-apt-repository ppa:liujianfeng1994/rockchip-multimedia
sudo apt update
sudo apt dist-upgrade
sudo apt install mali-g610-firmware rockchip-multimedia-config

Reboot

sudo reboot

Install development tools

sudo apt-get -y install mtools ncdu build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

Install shrink backup

curl https://raw.githubusercontent.com/UnconnectedBedna/shrink-backup/main/shrink-backup > shrink-backup
chmod +x shrink-backup
sudo mv shrink-backup /usr/local/bin

Install MPF dependencies

sudo apt-get -y install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-base gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libgstreamer1.0-dev libxine2-ffmpeg libsmpeg-dev libswscale-dev libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev libjpeg-dev libtiff5-dev libx11-dev libmtdev-dev libgl1-mesa-dev libgles2-mesa-dev pulseaudio lsb-release

Install Python 3.10

sudo apt-get -y install python3 python3-pip python3-dev

Upgrade PIP

sudo python3 -m pip install --upgrade pip

Install MPF

sudo pip3 install mpf==0.57.0
sudo pip3 install mpf-mc==0.57.0

Test MPF

(Adapted from https://docs.missionpinball.org/tutorial/2_creating_a_new_machine.html)

mkdir your_machine
cd your_machine
mkdir config
echo "#config_version=6" > config/config.yaml  
mpf -b

Install QT6 dependencies

(Adapted from https://doc.qt.io/qt-6/linux-building.html and https://www.ics.com/blog/how-build-qt-640-source-ubuntu-linux)

sudo apt install -y cmake bison build-essential clang flex gperf libatspi2.0-dev libbluetooth-dev libclang-dev libcups2-dev libdrm-dev libegl1-mesa-dev libfontconfig1-dev libfreetype6-dev libgstreamer1.0-dev libhunspell-dev libnss3-dev libopengl-dev libpulse-dev libssl-dev libts-dev libx11-dev libx11-xcb-dev libxcb-glx0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-shm0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxext-dev libxfixes-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libxkbfile-dev libxrandr-dev libxrender-dev libxshmfence-dev libxshmfence1 llvm llvm-dev ninja-build nodejs python-is-python3 python3

Download, compile, install QT 6.4.2, remove source

Takes about 2 hours

wget https://download.qt.io/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz
tar xvf qt-everywhere-src-6.4.2.tar.xz
cd qt-everywhere-src-6.4.2
./configure -prefix /usr/local/Qt6
cmake --build . --parallel
sudo cmake --install .
cd ..
sudo rm -rf qt-everywhere-src-6.4.2
rm qt-everywhere-src-6.4.2.tar.xz

Prebuild PyQt6 6.4.2

This takes about 1 hour

Required because PyQt6 is asking questions that can't be answered during pip3

sudo PATH=/usr/local/Qt6/bin:$PATH pip3 install PyQt6 PyQt6==6.4.2 --config-settings --confirm-license= --verbose

Install MPF Monitor

sudo pip3 install "mpf-monitor==0.57.0"

Make Image Of SD Card using shrink-backup

Mount a USB drive large enough to hold an image. The drive will be a directory in the /media folder

cd /media/mpf/8e1b6305-8346-49ca-8f51-7fe5a705fe37
sudo shrink-backup -a -l mpf_0-57-0_001.img

Auto Login

ssh -l mpf <ipaddress>
sudo armbian-config 

System -> Desktop -> Stop and Disable this service

Desktop -> Do you want to enable autologin? (YES)

Autostart MPF

Make a new mpf.desktop and place it in /home/mpf/.config/autostart.

Replace <machine> with the folder containing your machine.

[Desktop Entry]
Name=MPF
Comment=Mission Pinball
Exec=/home/mpf/<machine>/run.sh
Path=/home/mpf/<machine>/
Terminal=false
Type=Application

Create a run.sh in the folder containing your machine.

Replace <machine> with the folder containing your machine.

#!/bin/bash
gnome-terminal -- bash -c "cd /home/mpf/<machine> && mpf both"

Make run.sh executable:

chmod +x run.sh

Disable Power Saving

Settings -> Power -> 
   
   Power Saving Option:
   
      Dim Screen: OFF
      Screen Blank: Never
      Automatic Suspend: OFF
      
   Suspend & Power Button:
   
      Power Button Behavior: Power Off

Hide Top Bar

Install Chrome GNome Shell

sudo apt-get install chrome-gnome-shell

Install GNome Shell Integration extension in Chromium

Search for and enable Hide Top Bar

@UnconnectedBedna
Copy link

UnconnectedBedna commented Jan 25, 2024

Since you are such a nice person. :)

sudo dd if=/dev/mmcblk1 of=mpf.img bs=1m

If you still want to rely on this instead of the script, change bs to 4M, goes way faster (it is the size of each packet sent to the device). You can also add status=progress to make it verbose. :)

Otherwise this looks like a great install procedure.

@jsm174
Copy link
Author

jsm174 commented Jan 25, 2024

@UnconnectedBedna - thanks! I just made those updates. Soon I'll add steps to use your script!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment