Merge pull request #6158 from fidencio/topic/CCv0-enable-runtime-rs

CC | Take runtime-rs into consideration when building and caching the shim-v2 tarball
This commit is contained in:
Fabiano Fidêncio 2023-02-07 15:34:02 +01:00 committed by GitHub
commit 55dcaa22e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 21 deletions

View File

@ -330,9 +330,11 @@ install_cc_qemu() {
#Install all components that are not assets #Install all components that are not assets
install_cc_shimv2() { install_cc_shimv2() {
local shim_v2_last_commit="$(get_last_modification "${repo_root_dir}/src/runtime")" local shim_v2_last_commit="$(get_last_modification "${repo_root_dir}/src/runtime")"
local runtime_rs_last_commit="$(get_last_modification "${repo_root_dir}/src/runtime-rs")"
local protocols_last_commit="$(get_last_modification "${repo_root_dir}/src/libs/protocols")"
local golang_version="$(get_from_kata_deps "languages.golang.meta.newest-version")" local golang_version="$(get_from_kata_deps "languages.golang.meta.newest-version")"
local rust_version="$(get_from_kata_deps "languages.rust.meta.newest-version")" local rust_version="$(get_from_kata_deps "languages.rust.meta.newest-version")"
local shim_v2_version="${shim_v2_last_commit}-${golang_version}-${rust_version}" local shim_v2_version="${shim_v2_last_commit}-${protocols_last_commit}-${runtime_rs_last_commit}-${golang_version}-${rust_version}"
install_cached_cc_shim_v2 \ install_cached_cc_shim_v2 \
"shim-v2" \ "shim-v2" \
@ -344,7 +346,9 @@ install_cc_shimv2() {
&& return 0 && return 0
GO_VERSION="$(yq r ${versions_yaml} languages.golang.meta.newest-version)" GO_VERSION="$(yq r ${versions_yaml} languages.golang.meta.newest-version)"
RUST_VERSION="$(yq r ${versions_yaml} languages.rust.meta.newest-version)"
export GO_VERSION export GO_VERSION
export RUST_VERSION
export REMOVE_VMM_CONFIGS="acrn fc" export REMOVE_VMM_CONFIGS="acrn fc"
extra_opts="DEFSERVICEOFFLOAD=true" extra_opts="DEFSERVICEOFFLOAD=true"

View File

@ -111,9 +111,11 @@ cache_rootfs_artifacts() {
cache_shim_v2_artifacts() { cache_shim_v2_artifacts() {
local shim_v2_tarball_name="kata-static-cc-shim-v2.tar.xz" local shim_v2_tarball_name="kata-static-cc-shim-v2.tar.xz"
local shim_v2_last_commit="$(get_last_modification "${repo_root_dir}/src/runtime")" local shim_v2_last_commit="$(get_last_modification "${repo_root_dir}/src/runtime")"
local protocols_last_commit="$(get_last_modification "${repo_root_dir}/src/libs/protocols")"
local runtime_rs_last_commit="$(get_last_modification "${repo_root_dir}/src/runtime-rs")"
local golang_version="$(get_from_kata_deps "languages.golang.meta.newest-version")" local golang_version="$(get_from_kata_deps "languages.golang.meta.newest-version")"
local rust_version="$(get_from_kata_deps "languages.rust.meta.newest-version")" local rust_version="$(get_from_kata_deps "languages.rust.meta.newest-version")"
local current_shim_v2_version="${shim_v2_last_commit}-${golang_version}-${rust_version}" local current_shim_v2_version="${shim_v2_last_commit}-${protocols_last_commit}-${runtime_rs_last_commit}-${golang_version}-${rust_version}"
local current_shim_v2_image="$(get_shim_v2_image_name)" local current_shim_v2_image="$(get_shim_v2_image_name)"
create_cache_asset "${shim_v2_tarball_name}" "${current_shim_v2_version}" "${current_shim_v2_image}" "${repo_root_dir}/tools/osbuilder/root_hash_vanilla.txt" "${repo_root_dir}/tools/osbuilder/root_hash_tdx.txt" create_cache_asset "${shim_v2_tarball_name}" "${current_shim_v2_version}" "${current_shim_v2_image}" "${repo_root_dir}/tools/osbuilder/root_hash_vanilla.txt" "${repo_root_dir}/tools/osbuilder/root_hash_tdx.txt"
} }

View File

@ -15,7 +15,7 @@ source "${script_dir}/../../scripts/lib.sh"
readonly kernel_builder="${repo_root_dir}/tools/packaging/kernel/build-kernel.sh" readonly kernel_builder="${repo_root_dir}/tools/packaging/kernel/build-kernel.sh"
GO_VERSION=${GO_VERSION} GO_VERSION=${GO_VERSION}
RUST_VERSION=${RUST_VERSION:-} RUST_VERSION=${RUST_VERSION}
DESTDIR=${DESTDIR:-${PWD}} DESTDIR=${DESTDIR:-${PWD}}
PREFIX=${PREFIX:-/opt/kata} PREFIX=${PREFIX:-/opt/kata}
@ -38,17 +38,15 @@ if [ ${arch} = "ppc64le" ]; then
arch="ppc64" arch="ppc64"
fi fi
if [ -n "${RUST_VERSION}" ]; then sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ -w "${repo_root_dir}/src/runtime-rs" \
-w "${repo_root_dir}/src/runtime-rs" \ "${container_image}" \
"${container_image}" \ bash -c "git config --global --add safe.directory ${repo_root_dir} && make PREFIX=${PREFIX} QEMUCMD=qemu-system-${arch}"
bash -c "git config --global --add safe.directory ${repo_root_dir} && make PREFIX=${PREFIX} QEMUCMD=qemu-system-${arch}"
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
-w "${repo_root_dir}/src/runtime-rs" \ -w "${repo_root_dir}/src/runtime-rs" \
"${container_image}" \ "${container_image}" \
bash -c "git config --global --add safe.directory ${repo_root_dir} && make PREFIX="${PREFIX}" DESTDIR="${DESTDIR}" install" bash -c "git config --global --add safe.directory ${repo_root_dir} && make PREFIX="${PREFIX}" DESTDIR="${DESTDIR}" install"
fi
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
-w "${repo_root_dir}/src/runtime" \ -w "${repo_root_dir}/src/runtime" \

View File

@ -51,13 +51,11 @@ EOF
trap finish EXIT trap finish EXIT
rust_version=${2:-} rust_version=${2:-}
if [ -n "${rust_version}" ]; then ARCH=${ARCH:-$(uname -m)}
ARCH=${ARCH:-$(uname -m)} LIBC=${LIBC:-musl}
LIBC=${LIBC:-musl} curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | sh -s -- -y --default-toolchain ${rust_version} -t ${ARCH}-unknown-linux-${LIBC}
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | sh -s -- -y --default-toolchain ${rust_version} -t ${ARCH}-unknown-linux-${LIBC} source /root/.cargo/env
source /root/.cargo/env rustup target add x86_64-unknown-linux-musl
rustup target add x86_64-unknown-linux-musl
fi
pushd "${tmp_dir}" pushd "${tmp_dir}"