Skip to content
/ pi-oven Public

Automated provisioning of RaspberryPi disk images

Notifications You must be signed in to change notification settings

keichi/pi-oven

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pi-oven

Code Climate

Customize RaspberryPi disk images on x86_64

Prerequisites

  • Ubuntu 20.04
  • Statically linked QEMU user mode emulator for armhf/aarch64
  • Binfmt configuration for armhf/aarch64
  • parted and kpartx

Installation

Install dependencies

$ sudo apt install -y qemu-user-static binfmt-support parted kpartx

Install pi-oven

$ curl -O https://raw.githubusercontent.com/keichi/pi-oven/master/oven
$ sudo install oven /usr/bin

Usage

Oven is a simple yet flexible tool for customizing RaspberryPi disk images to match your needs.

$ sudo oven [options] src [dst]

By default, oven modifies and overwrites the disk image at src. If dst is specified, src is first copied to dst and then modified. Note that oven requires root privilege because it internally uses loop mounts and chroot.

Available options are:

  • -r, --resize SIZE: Resize the root file system before provisioning
  • -s, --script PATH: Path to a shell script for customization
  • -i, --interactive: Start an interactive shell for customization
  • --bootpart [1-4]: Partition number of the boot partition (default=1)
  • --rootpart [1-4]: Partition number of the root partition (default=2)
  • -v, --version: Print version information
  • -h, --help: Show usage

Examples

The following command will:

  1. Use ./raspbian-jessie-lite.img as a base image.
  2. Resize the image to 2000 MB.
  3. Customize the image by running ./foo.sh.
  4. Save the resulting image to ./foo.img.
$ sudo oven -r 2000 -s ./foo.sh ./raspbian-jessie-lite.img ./foo.img

Troubleshooting

  • If DNS resolution fails, check if /etc/resolv.conf exists within the disk image and contains a valid configuration.
    nameserver 8.8.8.8
    
  • If kernel update fails on a Ubuntu image with the following error:
    Failed to create symlink to vmlinuz-5.4.0-1038-raspi: Operation not permitted at /usr/bin/linux-update-symlinks line 64.
    
    It's likely because of this bug in Ubuntu. Adding the following lines to /etc/kernel-img.conf should fix the issue.
    do_symlinks = No
    no_symlinks = Yes
    
  • If you encounter the error "no space left on device" when installing packages, resize the disk image using the -r option.

About

Automated provisioning of RaspberryPi disk images

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages