-
Notifications
You must be signed in to change notification settings - Fork 365
Setting up a working developer sdcard
Eric Westphal edited this page May 27, 2018
·
4 revisions
Here are some tips for setting up a sdcard with a nicer working environment for developers:
If your main working environment is Linux or OS X, image the sdcard as follows:
- Download the latest .img.zip file from https://github.com/cyoung/stratux/releases
- Unzip the file:
unzip XXX-dev.img.zip
. - Plug your sdcard into your computer.
-
lsblk
to see which device your sdcard mounted as; assume it's /dev/sdX. - Image the card with
sudo dd if=XXX-dev.img of=/dev/sdX bs=4M status=progress
- Optional: create separate partitions for /var and /root. This will keep you from freezing up your Pi if your logs get too large and is good practice for a dev system:
- use
fparted /dev/sdX
and add partitions 3 (2GB - /root) and 4 (the rest - /var) mkfs.ext4 /dev/sdX3
mkfs.ext4 /dev/sdX4
-
sudo mkdir /mnt/base /mnt/root /mnt/var
(use whatever mount point you like if /mnt is taken) sudo mount /dev/sdX2 /mnt/base
sudo mount /dev/sdX3 /mnt/root
sudo mount /dev/sdX4 /mnt/var
rsync -Pavz --remove-source-files /mnt/base/root /mnt/root
rm -rf /mnt/base/root/*
rsync -Pavz --remove-source-files /mnt/base/var /mnt/var
rm -rf /mnt/base/var/*
- modify fstab to mount
mmcblk0p3
to/root
andmmcblk0p4
to/var
(last number should be 2).
- use
- Add your ssh key:
cat ~/.ssh/id_rsa.pub | sudo tee -a /mnt/etc/ssh/authorized_keys/root
(assuming your public ssh key is ~/.ssh/id_rsa.pub). - (May not be necessary any more: If you like to have a wired ethernet connection:
vi /mnt/etc/network/interfaces
and insertallow-hotplug eth0
nearallow-hotplug wlan0
if it's not there already.) - Unmount the sdcard:
sudo umount /mnt
. Remove it from the computer, insert it in the Pi, and boot it up. - Now you should easily be able to ssh into the Pi over your wired lan.
- Sync up the Pi's time:
systemctl start ntp
(enable if always wired). - If you didn't create the
/root
and/var
partitions, expand the filesystem:raspi-config
and choose the option to expand the filesystem. When finished, reboot. - Verify that the filesystem is expanded or the other partitions are mounted with
df -h
. - Install Go from https://golang.org/dl/ (ARMv6 architecture). Use
wget
to download it and thentar -C /root -xzf go$VERSION.linux-armv6l.tar.gz
. If it's not already on your$PATH
then addexport PATH=$PATH:/root/go/bin
to/root/.bashrc
. - Install git and vim:
apt-get update && apt-get install -y git vim
. - Clone the stratux repository from GitHub:
mkdir /root/go_path/src/github.com/cyoung && cd /root/go_path/src/github.com/cyoung && git clone https://github.com/cyoung/stratux
. - Install WiringPi static libs:
cd && git clone https://github.com/WiringPi/WiringPi.git && cd WiringPi/wiringPi && make static && make install-static
(see https://github.com/WiringPi/WiringPi/INSTALL) - For faster builds:
go get github.com/mattn/go-sqlite3
Now you can easily git pull, modify, build. To build: cd ~/go_path/src/github.com/cyoung/stratux && make && make install
. If you only want to build the main stratux binary, gen_gdl90, just make xgen_gdl90 && make install
.
Happy coding!