static-build: drop NEMU, add CLH

We still were adding NEMU binaries - remove, and make sure we create a
kata-clh file for kata-deploy binaries.

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
This commit is contained in:
Eric Ernst 2020-01-07 17:29:30 -08:00
parent 6c9db9b853
commit 59a34bb1d5
5 changed files with 3 additions and 250 deletions

View File

@ -236,11 +236,11 @@ ${prefix}/bin/kata-runtime --kata-config "${prefix}/share/defaults/${project}/co
EOT
sudo chmod +x kata-qemu
cat <<EOT | sudo tee kata-nemu
cat <<EOT | sudo tee kata-clh
#!/bin/bash
${prefix}/bin/kata-runtime --kata-config "${prefix}/share/defaults/${project}/configuration-nemu.toml" \$@
${prefix}/bin/kata-runtime --kata-config "${prefix}/share/defaults/${project}/configuration-clh.toml" \$@
EOT
sudo chmod +x kata-nemu
sudo chmod +x kata-clh
cat <<EOT | sudo tee kata-qemu-virtiofs
#!/bin/bash

View File

@ -1,60 +0,0 @@
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
from ubuntu:18.04
ARG NEMU_REPO
ARG NEMU_VERSION
ARG NEMU_OVMF
ARG VIRTIOFSD_RELEASE
ARG VIRTIOFSD
ARG PREFIX
WORKDIR /root/nemu
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \
autoconf \
automake \
bc \
bison \
cpio \
flex \
gawk \
libaudit-dev \
libcap-dev \
libcap-ng-dev \
libdw-dev \
libelf-dev \
libglib2.0-0 \
libglib2.0-dev \
libglib2.0-dev git \
libltdl-dev \
libpixman-1-dev \
libtool \
pkg-config \
pkg-config \
python \
python-dev \
rsync \
wget \
zlib1g-dev
RUN cd .. && git clone --depth=1 "${NEMU_REPO}" nemu
RUN git fetch origin --tags && git checkout "${NEMU_VERSION}"
RUN git clone https://github.com/qemu/capstone.git capstone
RUN git clone https://github.com/qemu/keycodemapdb.git ui/keycodemapdb
ADD configure-hypervisor.sh /root/configure-hypervisor.sh
RUN PREFIX="${PREFIX}" /root/configure-hypervisor.sh -s kata-nemu | xargs ./configure \
--with-pkgversion=kata-static
RUN make -j$(nproc)
RUN make install DESTDIR=/tmp/nemu-static
RUN wget "${NEMU_OVMF}" && mv OVMF.fd /tmp/nemu-static/"${PREFIX}"/share/kata-nemu/
RUN mv /tmp/nemu-static/"${PREFIX}"/bin/qemu-system-x86_64 /tmp/nemu-static/"${PREFIX}"/bin/nemu-system-x86_64
RUN wget "${VIRTIOFSD_RELEASE}/${VIRTIOFSD}" && chmod +x ${VIRTIOFSD} && mv ${VIRTIOFSD} /tmp/nemu-static/"${PREFIX}"/bin/
RUN cd /tmp/nemu-static && tar -czvf kata-nemu-static.tar.gz *

View File

@ -1,70 +0,0 @@
# Copyright (c) 2019 ARM Limited
#
# SPDX-License-Identifier: Apache-2.0
#
FROM debian
ARG NEMU_REPO
ARG NEMU_VERSION
ARG NEMU_OVMF
ARG VIRTIOFSD_RELEASE
ARG VIRTIOFSD
ARG PREFIX
ARG GEN_ARCH
ARG DPKG_ARCH
WORKDIR /root/nemu
RUN echo "deb http://deb.debian.org/debian stable main" > /etc/apt/sources.list
RUN echo "deb http://deb.debian.org/debian stable-updates main" >> /etc/apt/sources.list
RUN echo "deb http://security.debian.org stable/updates main" >> /etc/apt/sources.list
RUN dpkg --add-architecture $DPKG_ARCH
RUN apt update && apt install -y \
autoconf \
automake \
bc \
bison \
cpio \
curl \
flex \
gawk \
git \
make \
pkg-config \
python \
python-dev \
rsync \
gcc-$GEN_ARCH-linux-gnu \
libaudit-dev:$DPKG_ARCH \
libcap-dev:$DPKG_ARCH \
libcap-ng-dev:$DPKG_ARCH \
libdw-dev:$DPKG_ARCH \
libelf-dev:$DPKG_ARCH \
libglib2.0-0:$DPKG_ARCH \
libglib2.0-dev:$DPKG_ARCH \
zlib1g-dev:$DPKG_ARCH \
librbd-dev:$DPKG_ARCH \
libltdl-dev:$DPKG_ARCH \
libpixman-1-dev:$DPKG_ARCH
RUN cd .. && git clone --depth=1 "${NEMU_REPO}" nemu
RUN git fetch origin --tags && git checkout "${NEMU_VERSION}"
RUN git clone https://github.com/qemu/capstone.git capstone
RUN git clone https://github.com/qemu/keycodemapdb.git ui/keycodemapdb
ADD configure-hypervisor.sh /root/configure-hypervisor.sh
RUN curl -O http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-defaults/pkg-config-"${GEN_ARCH}"-linux-gnu_7.4.0-1ubuntu2.3_amd64.deb && dpkg -i pkg*
ENV PKG_CONFIG_PATH $PKG_CONFIG_PATH:/usr/lib/"${GEN_ARCH}"-linux-gnu/pkgconfig/:/usr/"${GEN_ARCH}"-linux-gnu/lib/pkgconfig
RUN PREFIX="${PREFIX}" /root/configure-hypervisor.sh -s kata-nemu ${GEN_ARCH} | xargs ./configure \
--with-pkgversion=kata-static
RUN make -j$($(nproc)-1) CONFIG_HID_DEV=y
RUN make install DESTDIR=/tmp/nemu-static
RUN curl -O "${NEMU_OVMF}" && mv OVMF.fd /tmp/nemu-static/"${PREFIX}"/share/kata-nemu/
RUN mv /tmp/nemu-static/"${PREFIX}"/bin/qemu-system-$GEN_ARCH /tmp/nemu-static/"${PREFIX}"/bin/nemu-system-$GEN_ARCH
RUN curl -O "${VIRTIOFSD_RELEASE}/${VIRTIOFSD}" && chmod +x ${VIRTIOFSD} && mv ${VIRTIOFSD} /tmp/nemu-static/"${PREFIX}"/bin/
RUN cd /tmp/nemu-static && tar -czvf kata-nemu-static.tar.gz *

