-
Notifications
You must be signed in to change notification settings - Fork 297
Setting up a working developer sdcard
Eric Westphal edited this page May 28, 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.
-
lsblkto 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/sdXand add partitions 3 (2GB - /root) and 4 (the rest - /var) mkfs.ext4 /dev/sdX3mkfs.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/basesudo mount /dev/sdX3 /mnt/rootsudo mount /dev/sdX4 /mnt/varrsync -Pavz --remove-source-files /mnt/base/root /mnt/rootrm -rf /mnt/base/root/*rsync -Pavz --remove-source-files /mnt/base/var /mnt/varrm -rf /mnt/base/var/*- modify fstab to mount
mmcblk0p3to/rootandmmcblk0p4to/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/interfacesand insertallow-hotplug eth0nearallow-hotplug wlan0if 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
/rootand/varpartitions, expand the filesystem:raspi-configand 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
wgetto download it and thentar -C /root -xzf go$VERSION.linux-armv6l.tar.gz. If it's not already on your$PATHthen addexport PATH=$PATH:/root/go/binto/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 - (Not sure if this is the right way to do this, but works for now): This is required for making dump978 libraries. Add the following line to your
/root/.bashrc:export CGO_CFLAGS_ALLOW=-L/root/stratux.
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!