mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +00:00
Merge pull request #702 from GabyCT/topic/addvirtiofs
qemu: Enable qemu with virtio-fs 3.0
This commit is contained in:
commit
9956de822c
@ -120,6 +120,14 @@ install_qemu() {
|
|||||||
tar xf kata-qemu-static.tar.gz -C "${destdir}"
|
tar xf kata-qemu-static.tar.gz -C "${destdir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Install static qemu-virtiofsd asset
|
||||||
|
install_qemu_virtiofsd() {
|
||||||
|
info "build static qemu-virtiofs"
|
||||||
|
"${script_dir}/../static-build/qemu-virtiofsd/build-static-qemu.sh"
|
||||||
|
info "Install static qemu-virtiofsd"
|
||||||
|
tar xf kata-qemu-static.tar.gz -C "${destdir}"
|
||||||
|
}
|
||||||
|
|
||||||
# Install static firecracker asset
|
# Install static firecracker asset
|
||||||
install_firecracker() {
|
install_firecracker() {
|
||||||
info "build static firecracker"
|
info "build static firecracker"
|
||||||
@ -210,6 +218,7 @@ main() {
|
|||||||
install_kata_components
|
install_kata_components
|
||||||
install_kernel
|
install_kernel
|
||||||
install_qemu
|
install_qemu
|
||||||
|
install_qemu_virtiofsd
|
||||||
install_nemu
|
install_nemu
|
||||||
install_firecracker
|
install_firecracker
|
||||||
install_docker_config_script
|
install_docker_config_script
|
||||||
|
48
static-build/qemu-virtiofs/Dockerfile
Normal file
48
static-build/qemu-virtiofs/Dockerfile
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
from ubuntu:18.04
|
||||||
|
|
||||||
|
ARG QEMU_VIRTIOFS_REPO
|
||||||
|
# commit/tag/branch
|
||||||
|
ARG QEMU_VIRTIOFS_TAG
|
||||||
|
ARG PREFIX
|
||||||
|
|
||||||
|
WORKDIR /root/qemu-virtiofs
|
||||||
|
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 \
|
||||||
|
libseccomp-dev \
|
||||||
|
libtool \
|
||||||
|
pkg-config \
|
||||||
|
pkg-config \
|
||||||
|
python \
|
||||||
|
python-dev \
|
||||||
|
rsync \
|
||||||
|
seccomp \
|
||||||
|
libseccomp2 \
|
||||||
|
zlib1g-dev
|
||||||
|
|
||||||
|
RUN cd .. && git clone "${QEMU_VIRTIOFS_REPO}" qemu-virtiofs
|
||||||
|
RUN git checkout "${QEMU_VIRTIOFS_TAG}"
|
||||||
|
ADD scripts/configure-hypervisor.sh /root/configure-hypervisor.sh
|
||||||
|
RUN PREFIX="${PREFIX}" /root/configure-hypervisor.sh -s kata-qemu | sed -e 's|--enable-rbd||g' -e 's|--disable-seccomp||g' | xargs ./configure \
|
||||||
|
--with-pkgversion=kata-static
|
||||||
|
RUN make -j$(nproc)
|
||||||
|
RUN make -j$(nproc) virtiofsd
|
||||||
|
RUN make install DESTDIR=/tmp/qemu-virtiofs-static
|
||||||
|
RUN chmod +x virtiofsd && mv virtiofsd /tmp/qemu-virtiofs-static/opt/kata/bin/
|
||||||
|
RUN cd /tmp/qemu-virtiofs-static && tar -czvf kata-qemu-static.tar.gz *
|
7
static-build/qemu-virtiofs/Makefile
Normal file
7
static-build/qemu-virtiofs/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
MK_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
|
CONFIG_DIR := $(MK_DIR)/../../scripts/
|
||||||
|
|
||||||
|
build:
|
||||||
|
"$(MK_DIR)/build-static-qemu-virtiofs.sh"
|
||||||
|
clean:
|
||||||
|
rm -f kata-qemu-static.tar.gz
|
48
static-build/qemu-virtiofs/build-static-qemu-virtiofs.sh
Executable file
48
static-build/qemu-virtiofs/build-static-qemu-virtiofs.sh
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/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"
|
||||||
|
|
||||||
|
packaging_dir="${script_dir}/../.."
|
||||||
|
qemu_virtiofs_repo="https://gitlab.com/virtio-fs/qemu.git"
|
||||||
|
# This tag will be supported on the runtime versions.yaml
|
||||||
|
qemu_virtiofs_tag="virtio-fs-v0.3"
|
||||||
|
qemu_tar="kata-qemu-static.tar.gz"
|
||||||
|
qemu_tmp_tar="kata-qemu-static-tmp.tar.gz"
|
||||||
|
|
||||||
|
info "Build ${qemu_virtiofs_repo} tag: ${qemu_virtiofs_tag}"
|
||||||
|
|
||||||
|
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 QEMU_VIRTIOFS_REPO="${qemu_virtiofs_repo}" \
|
||||||
|
--build-arg QEMU_VIRTIOFS_TAG="${qemu_virtiofs_tag}" \
|
||||||
|
--build-arg PREFIX="${prefix}" \
|
||||||
|
"${packaging_dir}" \
|
||||||
|
-f "${script_dir}/Dockerfile" \
|
||||||
|
-t qemu-virtiofs-static
|
||||||
|
|
||||||
|
sudo docker run \
|
||||||
|
-i \
|
||||||
|
-v "${PWD}":/share qemu-virtiofs-static \
|
||||||
|
mv "/tmp/qemu-virtiofs-static/${qemu_tar}" /share/
|
||||||
|
|
||||||
|
sudo chown ${USER}:${USER} "${PWD}/${qemu_tar}"
|
||||||
|
|
||||||
|
# Remove blacklisted binaries
|
||||||
|
gzip -d < "${qemu_tar}" | tar --delete --wildcards -f - ${qemu_black_list[*]} | gzip > "${qemu_tmp_tar}"
|
||||||
|
mv -f "${qemu_tmp_tar}" "${qemu_tar}"
|
Loading…
Reference in New Issue
Block a user