Giter Club home page Giter Club logo

custompize's Introduction

customPIze

A minimal customizer for your Raspberry Pi images.

Main features:

  • simple to use
  • inspired by pi-gen run scripts
  • input raw image OR zip file containing image
  • shrink image again after modification (currently broken)

It should work with any linux distribution that ships a two partition (FAT + linux) disk image for Raspberry Pis. So far, it has only been tested with the official Raspbian images. The focus was on quickly building pre-configured minimal raspbian lite flavors.

Installation

Just build the docker image:

./build.sh

Usage

First a base image is needed for modification. A good starting point is the latest raspbian-lite:

wget https://downloads.raspberrypi.org/raspbian_lite_latest

Then a Pifile is needed as a blueprint for all the modifications that need to be performed.

Creating a Pifile

A Pifile is a simple bash script for the modifications to be done to the provided input image. There are two special helper functions:

  • increase <number_of_megabytes> resizes the main linux partition
  • on_chroot executes commands on the mounted system
  • ${ROOTFS_DIR} contains the mount path of the image

An example Pifile is provided under example/:

#!/bin/bash

increase 200
 
install -v -m 755 /data/test.sh		"${ROOTFS_DIR}/usr/bin/"

echo "!! Activating ssh"
touch "${ROOTFS_DIR}/boot/ssh"

on_chroot <<EOF
ifconfig
echo "on chroot"
/usr/bin/test.sh
apt-get update
apt-get -y dist-upgrade

echo "!! Changing password"
(echo "strawberry"; echo "strawberry") | passwd pi

echo "!! Changing hostname"
raspi-config nonint do_hostname bushbox

echo "!! Activating serial console"
raspi-config nonint do_serial 0
EOF

Building a new image

The creation of an image itself can be easily done using the custompize helper script. It needs at least a Pifile, an input image and the desired output filename as parameters. Furthermore, an optional data directory can be supplied. This can contain additional scripts and data that should be made available to the build system.

Building a custom distribution using the above example Pifile and the script from example/data/:

./custompize example/Pifile ~/Downloads/pi/raspbian_lite_latest.zip /tmp/my_raspbian.img example/data

Links

custompize's People

Watchers

Lars Baumgärtner avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.