Debian tool chain and image generation for Raspberry Pi 2 and 3.
Switch branches/tags
Clone or download

README.md

edi-pi

Debian tool chain and image generation for the Raspberry Pi 2 and 3.

Introduction

The edi configuration contained in this repository can be used to generate the following artifacts:

  • A pure Debian stretch arm64 (64bit) image suitable for the Raspberry Pi 3.
  • A pure Debian stretch armhf (32bit) image suitable for the Raspberry Pi 2 or 3.
  • An amd64/arm64 or amd64/armhf based LXD container with a pre-installed cross development toolchain for C and C++.
  • An emulated arm64 or armhf LXD container.

Important Note

edi-pi is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

edi-pi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Please note that image generation operations require superuser privileges and therefore you can easily break your host operating system. Therefore make sure that you have a backup copy of your data.

Acknowledgement

edi-pi would not be possible without the fantastic Raspberry Pi community. Special thanks go to the people behind those two projects:

Basic Usage

Preparation

Prior to using edi-pi you have to install edi according to this instructions. Please take a careful look at the "Setting up ssh Keys" section since you will need a proper ssh key setup in order to access the container or the Rasperry Pi using ssh.

The image post processing commands require some additional tools. On Ubuntu 16.04 those tools can be installed as follows:

sudo apt install e2fsprogs dosfstools bmap-tools

Creating a Raspberry Pi Image

A Raspberry Pi image can be created using the following command:

For Raspberry Pi 3, arm64:

sudo edi -v image create pi3-stretch-arm64.yml

For Raspberry Pi 2 or 3, armhf:

sudo edi -v image create pi23-stretch-armhf.yml

The resulting image can be copied to a SD card (here /dev/mmcblk0) using the following command (Please note that everything on the SD card will be erased!):

For Raspberry Pi 3, arm64:

sudo bmaptool copy artifacts/pi3-stretch-arm64.img /dev/mmcblk0

For Raspberry Pi 2 or 3, armhf:

sudo bmaptool copy artifacts/pi23-stretch-armhf.img /dev/mmcblk0

If the command fails, unmount the flash card and repeat the above command.

Once you have booted the Raspberry Pi using this SD card you can access it using ssh (the access should be granted thanks to to your ssh keys):

ssh pi@IP_ADDRESS

The password for the user pi is raspberry (just in case you want to execute a command using sudo or login via a local terminal).

Creating a Cross Development LXD Container

A cross development container can be created using the following command:

For the Raspberry Pi 3, amd64/arm64:

sudo edi -v lxc configure edi-pi-cross-dev pi3-stretch-arm64-cross-dev.yml

For the Raspberry Pi 2 or 3, amd64/armhf:

sudo edi -v lxc configure edi-pi-cross-dev pi23-stretch-armhf-cross-dev.yml

The container can be accessed as follows (the password is ChangeMe!):

lxc exec edi-pi-cross-dev -- login ${USER}

You can directly start to cross compile applications:

For the Raspberry Pi 3, arm64:

aarch64-linux-gnu-g++ ...

For the Raspberry Pi 2 or 3, armhf:

arm-linux-gnueabihf-g++

For your convenience, the LXD container shares the folder edi-workspace with the host operating system.

Creating an Emulated Development LXD Container

The following command generates an emulated container:

For the Raspberry Pi 3, arm64:

sudo edi -v lxc configure edi-pi-dev pi3-stretch-arm64-dev.yml

For the Raspberry Pi 2 or 3, armhf:

sudo edi -v lxc configure edi-pi-dev pi23-stretch-armhf-dev.yml

As above, you can access the container as follows (the password is ChangeMe!):

lxc exec edi-pi-dev -- login ${USER}

More Information

For more information please read the edi documentation and this blog post.