How to create an image (.img) with pi_gen / rpi_gen? (like Hassbian)

How can I create my own image file for my current configuration using pi_gen / rpi_gen?

Before messing around with the installation I want to create an image of the current state, just like HA RPI Image.

I ran pi_gen but it didn’t create an .img file.

This is what I did:

Set up Raspian Jessie Lite and HA using the all-in-one-installer

  1. wrote Raspian Jessie Lite to a SD card (2016-09-23-raspbian-jessie-lite.img)
  2. logged in to the pi: ssh [email protected]
  3. sudo raspi-config: expand filesystem; update the raspi-config
  4. Used the command for the All-In-One-Installer: wget -Nnv https://raw.githubusercontent.com/home-assistant/fabric-home-assistant/master/hass_rpi_installer.sh && bash hass_rpi_installer.sh

pi_gen: try to create the image (which did not work)

  1. Install git: sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install git
  2. clone pi_gen: git clone https://github.com/home-assistant/pi-gen
  3. change directory: cd pi-gen/
  4. add a name for the image: touch config; pico config; IMG_NAME='Raspian', save and quit
  5. install all dependencies: sudo apt-get install quilt kpartx realpath qemu-user-static debootstrap zerofree pxz zip
  6. try to build the image: sudo ./build.sh
  7. wait 70 minutes

According to the instructions the image should be saved in “rpi_gen\deploy”. However, this directory does not exist.

1 Like