Use Etcher on Mac to write Raspbian Stretch Lite to SD card.
$ sudo halt
$ sudo reboot
$ sudo raspi-config
$ ifconfig
$ iwconfig
$ sudo nano [filename]
$ ls -a
List all items, including hidden elements.$ ls -d. *
List only display hidden files and folders.ls -d. * /
List only hidden folders.ls -1
List each item with a new line.
Login Credentials
- Username: Pi
- Password: raspberry
Coping files over ssh. Option -r
lets you copy foldewr and files recursively.
$ scp [options] username1@source_host:directory1/filename1 username2@destination_host:directory2/filename2
Example:
$ sudo scp -r /localfolderpath/ [email protected]:~/
$ sudo nano /boot/config.txt
sdtv_mode=16
0 for normal NTSC, 16 for 240p. See video options in config.txt for more info.sdtv_aspect=1
1 for 4:3 aspect ratio. See video options in config.txt for more info.disable_splash=1
Remove rainbow screen on boot.gpu_mem=320
Set to 16 for when compiling in this guide and set to something such as 320 for when running attract and MAME. See gpu_mem for more info.
$ sudo nano /boot/cmdline.txt
Add the following to the end of the line.
logo.nologo
Turns off raspberries logo.vt.global_cursor_default=0
Turns off blinking cursor.
Create file /boot/wpa_supplicant.conf
. It will automatically get moved to /rootfs/etc/wpa_supplicant/wpa_supplicant.conf
on first boot. Placement of file works in either location.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="NAME"
psk="PASSWORD"
key_mgmt=WPA-PSK
}
You can confirm a connection by running $ iwconfig
.
Create an empty file boot/ssh
. It will enable ssh on first boot. To connect you must first find out the IP address of the Raspberry Pi by running $ ifconfig
. Run either of the following commands from the remote terminal.
$ ssh pi@<IPADDRESS>
$ ssh pi@<HOSTNAME>.local
$ ssh [email protected]
To exit a remote connection, run the exit
command.
You can also setup network and SSH directly from Raspberry Pi Configuration.
- Boot raspbian lite and login.
- Launch Raspberry Pi Configuration.
$ sudo raspi-config
See raspi-config for more info.
- Navigate to the following options and change parameters appropriately:
- 2 Network Options
- 3 Boot Options -> B1 Desktop / CLI -> B2 Console Autologin
- 4 Localisation Options
- 5 Interfacing Options -> P2 SSH
- 7 Advanced Options -> A3 Memory Split
- 8 Overclock -> High Must have at heatsinks installed
You can download and install this script to make setting overscan easy, whithout having to guess and reboot each time.
$ cd ~/
$ wget https://github.com/ukscone/set_overscan/archive/master.zip
$ unzip master.zip && rm master.zip
$ cd set_overscan-master
$ sudo make
$ sudo ./set_overscan.sh
Or edit /boot/config.txt
manually.
overscan_left=24
overscan_right=24
overscan_top=24
overscan_bottom=24
$ amixer sset PCM,0 100%
$ speaker-test -c2 -t wav
If using a RetroFlag case, this will set up the required script.
$ wget -O - "https://raw.githubusercontent.com/RetroFlag/retroflag-picase/master/install.sh" | sudo bash
$ sudo nano /opt/RetroFlag/SafeShutdown.py
Edit lines 19 and 23 to exclude references to emulation and sleep.
# line 19
# os.system("sudo killall emulationstation && sleep 5s && sudo shutdown -h now")
os.system("sudo shutdown -h now")
# line 23
# os.system("sudo killall emulationstation && sleep 5s && sudo reboot")
os.system("sudo reboot")
SDL2 is now installed by default but it is compiled for desktop users with support for X and OpenGL, neither of which we can take advantage of in a framebuffer and it will just confuse MAME if you try to compile using it.
Any program that uses SDL2 to draw to the framebuffer should now be doing it in hardware on the raspberry pis videocore4 using opengles2!
libsdl2-dev is
not installed on raspbian stretch lite. If using the desktop version, you must uninstall it.
$ sudo apt-get remove -y --force-yes libsdl2-dev
$ sudo apt-get autoremove -y
Add packages for build environment.
$ sudo apt-get install libfontconfig-dev qt5-default automake mercurial libtool libfreeimage-dev libopenal-dev libpango1.0-dev libsndfile-dev libudev-dev libtiff5-dev libwebp-dev libasound2-dev libaudio-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxss-dev libesd0-dev freeglut3-dev libmodplug-dev libsmpeg-dev libjpeg-dev
Create development directory.
cd ~
mkdir development
cd development
Get the latest libsdl build.
$ hg clone http://hg.libsdl.org/SDL
Build libsdl.
$ cd SDL
./autogen.sh
./configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-opengl --host=arm-raspberry-linux-gnueabihf
$ make
$ sudo make install
$ cd ../
Download all the utility libraries.
$ cd ~/development
$ wget http://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.2.tar.gz
$ wget http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.2.tar.gz
$ wget http://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz
$ wget http://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
Uncompress all the utility libraries.
$ tar zxvf SDL2_image-2.0.2.tar.gz
$ tar zxvf SDL2_mixer-2.0.2.tar.gz
$ tar zxvf SDL2_net-2.0.1.tar.gz
$ tar zxvf SDL2_ttf-2.0.14.tar.gz
Build the Image file loading library.
$ cd SDL2_image-2.0.2
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ cd ../
Build the Audio mixer library.
$ cd SDL2_mixer-2.0.2
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ cd ../
Build the Networking library.
$ cd SDL2_net-2.0.1
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ cd ../
Build the Truetype font library.
$ cd SDL2_ttf-2.0.14
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ cd ../
Optionally, you can remove your development folder if not compiling or installing anything else.
$ rm -rf ~/development
$ sudo nano /etc/dphys-swapfile
- Change
CONF_SWAPSIZE=100
toCONF_SWAPSIZE=2048
. - Save and reboot.
$ cd development
$ wget -O - https://github.com/mamedev/mame/releases/download/mame0203/mame0203s.zip > mame0203s.zip && unzip mame0203s.zip - d ~/
$ cd ~/
$ make -j5
$ sudo nano /etc/dphys-swapfile
- Change
CONF_SWAPSIZE=2048
back toCONF_SWAPSIZE=100
. - Save and exit.
Precompiled mame at choccyhobnob. Check and substitute address accordingly for the latest package. You can use wget directly on the pi, or download on your mac and use scp to copy to your pi.
$ cd development
$ wget -O - https://choccyhobnob.com/?d=1964 > mame0203b_rPi.zip && unzip mame0203b_rPi.zip -d ~/
$ cd ~/
$ mv mame0203b_rpi mame0203b
To generate config, run $ ./mame -cc
.
To run a game, run $ ./mame romname
.
$ cd development
$ wget https://github.com/amadvance/advancemame/releases/download/v3.9/advancemame_3.9-1_armhf.deb
$ sudo apt install ~/development/advancemame_3.9-1_armhf.deb
You can now run the command $ advmame
to create configuration files, placed in the ~/.advance
directory. Binary is located in /usr/local/bin
.
To run a game, run $ advmame romname
.
$ cd ~/development
$ wget -O - https://github.com/mickelson/sfml-pi/archive/master.zip > sfml-pi-master.zip && unzip sfml-pi-master.zip
$ cd sfml-pi-master/cmake
$ cmake .. -DSFML_RPI=1 -DEGL_INCLUDE_DIR=/opt/vc/include -DEGL_LIBRARY=/opt/vc/lib/libbrcmEGL.so -DGLES_INCLUDE_DIR=/opt/vc/include -DGLES_LIBRARY=/opt/vc/lib/libbrcmGLESv2.so
$ sudo ldconfig
$ cd ~/development
$ wget https://ffmpeg.org/releases/ffmpeg-4.1.tar.bz2
$ tar -xf ffmpeg-4.1.tar.bz2
$ cd ffmpeg-4.1
$ ./configure --enable-mmal --disable-debug --enable-shared
$ make
$ sudo make install
$ sudo ldconfig
$ cd ~/development
$ wget -O - https://github.com/mickelson/attract/archive/master.zip > attract-master.zip && unzip attract-master.zip
$ cd attract-master
$ make USE_GLES=1
$ sudo make install USE_GLES=1
To run attractmode, run $ attract
. Binary is located in /usr/local/bin
.
As suggested under config settings part of the guide, be sure you used $ sudo raspi-config
to set the following:
- 3 Boot Options -> B1 Desktop / CLI -> B2 Console Autologin
.bash_profile
of the user is executed to configure your shell before the initial command prompt. Our script will launch attract if the current user (pi) logs in and it is not an ssh connection.
$ cd ~
$ touch .bash_profile
$ chmod -x .bash_profile
$ nano .bash_profile
#!/bin/sh
# if SSH connection do nothing, else launch emulationstation
# (first construct checks that SSH_CONNECTION is set to something)
[ -n "${SSH_CONNECTION}" ] || /usr/local/bin/attract
You may replace the path to the attract binary with advmame (single rom instance?), or anything else you wish to have automatically loaded.
I am using an 8bitdo m30 controller. However, this should work similar for most other controllers.
- Enter bluetoothctl to open Bluetooth control.
- Put the remote into d-input mode by holding start + B until LED 1 blinks.
- Put the remote into pairable mode by holding the small pair button on the front of the remote for 2 seconds. LEDs will sequence.
- At the [bluetooth]# prompt enter the following commands:
[bluetooth]# discoverable on
[bluetooth]# pairable on
[bluetooth]# agent on
[bluetooth]# default-agent
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:27:EB:7B:89:3C Discovering: yes
[NEW] Device E4:17:D8:87:09:7D 8BitDo M30 gamepad
[bluetooth]# pair E4:17:D8:87:09:7D
[bluetooth]# trust E4:17:D8:87:09:7D
[bluetooth]# scan off
[bluetooth]# paired-devices
Device E4:17:D8:87:09:7D 8BitDo M30 gamepad
[bluetooth]#quit