View File

@ -1,13 +0,0 @@
#Copyright (c) 2019 Intel Corporation
#
#SPDX-License-Identifier: Apache-2.0
#
MK_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CONFIG_DIR := $(MK_DIR)/../../scripts/
build:
"$(MK_DIR)/build-static-nemu.sh" $(arch)
clean:
rm -f kata-nemu-static.tar.gz

View File

@ -1,104 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
set -o errexit
set -o nounset
set -o pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${script_dir}/../../scripts/lib.sh"
source "${script_dir}/../qemu.blacklist"
config_dir="${script_dir}/../../scripts/"
nemu_tar="kata-static-nemu.tar.gz"
nemu_tmp_tar="kata-static-nemu-tmp.tar.gz"
Dockerfile="Dockerfile"
if [ $# -ne 0 ];then
arch="$1"
case "$arch" in
aarch64) dpkg_arch="arm64"
Dockerfile="Dockerfile_cross"
;;
ppc64le) arch="powerpc64le"
dpkg_arch="ppc64el"
Dockerfile="Dockerfile_cross"
;;
s390x) dpkg_arch=$arch
Dockerfile="Dockerfile_cross"
;;
x86_64) dpkg_arch="amd64"
arch="amd64"
;;
*) die "$arch is not support for cross compile" ;;
esac
else
arch=""
dpkg_arch=""
fi
nemu_repo="${nemu_repo:-}"
nemu_version="${nemu_version:-}"
nemu_ovmf_repo="${nemu_ovmf_repo:-}"
nemu_ovmf_version="${nemu_ovmf_version:-}"
kata_version="${kata_version:-}"
if [ -z "$nemu_repo" ]; then
info "Get nemu information from runtime versions.yaml"
nemu_repo=$(get_from_kata_deps "assets.hypervisor.nemu.url" "$kata_version")
fi
[ -n "$nemu_repo" ] || die "failed to get nemu repo"
[ -n "$nemu_version" ] || nemu_version=$(get_from_kata_deps "assets.hypervisor.nemu.version" "$kata_version")
[ -n "$nemu_version" ] || die "failed to get nemu version"
if [ -z "$nemu_ovmf_repo" ]; then
info "Get nemu information from runtime versions.yaml"
nemu_ovmf_repo=$(get_from_kata_deps "assets.hypervisor.nemu-ovmf.url" "$kata_version")
[ -n "$nemu_ovmf_repo" ] || die "failed to get nemu ovmf repo url"
fi
if [ -z "$nemu_ovmf_version" ]; then
nemu_ovmf_version=$(get_from_kata_deps "assets.hypervisor.nemu-ovmf.version" "$kata_version")
[ -n "$nemu_ovmf_version" ] || die "failed to get nemu ovmf version"
fi
nemu_virtiofsd_binary="virtiofsd-x86_64"
nemu_virtiofsd_release="${nemu_repo}/releases/download/${nemu_version}"
nemu_ovmf_release="${nemu_ovmf_repo}/releases/download/${nemu_ovmf_version}/OVMF.fd"
info "Build ${nemu_repo} version: ${nemu_version}"
http_proxy="${http_proxy:-}"
https_proxy="${https_proxy:-}"
prefix="${prefix:-"/opt/kata"}"
sudo docker build \
--no-cache \
--build-arg http_proxy="${http_proxy}" \
--build-arg https_proxy="${https_proxy}" \
--build-arg NEMU_REPO="${nemu_repo}" \
--build-arg NEMU_VERSION="${nemu_version}" \
--build-arg NEMU_OVMF="${nemu_ovmf_release}" \
--build-arg VIRTIOFSD_RELEASE="${nemu_virtiofsd_release}" \
--build-arg VIRTIOFSD="${nemu_virtiofsd_binary}" \
--build-arg PREFIX="${prefix}" \
--build-arg DPKG_ARCH="${dpkg_arch}" \
--build-arg GEN_ARCH="${arch}" \
"${config_dir}" \
-f "${script_dir}/$Dockerfile" \
-t nemu-static
sudo docker run \
-i \
-v "${PWD}":/share nemu-static \
mv "/tmp/nemu-static/${nemu_tar}" /share/
sudo chown ${USER}:${USER} "${PWD}/${nemu_tar}"
# Remove blacklisted binaries
gzip -d < "${nemu_tar}" | tar --delete --wildcards -f - ${qemu_black_list[*]} | gzip > "${nemu_tmp_tar}"
mv -f "${nemu_tmp_tar}" "${nemu_tar}"