working on v2
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 5 Jan 2016 10:33:39 +0000 (02:33 -0800)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 5 Jan 2016 10:33:39 +0000 (02:33 -0800)
README.md
setup.sh

index aa6e165efa9295aabd7a398c6f26edc818db98cb..a178df303707161f7c1317dd34c796e913151589 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,6 +4,13 @@ These instructions are for a Debian *testing* development system targeting the R
 
 ## Download & install the base RPi system
 
+```
+https://downloads.raspberrypi.org/raspbian/images/raspbian-2015-09-28/2015-09-24-raspbian-jessie.zip
+unzip 2015-09-24-raspbian-jessie.zip
+```
+
+or
+
 ```
 wget https://downloads.raspberrypi.org/raspbian/images/raspbian-2015-05-07/2015-05-05-raspbian-wheezy.zip
 unzip 2015-05-05-raspbian-wheezy.zip
@@ -48,7 +55,7 @@ This will take some time and will end by rebooting the RPi.  After this script h
 ssh bbmc@bbctrl.local
 ```
 
-## Install the toolchain
+## Install the RPi toolchain
 On the development system (i.e. not on the RPi):
 
 ```
@@ -89,3 +96,27 @@ ssh bbmc@bbctrl.local
 ```
 
 You should see the output ``Hello World!``.
+
+## Install the AVR toolchain
+Install the following tools for programming the AVR:
+
+```
+sudo apt-get install -y avrdude gcc-avr
+```
+
+## Connect to TinyG
+
+From RPi terminal
+
+```
+minicom -b 115200 -o -D /dev/ttyAMA0
+```
+
+You should see a prompt.
+
+
+## Program TinyG
+
+```
+avrdude -c avrispmkII -p ATxmega128A3U -P usb -U flash:w:tinyg.hex:i
+```
index 0064a0c6ffdb0b72f3f0f375aa8fab61d9c46f77..3ee815c5889874a5736d4eb9b474fca50feb8645 100755 (executable)
--- a/setup.sh
+++ b/setup.sh
@@ -1,20 +1,81 @@
 #!/bin/bash
 
+ID=2
+
 # Update the system
 apt-get update
 apt-get dist-upgrade -y
 
-# Install the auto discovery daemon
-apt-get install -y avahi-daemon
+# Resize FS
+# TODO no /dev/root in Jessie
+ROOT_PART=$(readlink /dev/root)
+PART_NUM=${ROOT_PART#mmcblk0p}
+
+if [ "$PART_NUM" != "$ROOT_PART" ]; then
+    # Get the starting offset of the root partition
+    PART_START=$(
+        parted /dev/mmcblk0 -ms unit s p | grep "^${PART_NUM}" | cut -f 2 -d:)
+    [ "$PART_START" ] &&
+
+    fdisk /dev/mmcblk0 <<EOF &&
+p
+d
+$PART_NUM
+n
+p
+$PART_NUM
+$PART_START
+p
+w
+EOF
+
+  # Now set up an init.d script to do the resize
+    cat <<\EOF >/etc/init.d/resize2fs_once &&
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          resize2fs_once
+# Required-Start:
+# Required-Stop:
+# Default-Start: 2 3 4 5 S
+# Default-Stop:
+# Short-Description: Resize the root filesystem to fill partition
+# Description:
+### END INIT INFO
+. /lib/lsb/init-functions
+case "$1" in
+  start)
+    log_daemon_msg "Starting resize2fs_once" &&
+    resize2fs /dev/root &&
+    rm /etc/init.d/resize2fs_once &&
+    update-rc.d resize2fs_once remove &&
+    log_end_msg $?
+    ;;
+  *)
+    echo "Usage: $0 start" >&2
+    exit 3
+    ;;
+esac
+EOF
+
+    chmod +x /etc/init.d/resize2fs_once &&
+    update-rc.d resize2fs_once defaults
+fi
+
+# Install auto discovery daemon
+apt-get install -y avahi-daemon avrdude minicom
 
 # Clean
 apt-get autoclean
 
-# Change the hostname
-sed -i 's/raspberrypi/bbctrl/' /etc/hosts /etc/hostname
+# Change hostname
+sed -i "s/raspberrypi/bbctrl$ID/" /etc/hosts /etc/hostname
 
-# Create bb user
+# Create user
 useradd -m -p $(openssl passwd -1 buildbotics) -s /bin/bash bbmc
 echo "bbmc ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
 
+# Disable console on serial port
+#sed -i 's/^\(.*ttyAMA0.*\)$/# \1/' /etc/inittab
+sed -i 's/console=ttyAMA0,115200 //' /boot/cmdline.txt
+
 reboot