diff --git a/scripts/images/rpi-hypriot/.dockerignore b/scripts/images/rpi-hypriot/.dockerignore new file mode 100644 index 00000000..1521c8b7 --- /dev/null +++ b/scripts/images/rpi-hypriot/.dockerignore @@ -0,0 +1 @@ +dist diff --git a/scripts/images/rpi-hypriot/Dockerfile.dapper b/scripts/images/rpi-hypriot/Dockerfile.dapper new file mode 100644 index 00000000..3ce7b67a --- /dev/null +++ b/scripts/images/rpi-hypriot/Dockerfile.dapper @@ -0,0 +1,15 @@ +FROM debian:jessie +ENV DAPPER_RUN_ARGS --device /dev/kvm +ENV DAPPER_OUTPUT dist +RUN apt-get update -y +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + libguestfs-tools curl zip linux-image-amd64 unzip +RUN mkdir -p /source/assets + +RUN curl -fL http://downloads.hypriot.com/hypriot-rpi-20151115-132854.img.zip > /source/assets/hypriot.img.zip +RUN cd /source/assets && \ + unzip hypriot.img.zip +RUN curl -fL https://releases.rancher.com/os/latest/rootfs_arm.tar.gz > /source/assets/rootfs_arm.tar.gz + +WORKDIR /source +CMD ["./scripts/build.sh"] diff --git a/scripts/images/rpi-hypriot/README.md b/scripts/images/rpi-hypriot/README.md new file mode 100644 index 00000000..1c6a1285 --- /dev/null +++ b/scripts/images/rpi-hypriot/README.md @@ -0,0 +1,9 @@ +RaspberryPi 2 Image +=================== + +Build by running `dapper` in this folder and the build will produce `./dist/rancheros-rpi2.zip`. + +KVM +=== + +This build requires a host capable of KVM. If you don't have KVM then remove `ENV DAPPER_RUN_ARGS --device /dev/kvm` from `Dockerfile.dapper`, but it will run very slow. diff --git a/scripts/images/rpi-hypriot/scripts/build.sh b/scripts/images/rpi-hypriot/scripts/build.sh new file mode 100755 index 00000000..401c4d2a --- /dev/null +++ b/scripts/images/rpi-hypriot/scripts/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e -x + +BOOT_DEVICE=/dev/sda1 +DEVICE=/dev/sda2 + +cd $(dirname $0)/.. + +mkdir -p dist build + +cp assets/hypriot*.img build/run.img +guestfish --progress-bars --verbose -a build/run.img run \ + : mount $DEVICE / \ + : tar-out /lib/modules modules.tar \ + : tar-out /lib/firmware firmware.tar \ + : umount / \ + : zero-device $DEVICE \ + : mkfs ext4 $DEVICE \ + : mount $DEVICE / \ + : mkdir-p /lib/modules \ + : mkdir-p /lib/firmware \ + : set-verbose false \ + : echo tar-in modules.tar /lib/modules \ + : tar-in modules.tar /lib/modules \ + : echo tar-in firmware.tar /lib/firmware \ + : tar-in firmware.tar /lib/firmware \ + : echo tgz-in assets/rootfs_arm.tar.gz / \ + : tgz-in assets/rootfs_arm.tar.gz / \ + : set-verbose true \ + : umount / \ + : mount $BOOT_DEVICE / \ + : write /cmdline.txt "+dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 cgroup-enable=memory swapaccount=1 elevator=deadline rootwait console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty0 rancher.password=rancher rw init=/init +" \ + : umount / + +zip dist/rancheros-rpi2.zip build/run.img