From 8b46e0d84b20320d52b5e3326cce7e7d92cc2d96 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Tue, 5 Jan 2016 02:33:39 -0800 Subject: [PATCH] working on v2 --- README.md | 33 +++++++++++++++++++++++++- setup.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 98 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index aa6e165..a178df3 100644 --- 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 +``` diff --git a/setup.sh b/setup.sh index 0064a0c..3ee815c 100755 --- 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 </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 -- 2.27.0