mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-06 12:06:49 +00:00
nemu: add support for static build of nemu
Fixes: #401 Signed-off-by: Eric Ernst <eric.ernst@intel.com>
This commit is contained in:
parent
3c500df527
commit
924bda0c61
56
static-build/nemu/Dockerfile
Normal file
56
static-build/nemu/Dockerfile
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# Copyright (c) 2019 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
from ubuntu:18.04
|
||||||
|
|
||||||
|
ARG NEMU_REPO
|
||||||
|
ARG NEMU_VERSION
|
||||||
|
ARG NEMU_OVMF
|
||||||
|
|
||||||
|
WORKDIR /root/nemu
|
||||||
|
RUN apt-get update
|
||||||
|
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 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=/opt/kata /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/opt/kata/share/kata-nemu/
|
||||||
|
RUN mv /tmp/nemu-static/opt/kata/bin/qemu-system-x86_64 /tmp/nemu-static/opt/kata/bin/nemu-system-x86_64
|
||||||
|
|
||||||
|
RUN cd /tmp/nemu-static && tar -czvf kata-nemu-static.tar.gz *
|
13
static-build/nemu/Makefile
Normal file
13
static-build/nemu/Makefile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#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"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f kata-nemu-static.tar.gz
|
63
static-build/nemu/build-static-nemu.sh
Executable file
63
static-build/nemu/build-static-nemu.sh
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/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"
|
||||||
|
|
||||||
|
config_dir="${script_dir}/../../scripts/"
|
||||||
|
|
||||||
|
nemu_repo="${nemu_repo:-}"
|
||||||
|
nemu_version="${nemu_version:-}"
|
||||||
|
nemu_ovmf_repo="${nemu_ovmf_repo:-}"
|
||||||
|
nemu_ovmf_version="${nemu_ovmf_version:-}"
|
||||||
|
|
||||||
|
if [ -z "$nemu_repo" ]; then
|
||||||
|
info "Get nemu information from runtime versions.yaml"
|
||||||
|
nemu_url=$(get_from_kata_deps "assets.hypervisor.nemu.url")
|
||||||
|
[ -n "$nemu_url" ] || die "failed to get nemu url"
|
||||||
|
nemu_repo="${nemu_url}.git"
|
||||||
|
fi
|
||||||
|
[ -n "$nemu_repo" ] || die "failed to get nemu repo"
|
||||||
|
|
||||||
|
[ -n "$nemu_version" ] || nemu_version=$(get_from_kata_deps "assets.hypervisor.nemu.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")
|
||||||
|
[ -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")
|
||||||
|
[ -n "$nemu_ovmf_version" ] || die "failed to get nemu ovmf version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
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:-}"
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
--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}" \
|
||||||
|
"${config_dir}" \
|
||||||
|
-f "${script_dir}/Dockerfile" \
|
||||||
|
-t nemu-static
|
||||||
|
|
||||||
|
docker run \
|
||||||
|
-i \
|
||||||
|
-v "${PWD}":/share nemu-static \
|
||||||
|
mv /tmp/nemu-static/kata-nemu-static.tar.gz /share/
|
Loading…
Reference in New Issue
Block a user