hypriot / rpi-image-builder

**DEPRECATED** Build Raspberry Pi Raspbian images based on custom kernels
0 stars 0 forks source link

Build Status

rpi-image-builder

Build a SD card image for the Raspberry Pi 1 and 2.

Build inputs

Customization

The file settings/hypriot contains all major customization of the SD card image.

# configuration for all build scripts
KERNEL_DATETIME=${KERNEL_DATETIME:="20150326-083724"}
KERNEL_VERSION=${KERNEL_VERSION:="3.18.10"}

DOCKER_DEB=${DOCKER_DEB:="docker-hypriot_1.5.0-7_armhf.deb"}

SD_CARD_SIZE="1280"        # "1280" = 1.3 GB
BOOT_PARTITION_SIZE="64"   # "64" = 64 MB

Kernel deb packages

The five kernel deb packages are downloaded from S3 bucket s3://buildserver-production/kernel/<datetime> to local build_inputs/kernel/<datetime> directory.

Docker deb package

The docker deb package is downloaded from S3 bucket s3://buildserver-production/docker/deb/ to local build_inputs/docker/deb/ directory.

Build outputs

The final SD card image will be uploaded to S3 to s3://buildserver-production/images/hypriot-date-time.img.

Build with Vagrant

To build the SD card image locally with Vagrant, enter

vagrant up

Analyze the SD card image

In the vagrant box you can mount and unmount the SD card image with two helper scripts

vagrant ssh
/vagrant/scripts/mount-sd-image.sh /build_env/images/hypriot*.img

The two partitions are mounted to /mnt/pi-boot and mnt/pi-root where you can modify things. Afterwards unmount everything with

/vagrant/scripts/unmount-sd-image.sh /build_env/images/hypriot*.img

Your changes are written into the SD card image file.

Build with Drone

Add this GitHub repo to the Drone CI server. Then customize the project settings as follows.

Enable Privileged mode

You have to enable privileged mode, because the image builder needs access to mount loop devices.

Private Variables

The following variables have to be defined in the GUI of the Drone Buildserver.

For uploading the build results to Amazon S3 we need the following Amazon S3 credentials.

Problems with loop devices

If you encounter error messages related to loop devices it is most probably a problem with loop devices which haven not been released during the image building process.

To fix this manually use the following command on the build host:

for loop_device in $(losetup -a | awk '{print $1};' | sed "s/:$//"); do losetup -d $loop_device; done