Git Product home page Git Product logo

makepi's Introduction

makepi

Overview

This is a shell script that creates an sd card image for the Raspberry Pi. The image is based on raspbian/jessie, making use of debootstrap and qemu.

The code is based on this tutorial (in German): http://raspberry.tips/raspberrypi-tutorials/eigenes-raspbian-image-fuer-den-raspberry-pi-erstellen/ but no interaction is required. I also updated it to use jessie instead of wheezy, aded code to customize the image further, and added a firstboot script to automatically resize the root partition (based on Hypriot with minor changes).

The current code in the master branch will build an image a wireless router that should work out of the box when installed in a Raspberry Pi3. It will start an access point and dhcp server and use ethernet for internet access.

If you check out the pypiwifi branch it will add a web interface to control the access point. You will need to clone https://github.com/oliverkurth/pypiwifi as well.

Requirements

This has been tested in a Ubuntu 15.10 VM. It will most likely work on any recent Debian or Ubuntu system. The following packages need to be installed:

  • qemu-user-static
  • kpartx
  • debootstrap

You also need to clone the repository https://github.com/raspberrypi/firmware.git. The script expects this to be in your home directory.

How to use

cd makepi sudo ./makepi.sh

That's all.

When you rerun this often, I recommend to use a proxy for the packages that will be installed. I use apt-cacher-ng.

Hacking

To make multiple iterations more efficient, the script makes backups after time (and bandwidth) consuming stages.

In the first stage, the script uses qemu-debootstrap to create a root file system. Since this rarely changes, this is backed up as chroot-raspbian-armhf.tgz. In a subsequent run, this stage will be skipped if the backup exists, and instead the tarball will just be unpacked.

In the second stage, the root file system is cutomized, using 3 scripts:

  • pre-customize.sh
  • customize.sh
  • post-custimize.sh

The pre/post scripts are optional and run outside the chroot environment. This makes it possible to copy files from other places. The script customize.sh runs in a chroot'ed environment. This makes it possible to execute programs as if the system is already alive, and for example run apt-get. However, it's not possible to access files from outside the root file system.

Before pre-customize.sh is run files will be copied from overlay. This is useful for preconfigured configuration files.

The customized filesystem will also be backed up as chroot-raspbian-armhf-customized.tgz. Remember that when you make changes in the customization to delete that file before unning makepi.sh again.

Finally, a raw image will be created and formated, mounted and the file system copied over. This can be copied to an sd card using dd.

makepi's People

Contributors

oliverkurth avatar sanbeiji avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

sanbeiji

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.