Setup
Host setup
macOS
brew install nanomsg --HEAD
brew install python3 rsync cmake
curl https://sh.rustup.rs -sSf | shVM setup
VirtualBox is the preferred virtualizer, although any other virtualizer that can provided shared folders and port forwarding will also work.
Debian 9 Stretch is the distro of choice.
-
Set up port forwarding
22 → 2222 (SSH forward)
SSH keys are recommended
-
Set up shared folders
→
Folder name: 9001d
→Path: <absolute path to 9001d> -
Enable symlinks in shared folders
VBoxManage setextradata <vm-name> VBoxInternal2/SharedFoldersEnableSymlinksCreate/<share-name> 1
Restart VirtualBox to apply this change.
-
Start VM
-
Insert guest additions CD
-
Install guest additions
# Dependencies sudo apt-get install curl build-essential module-assistant dkms pkg-config # Prepare system to build kernel modules sudo m-a prepare # Mount Guest additions CD and build sudo mount /dev/sr0 /mnt cd /mnt sudo ./VBoxLinuxAdditions.run # Allow current user to access shared folders sudo adduser "$USER" vboxsf # Reboot sudo reboot
-
Setup cross-compile environment
makecommands can now be issued on the host machine if port forwarding was set up properly,make setup
Cross-compiling
Use make build (on host) to generate foreign binaries and make transfer (on host) to copy them over to the target.
Environment Variables
TARGET_ADDRESS
Address of machine that the compiled binary should be deployed on.
Example:pigeon9001.localTARGET_BIN_LOCATION
Target location of the deployed binary.
Example:'~'TARGET_USER
Username on target system.
Example:philipVM_PORT
SSH port of cross-compile VM.
Example:2222VM_PROJECT_LOCATION
Shared project folder location.
Example:/media/sf_9001dVM_USER
Username on cross-compile VM.
Example:philipCONFIGURATION
Defaults todebug, set toreleasefor optimized builds.
Example:releaseTARGET
Defaults toarmv7, set toarmfor ARMv6 builds.
Example:arm
Run make env (on host) to generate a .envrc containing all required environment variables.
Use something like direnv to automatically run this file.