From 41aaa36e6f32b97b537d3ccdf65e06c4df454c5c Mon Sep 17 00:00:00 2001 From: Penny Zheng Date: Thu, 20 Feb 2020 10:57:15 +0800 Subject: [PATCH] ubuntu/debian: create aarch64-specific Dockerfile.in The musl package in ubuntu/debian could not provide everything we need on aarch64. e.g. we need `aarch64-linux-musl-gcc` as linker, and it's not provided in package. Fixes: #411 Signed-off-by: Penny Zheng --- rootfs-builder/debian/Dockerfile-aarch64.in | 35 ++++++++++++++++++ rootfs-builder/ubuntu/Dockerfile-aarch64.in | 39 +++++++++++++++++++++ scripts/lib.sh | 11 ++++-- 3 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 rootfs-builder/debian/Dockerfile-aarch64.in create mode 100644 rootfs-builder/ubuntu/Dockerfile-aarch64.in diff --git a/rootfs-builder/debian/Dockerfile-aarch64.in b/rootfs-builder/debian/Dockerfile-aarch64.in new file mode 100644 index 0000000000..e119d3599f --- /dev/null +++ b/rootfs-builder/debian/Dockerfile-aarch64.in @@ -0,0 +1,35 @@ +# +# Copyright (c) 2020 ARM Limited +# +# SPDX-License-Identifier: Apache-2.0 + +# NOTE: OS_VERSION is set according to config.sh +from docker.io/debian:@OS_VERSION@ + +# RUN commands +RUN apt-get update && apt-get install -y \ + autoconf \ + automake \ + binutils \ + build-essential \ + chrony \ + cmake \ + coreutils \ + curl \ + debianutils \ + debootstrap \ + g++ \ + gcc \ + git \ + libc-dev \ + libstdc++-6-dev \ + m4 \ + make \ + sed \ + systemd \ + tar \ + vim +# This will install the proper golang to build Kata components +@INSTALL_GO@ +@INSTALL_MUSL@ +@INSTALL_RUST@ diff --git a/rootfs-builder/ubuntu/Dockerfile-aarch64.in b/rootfs-builder/ubuntu/Dockerfile-aarch64.in new file mode 100644 index 0000000000..13bb09743e --- /dev/null +++ b/rootfs-builder/ubuntu/Dockerfile-aarch64.in @@ -0,0 +1,39 @@ +# +# Copyright (c) 2020 ARM Limited +# +# SPDX-License-Identifier: Apache-2.0 + +#ubuntu: docker image to be used to create a rootfs +#@OS_VERSION@: Docker image version to build this dockerfile +from docker.io/ubuntu:@OS_VERSION@ + +# This dockerfile needs to provide all the componets need to build a rootfs +# Install any package need to create a rootfs (package manager, extra tools) + +# RUN commands +RUN apt-get update && apt-get install -y \ + autoconf \ + automake \ + binutils \ + build-essential \ + chrony \ + cmake \ + coreutils \ + curl \ + debianutils \ + debootstrap \ + g++ \ + gcc \ + git \ + libc6-dev \ + libstdc++-8-dev \ + m4 \ + make \ + sed \ + systemd \ + tar \ + vim +# This will install the proper golang to build Kata components +@INSTALL_GO@ +@INSTALL_MUSL@ +@INSTALL_RUST@ diff --git a/scripts/lib.sh b/scripts/lib.sh index c7a09aeb8b..9f8aa54dc9 100644 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -274,7 +274,6 @@ generate_dockerfile() curlOptions=("-OL") [ -n "${http_proxy:-}" ] && curlOptions+=("-x ${http_proxy:-}") - readonly dockerfile_template="Dockerfile.in" readonly install_go=" RUN cd /tmp ; curl ${curlOptions[@]} https://storage.googleapis.com/golang/go${GO_VERSION}.linux-${goarch}.tar.gz RUN tar -C /usr/ -xzf /tmp/go${GO_VERSION}.linux-${goarch}.tar.gz @@ -344,7 +343,15 @@ RUN ln -sf /usr/bin/g++ /bin/musl-g++ # rust agent still need go to build # because grpc-sys need go to build pushd ${dir} - [ -f "${dockerfile_template}" ] || die "${dockerfile_template}: file not found" + dockerfile_template="Dockerfile.in" + dockerfile_arch_template="Dockerfile-${architecture}.in" + # if arch-specific docker file exists, swap the univesal one with it. + if [ -f "${dockerfile_arch_template}" ]; then + dockerfile_template="${dockerfile_arch_template}" + else + [ -f "${dockerfile_template}" ] || die "${dockerfile_template}: file not found" + fi + # powerpc have no musl target, don't setup rust enviroment # since we cannot static link agent. Besides, there is # also long double representation problem when building musl-libc