Base Raspberry Debian - jalopezsuarez/piback GitHub Wiki

Rasbperry Debian (Miniban-Jessy)

Build SDCard image system using MacOS.

diskutil list
diskutil umountDisk /dev/disk2
sudo dd bs=1m if=2016-05-27-raspbian-jessie-lite.img of=/dev/disk2
Clone SDCard Raspberry System

This will give you a list of the disks and volumes inside or connected to your computer. The Pi SD card will contain a Linux partition under TYPE NAME:

diskutil list

Now you’re ready to duplicate the SD card, saving it as a disk image file on your hard drive:

sudo dd if=/dev/rdisk1 of=~/Desktop/arcade.img bs=1m
Flashing / Recovery with GZIP

You can compress it afterwards by right-clicking and selecting Compress “pi.img”, but it’s more efficient to compress the file as you go. To do this, you use the Unix ‘pipe’ symbol, | , to route the output of dd not to a file but to the gzip utility:

sudo dd if=/dev/rdisk1 bs=1m | gzip > ~/Desktop/pi.gz

Re-flashing the SD card then becomes:

gzip -dc ~/Desktop/arcade.gz | sudo dd of=/dev/rdisk1 bs=1m

Rasbperry Setup

Rasbperry first login User/Password

User: pi
Password: raspberry
sudo su

Raspberry Pi Software Configuration Tool

sudo apt-get update
sudo raspi-config

Expand Filesystem

Ensures that all of the SD card storage is available to the OS. File system was expanded automatically during installation.

raspi-config :: 1 Expand Filesystem

SSH Remote Server

Enable/disable remote command line access to your Pi using SSH. Enter sudo raspi-config in the terminal, then navigate to ssh, hit Enter and select Enable or disable ssh server.

raspi-config :: 8 Advanzed Options :: A4 SSH

Console Autologin

Autologin system to boot directly

raspi-config :: 3 Boot Options :: B2 Console Autologin (pi user)

Vim Editor (Fix Arrowkeys)

echo "set nocompatible" > ~/.vimrc
echo "set backspace=indent,eol,start" >> ~/.vimrc

Change System Locale

Edit .bashrc, a shell script that Bash runs whenever it is started interactively.

vi ~/.bashrc

You can put any command in that file that you could type at the startup.

LC_ALL="C"
export LC_ALL

WIFI

Open the wpa-supplicant configuration file in nano:

sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

Go to the bottom of the file and add the following:

network={
    ssid="The_ESSID_from_earlier"
    psk="Your_wifi_password"
}

Some Protection System Raspberry SDCard

Ensure you always mount the vfat boot partition RO by setting those options in /etc/fstab:

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults,ro,sync,flush          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

Should you ever need an update of the boot then simply remount that partition rw first with the command below and reboot.

root@raspberrypi:/home/pi# mount | grep /dev/mmc
/dev/mmcblk0p2 on / type ext4 (rw,noatime,data=ordered)
/dev/mmcblk0p1 on /boot type vfat (ro,relatime,sync,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,flush,errors=remount-ro)

Hostname

Change default hostname from raspberrypi to arcade to identify on network.

sudo vi /etc/hostname
arcade
sudo vi /etc/hosts
127.0.1.1       arcade

SAMBA

Share ROMS Directory as Network Shared Folder using Windows SMB standard. Install Samba Raspberry Pi (Debian Jessie / Raspberry Pi3):

sudo apt-get install -y samba samba-common-bin

Look at /etc/samba/smb.conf

sudo vi /etc/samba/smb.conf

Modify Samba configuration adding this options to default settings:

netbios name = arcade
workgroup = WORKGROUP
wins support = yes
usershare allow guests = no

Enable write to rooms directories on share directories:

[roms]
comment=roms
path=/arcade/roms
browseable=yes
writeable=yes
create mask=0775
directory mask=0775
only guest=no

Set samba password for the default pi user (usually use default pi password on system/ssh raspberry):

sudo smbpasswd -a pi

Enable permissions to folder:

pi@terminal:/arcade $ sudo chown pi:pi -R roms

Other Setups

ExtFat support

 apt-get install -y exfat-fuse

Manage Disk on System

df -h
fdisk -l
mount /dev/sda1 /media

Rename files to lowercase

find . -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;

Unrar Descrompressor

Getting rar and unrar working on Raspbian.

mkdir /arcade/unrar
cd /arcade/unrar

Download and unpack:

wget http://www.rarlab.com/rar/unrarsrc-4.2.4.tar.gz
gunzip -v unrarsrc-4.2.4.tar.gz 
tar -xvf unrarsrc-4.2.4.tar

Compile

cd /arcade/unrar/unrar
make -f makefile.unix

Install

sudo cp unrar /usr/local/bin

Setup the Internet clock sync

I think this one is not needed because on new Raspbian version, the ntp daemon already do the job, but just in case:

apt-get install ntp

Configure your time zone, with rasps-config tool. then go to menu Internationalisation Options then Change Timezone and select your time zone.

raspi-config

System Platform Directory

Create arcade base directory, all the apps and routes will be in this base working directory.

mkdir /arcade

Debian Essentials Dependences

All dependences needed to build sucessufuly the applications from source.

apt-get install -y build-essential

Basic Building Tools

apt-get install -y make automake cmake git subversion checkinstall unzip

Advanced Library Dependences

apt-get install -y libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc
apt-get install -y libesd0-dev libflac-dev libfluidsynth-dev libfreetype6 libfreetype6-dev libjpeg-dev libmikmod2-dev libmodplug-dev libogg-dev libpng12-dev libtiff5-dev libvorbis-dev libvorbisidec-dev libwebp-dev
apt-get install -y libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-system-dev
apt-get install -y libcurl4-openssl-dev libdbus-1-dev libeigen3-dev libfreeimage-dev libphysfs1 libudev-dev libvpx-dev libzip-dev 
apt-get install -y freepats libasound2 libasound2-dev libsndfile1-dev timidity

Graphic Libraries (MESA)

Install mesa egl includes (EGL, GLES, GLESv2 and KHR).

apt-get install -y libgegl-dev libegl1-mesa libegl1-mesa-dev 
apt-get install -y libgles1-mesa libgles1-mesa-dev libgles2-mesa libgles2-mesa-dev

SDL 1.2 Library

apt-get install -y libsdl1.2-dev libsdl-image1.2 libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl-net1.2 libsdl-net1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev

Update Libraries System References

After install all dependences libraries its recommended purge system:

apt-get -y autoremove --purge
ldconfig