Tuesday 19 February 2013

Building New Pi Base Images

So what happens if I brick the rwspi SD card? I want to be able to get back to somewhere like where I was, and also to be able to help others get the the same place. So I set out to make a clean install with all the good stuff I've added to rwspi so far, and none of my mistakes or personal data. I got really vexed in the process, because I couldn't get the hardware to work the way it did the first time I set up. The wifi was not behaving. It looks like the upgraded firmware was somehow not working with the old Occidentalis distribution, which shouldn't be a surprise once you get to it. 

So I eventually followed these steps to make a clean image on a 4 GB SD. The wifi worked when it was done. The processing took several hours to complete processing, so I have saved the unpersonalized image as OcciGen130219.img and a personalized version as FreshPi130219.img with my networks and passwords in it. Part of the time was consumed by figuring out that the errors were a result of the Raspbian site being down this morning rather than anything I was doing.

Update: A different wifi adapter requires a reconfig from start, so I repeated the process to create blink130305.img that runs with the B-LINK all black USB wifi dongle.

Also created an OcciClean130304.img image with no wifi installed.

Started from 2013-02-09-wheezy-raspbian.img to create RaspiClean130323.img with all the services below, but no wifi, no wpa file edits. Had to run sudo apt-get install git-core before the firmware update would run properly. Initialized a new blink image from there and added wireless from config utility on desktop. Did the same for an rwspi image.

Feel free to step through the same process to build a copy. I'd share, but I don't have an easy way to share something that big without writing it to an SD.

# make the raw image on SD by running this on the mac (the rest is on the Pi)
# sudo dd bs=1m if=Occidentalis_v02.img of=/dev/rdisk2

# boot with net cable attached and use raspi-config to expand the file system
#      set the keyboard, timezone, enable ssh and desktop, then finish and reboot

# get the latest upgrades
sudo apt-get update
sudo apt-get upgrade

# get the latest firmware, then reboot (needs to be repeated for new Pis)
sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update
sudo chmod +x /usr/bin/rpi-update
sudo rpi-update

# use raspi-config to update raspi-config, then set GPU split to 32 MB and reboot


# install samba for file sharing on the network
sudo apt-get update
sudo apt-get install samba
sudo apt-get install samba-common-bin
# set password as 'raspberry'
sudo smbpasswd -a pi
sudo nano /etc/samba/smb.conf
#   Uncomment or change these lines in /etc/samba/smb.conf
#   security = user
#   socket options = TCP_NODELAY
#   [homes]
#   readonly = no
#   valid users = pi


# install the tightvncserver if not already there

sudo apt-get install tightvncserver

# install the apache web server -- it will occupy port 80
sudo apt-get install apache2 php5 libapache2-mod-php5
# mysql password set to 'raspberry'
sudo apt-get install mysql-server mysql-client php5-mysql
sudo service apache2 restart
sudo nano /etc/inittab
# comment out the ttyAMA0 line at the end of /etc/inittab
# T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
# make tty devices available to the web server to use serial port
sudo adduser www-data tty


# install the Adafruit WebIDE -- it will go on port 3000 since 80 is taken
curl https://raw.github.com/adafruit/Adafruit-WebIDE/alpha/scripts/install.sh | sudo sh

# install some python -- some of this may be redundant
sudo apt-get install python-dev
sudo apt-get install python-rpi.gpio
sudo apt-get install python-smbus
sudo apt-get install i2c-tools
sudo apt-get install python-pip
sudo pip install feedparser
sudo easy_install -U distribute
sudo pip install RPi.GPIO
sudo apt-get install python-serial



# get the latest upgrades just to check all up to date
sudo apt-get update
sudo apt-get upgrade

# shutdown and back to the mac to run
# sudo dd if=/dev/rdisk2 of=OcciGen130219.img bs=1m
# then create a new SD with 
sudo dd bs=1m if=OcciGen130219.img of=/dev/rdisk2

# then back to the Pi and personalize the installation as freshpi.local
# network files copied from rwspi to work with 165 Bagot networks
sudo smbpasswd -a pi
sudo nano /etc/network/interfaces
sudo nano /etc/wpa_supplicant.conf
sudo nano /etc/hostname
sudo nano /etc/hosts
#reboot to be freshpi
passwd 
sudo passwd mysql
tightvncserver :1


# all works, so shutdown and back to the mac to run
# sudo dd if=/dev/rdisk2 of=FreshPi130219.img bs=1m



No comments:

Post a Comment