Creating your own custom image for Raspberry Pi


To facilitate a cross-compile environment for Raspberry Pi images, I created an image builder project: build-raspbian-image on GitHub.

This project is based on a blog post and code by Klaus Maria Pfeiffer.

The code functions correctly on Debian (tested with CrunchBangLinux) and Ubuntu.

Instructions:

  1. Clone the repository: git clone https://github.com/andrius/build-raspbian-image.git
  2. Navigate into the cloned directory. Review the content and install necessary packages, or execute the ./install.sh script.
  3. Run ./raspbian/build_raspbian_sd_card.sh. The resulting .img file will be located in the /tmp/rpi folder.

The main challenge currently lies with the cross-compilation environment. Due to time constraints, the process is not fully automated. During cross-compilation, manual intervention is required:

echo "Execute all necessary commands, then type exit"
echo "Asterisk install files are located at /usr/src/asterisk"
bash

Update

The GitHub repository has been updated. The installation script now mounts a delivery folder to the target RPI image and executes an install.sh script located within that mounted folder. This allows for custom build scripts or manual command-line access via bash during RPI image creation.

An example image created with this process, featuring Ruby 2.0 and Asterisk PBX, is available.

Download link for the latest TinyPBX image: j.mp/tinypbx.

Standard Raspberry Pi flashing instructions apply (a good guide can be found at this site describing the flashing procedure):

  • Decompress the .gz file.
  • Insert the SD card.
  • Flash the image using the Linux dd command.