Tuesday, February 25, 2014

New image

(Note: old post, published late, reference only)

Right, well, as Acid-Py is coming along I need to get it running on it's own SD card. I've hacked around on my 'main' SD card and I'm concerned I don't know how to do this from the ground up and I'd rather keep Acid-Py related stuff on it's own card that auto loads Acid-Py up, that kind of thing.

Also I want to set up a backup card and image it, that kind of stuff, I've been backing up the source code with WinSCP, but I need an image backup especially as Acid-Py now has auto load and shutdown, I think it's implemented in a safe way, but I heard about SD cards getting corrupted accidentally so better safe than sorry.

So, documenting the steps from the ground up, for my reference, but others may find something useful :)

Base install

Download and install the Raspbian OS to a new SD card

Download 2014-01-07-wheezy-raspbian.zip from:
http://www.raspberrypi.org/downloads

Prep the SD card and install the image using this guide:
http://elinux.org/RPi_Easy_SD_Card_Setup

Config bits, part 1 (on the PC)

Headless setup, so plug into router and connect with putty:
Check/find out the IP address using IP scanner

My putty profile has a few things disabled to make curses/tty work, esp. with numeric pad
Disable application keypad mode
Disable remote-controlled terminal resizing
Disable remote-controlled window title changing
Deselect X11 forwarding

Config bits, part 2 (on the Pi)

Login and run 'sudo raspi-config':
Expand Filesystem
Do User Password stuff
Exit and 'reboot now'

Login and check filesystem has expanded and we've got an IP address:
df -h
ifconfig

Update the distribution:
sudo apt-get update
sudo apt-get upgrade

Update the firmware:
sudo rpi-update
sudo reboot

Acid-Py and dependent stuff

Acid-Py

Copy over the source code and sounds using WinSCP

Adafruit i2c 16x2 LCD Pi Plate

sudo /etc/modules and add:
i2c-bcm2708
i2c-dev
sudo reboot

Python

SMBUS Python modules needed to talk to LCD:
sudo apt-get install python-smbus

Auto Login

sudo nano /etc/inittab
comment out "1:2345:respawn:/sbin/getty --noclear 38400 tty1"
add "1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1"
(note: won't auto-login putty session but does for standalone mode)

Start-up script to launch Acid-Py

Create acid_py_prompt.sh:

#!/bin/bash
echo "Enter . to run Acid Py, anything else to exit"
read myinput
if [ "$myinput" = "." ]
then
        echo "Start Acid-Py"
        sudo python acid.py
fi
        echo "End."
exit 0

Set to executable:
chmod +x acid_py_prompt.sh

Run that script at start-up:
nano ~/.bashrc
add "cd AcidPy" and
add "./acid_py_prompt.sh" to the end

After testing, create a backup image:
win32diskimager
name your image file
be sure to select the right input device (your SD card)
press "read"

Useful Links

Adafruit LCD
http://learn.adafruit.com/adafruit-16x2-character-lcd-plus-keypad-for-raspberry-pi/usage

Future?

overclock in favour of CPU (headless)

No comments:

Post a Comment