GithubHelp home page GithubHelp logo

jedahan / pi-maker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lantern-works/pi-maker

0.0 1.0 0.0 59 KB

Use Docker to build images for Raspberry Pi

License: GNU Affero General Public License v3.0

Shell 89.49% Makefile 10.51%

pi-maker's Introduction

pi-maker

Getting Started

make && make run

<<<<<<< HEAD A new disk image for Raspberry Pi will appear inside the build folder. This solution has been tested with Raspberry Pi Zero W and may work for other models, too.

A new disk image for Raspberry Pi will appear inside this project folder within "share/build". This solution has been tested with Raspberry Pi Zero W and may work for other models, too.

b3ba0b76e54c8fa72c10aa6f6a56319b3a7794ad

Next: Flash With Desktop App

Download Etcher

Open the desktop application and follow the prompts to select the disk image and the desired SD Card to use.

Or: Flash With Command Line

Install Etcher CLI

Run the commands below and the terminal will prompt you to select the desired drive to install to. Please be careful to select the proper SD Card and not another disk to avoid unwanted data loss.

make && make run
make flash

Requirements

A local Docker environment is required in order to build an image.

Customization

<<<<<<< HEAD The docker entrypoint runs whatever CMD you pass it to as root from within the emulated pi container.

For example, from the makefile run entry:

docker run -it --privileged \
  --volume ${PWD}/share:/share \ # mount the share folder
  --volume ${PWD}/build:/build \ # mount the build folder
  pi-maker:latest /setup # run the /setup script that was in /share

The easiest way to customize the image build process, is to put whatever files you want in share/ and edit share/setup to run whatever scripts you want.

Remember the scripts will run as root so if you want to do something as the pi user, prefix it with sudo -u pi dothething.

The docker entrypoint mainly does two things:

  1. copies all files from share/copy-this to the root filesystem
  2. runs share/setup (as root) * ...which runs share/my-scripts/test-script by default

The easiest way to customize the image build process, is to put scripts in share/my-scripts, and edit share/setup to run whatever scripts you want. Remember the scripts will run as root so if you want to do something as the pi user, prefix it with sudo -u pi dothething.

b3ba0b76e54c8fa72c10aa6f6a56319b3a7794ad

Customizing the base OS

By exporting OS_IMAGE, and/or OS_URI you can use a different operating system, like so:

# Creating a raspbian image requires merging the boot partition into the root tar
<<<<<<< HEAD
pushd build
=======
pushd share/build
>>>>>>> b3ba0b76e54c8fa72c10aa6f6a56319b3a7794ad
export LATEST_BUILD='2018-11-15-21:03'
wget http://vx2-downloads.raspberrypi.org/raspbian_lite/archive/${LATEST_BUILD}/boot.tar.xz
wget http://vx2-downloads.raspberrypi.org/raspbian_lite/archive/${LATEST_BUILD}/root.tar.xz
unxz root.tar.xz
mkdir -p boot && tar -xf boot.tar.xz -C boot && sudo chown -R 0 boot && sudo chgrp -R 0 boot
tar -rf root.tar boot && sudo rm -rf boot
export IMAGE_SIZE=4G
export OS_IMAGE=root.tar
popd
make run

Reference

pi-maker's People

Contributors

westlane avatar

Watchers

 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.