From 1c2c1f45f73e089ced640173c74213cfcd97746c Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Mon, 15 Feb 2016 15:26:59 +0300 Subject: [PATCH] crtools: add Dockerfile to build criu on armv7hf, aarch64, ppc64le Signed-off-by: Andrew Vagin Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- scripts/build/Dockerfile.aarch64 | 22 ++++++++++++++++++++++ scripts/build/Dockerfile.armv7hf | 22 ++++++++++++++++++++++ scripts/build/Dockerfile.ppc64le | 22 ++++++++++++++++++++++ scripts/build/Makefile | 24 ++++++++++++++++++++++++ scripts/build/extract-deb-pkg | 11 +++++++++++ 5 files changed, 101 insertions(+) create mode 100644 scripts/build/Dockerfile.aarch64 create mode 100644 scripts/build/Dockerfile.armv7hf create mode 100644 scripts/build/Dockerfile.ppc64le create mode 100644 scripts/build/Makefile create mode 100755 scripts/build/extract-deb-pkg diff --git a/scripts/build/Dockerfile.aarch64 b/scripts/build/Dockerfile.aarch64 new file mode 100644 index 000000000..414544895 --- /dev/null +++ b/scripts/build/Dockerfile.aarch64 @@ -0,0 +1,22 @@ +FROM aarch64/ubuntu:trusty + +COPY scripts/build/qemu-user-static/usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static + +RUN apt-get update + +RUN apt-get update && apt-get install -y \ + build-essential \ + protobuf-c-compiler \ + libprotobuf-c0-dev \ + libprotobuf-dev \ + bsdmainutils \ + protobuf-compiler \ + python-minimal \ + libaio-dev \ + iptables \ + libnl-3-dev + +COPY . /criu +WORKDIR /criu + +RUN make clean && make -j $(nproc) diff --git a/scripts/build/Dockerfile.armv7hf b/scripts/build/Dockerfile.armv7hf new file mode 100644 index 000000000..e4a44557c --- /dev/null +++ b/scripts/build/Dockerfile.armv7hf @@ -0,0 +1,22 @@ +FROM armv7/armhf-ubuntu + +COPY scripts/build/qemu-user-static/usr/bin/qemu-arm-static /usr/bin/qemu-arm-static + +RUN apt-get update + +RUN apt-get update && apt-get install -y \ + build-essential \ + protobuf-c-compiler \ + libprotobuf-c0-dev \ + libprotobuf-dev \ + bsdmainutils \ + protobuf-compiler \ + python-minimal \ + libaio-dev \ + iptables \ + libnl-3-dev + +COPY . /criu +WORKDIR /criu + +RUN make clean && make -j $(nproc) diff --git a/scripts/build/Dockerfile.ppc64le b/scripts/build/Dockerfile.ppc64le new file mode 100644 index 000000000..9c83d8a70 --- /dev/null +++ b/scripts/build/Dockerfile.ppc64le @@ -0,0 +1,22 @@ +FROM ppc64le/ubuntu + +COPY scripts/build/qemu-user-static/usr/bin/qemu-ppc64le-static /usr/bin/qemu-ppc64le-static + +RUN apt-get update + +RUN apt-get update && apt-get install -y \ + build-essential \ + protobuf-c-compiler \ + libprotobuf-c0-dev \ + libprotobuf-dev \ + bsdmainutils \ + protobuf-compiler \ + python-minimal \ + libaio-dev \ + iptables \ + libnl-3-dev + +COPY . /criu +WORKDIR /criu + +RUN make clean && make -j $(nproc) diff --git a/scripts/build/Makefile b/scripts/build/Makefile new file mode 100644 index 000000000..aa49e53f3 --- /dev/null +++ b/scripts/build/Makefile @@ -0,0 +1,24 @@ +all: armv7hf aarch64 ppc64le + +qemu-user-static: + ./extract-deb-pkg qemu-user-static + +binfmt_misc: + echo ':armv7hf:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register; + echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register + echo ':ppc64le:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00:/usr/bin/qemu-ppc64le-static:' > /proc/sys/fs/binfmt_misc/register + +armv7hf: qemu-user-static + docker build -t criu-armv7hf -f Dockerfile.armv7hf ../.. + +aarch64: qemu-user-static + docker build -t criu-aarch64 -f Dockerfile.aarch64 ../.. + +ppc64le: qemu-user-static + docker build -t criu-aarch64 -f Dockerfile.ppc64le ../.. + +clean: + echo -1 > /proc/sys/fs/binfmt_misc/ppc64le + echo -1 > /proc/sys/fs/binfmt_misc/armv7hf + echo -1 > /proc/sys/fs/binfmt_misc/aarch64 + rm -rf qemu-user-static diff --git a/scripts/build/extract-deb-pkg b/scripts/build/extract-deb-pkg new file mode 100755 index 000000000..dc9ac5f51 --- /dev/null +++ b/scripts/build/extract-deb-pkg @@ -0,0 +1,11 @@ +#'http://mirror.yandex.ru/debian/pool/main/q/qemu/qemu-user-static_2.5%2Bdfsg-5_amd64.deb' +set -e +test -d $1 && exit +mkdir $1 +cd $1 +curl http://mirror.yandex.ru/debian/dists/jessie/main/binary-amd64/Packages.gz | zcat | grep "Filename.*$1" | awk '{ print $2 }' +pkg=`curl http://mirror.yandex.ru/debian/dists/jessie/main/binary-amd64/Packages.gz | zcat | grep "Filename.*$1" | awk '{ print $2 }'` +wget "http://mirror.yandex.ru/debian/$pkg" +pkg=`basename $pkg` +ar vx $pkg +tar -xJvf data.tar.xz