Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 3.1 KB

README.md

File metadata and controls

68 lines (48 loc) · 3.1 KB

Packer-RaspberryPi

Untended system preparation using Packer and Qemu

A pre-configured .img and .raw system image of a raspbian system (debian for raspberry pi forkor a tpibunti - self-made version of ubuntu) created using an automatic packer builder software solution.

Requirements

Technical

The software uses an virtualization/emulation interpreter, which requires a real machine or a virtualbox/vmware machine with graphical desktop. Command line dockerized systems won't work for computations.

Software

  • qemu - QuickEmulat- vagrant - ion software that support various processor architectures, including the ARM on which the RPI (Raspberry PI) is build - http://wiki.qemu.org/Main_Page
  • alsa-utils - A Linux library for sound drivers which are required for the RPI, as diodes and buzzers are the low-level debug elements
  • xorg-dev - Development pack or Xorg graphic, allows to launc the emulator in the SDL (Simple DirectMedia Layer - https://www.libsdl.org/)
  • packer - Autonomous software for building system images - https://www.packer.io/intro
  • kernel - A micro linux kernel which serves the Qemu as the acceleration device. It is preconfigured and added to the stash. Tinkering with it is not advised.
  • initrd - Initial RAM Dump that is read into the emulated system.

Usage

The solutions was created with both automatic and manual purpose in mind, therefore it is possible to launch it locally, without downloading the base image. This is possible due to a flexible command line parameters:

	"variables": {
                    "password_acc": "hybris",
                    "sum_local": "temporary",
                    "url_local": "temporary",
                    "user_acc": "hybris",
                    "display" : "none",
                    "kernel" : "kernelfile",
                    "initrd": "initrdfile"
                }

Access to the parameters is possible due the variableFileBuilder script which creates the variables.json file used to read the attribtues

	./variableFileBuilder.sh /path/to/Image /path/to/kernel /path/to/initrd display
	packer build -var-file=variables.json Buildfile.json

Variables generation

The most important variables (system image location, system image checksum, kernel location) are generated by the variableFileBuilder script, which takes the information : image, kernel and creates a json file with the needed data. The script outputs the json file accordingly:

	cat << EOF > variables.json
	{
		"url_local": "$image",
		"sum_local": "$sum",
		"kernel": "$kernel",
		"display": "$display",
		"initrd": "$initrd"
	}
	EOF

Jenkins integration

The solutions is used within an Jenkins integration server (https://jenkins-ci.org/) which build downloads the original, clean raspbian image, then opens it using the qemu, tinkers applying the scripts from the scripts folder as well as substitutes files from the files directory. After this is done the changes are saved to the downloaded image (.img file) as well as a backup is created (.raw file). Both are valid for use as virtual systems as well as installation on real hardware.