1#!/bin/bash 2 3set -ex 4 5# Pull down repositories that crosvm depends on to cros checkout-like locations. 6CROS_ROOT=/ 7THIRD_PARTY_ROOT=$CROS_ROOT/third_party 8mkdir -p $THIRD_PARTY_ROOT 9AOSP_EXTERNAL_ROOT=$CROS_ROOT/aosp/external 10mkdir -p $AOSP_EXTERNAL_ROOT 11PLATFORM2_ROOT=/platform2 12 13PLATFORM2_COMMIT=72e56e66ccf3d2ea48f5686bd1f772379c43628b 14git clone --single-branch --no-checkout https://chromium.googlesource.com/chromiumos/platform2 $PLATFORM2_ROOT 15pushd $PLATFORM2_ROOT 16git checkout $PLATFORM2_COMMIT 17popd 18 19# minijail does not exist in upstream linux distros. 20MINIJAIL_COMMIT=debdf5de5a0ae3b667bee2f8fb1f755b0b3f5a6c 21git clone --single-branch --no-checkout https://android.googlesource.com/platform/external/minijail $AOSP_EXTERNAL_ROOT/minijail 22pushd $AOSP_EXTERNAL_ROOT/minijail 23git checkout $MINIJAIL_COMMIT 24make 25cp libminijail.so /usr/lib/x86_64-linux-gnu/ 26popd 27 28# Pull the cras library for audio access. 29ADHD_COMMIT=a1e0869b95c845c4fe6234a7b92fdfa6acc1e809 30git clone --single-branch --no-checkout https://chromium.googlesource.com/chromiumos/third_party/adhd $THIRD_PARTY_ROOT/adhd 31pushd $THIRD_PARTY_ROOT/adhd 32git checkout $ADHD_COMMIT 33popd 34 35# Pull vHost (dataplane for virtio backend drivers) 36VHOST_COMMIT=3091854e27242d09453004b011f701fa29c0b8e8 37git clone --single-branch --no-checkout https://chromium.googlesource.com/chromiumos/third_party/rust-vmm/vhost $THIRD_PARTY_ROOT/rust-vmm/vhost 38pushd $THIRD_PARTY_ROOT/rust-vmm/vhost 39git checkout $VHOST_COMMIT 40popd 41 42CROSVM_VERSION=e42a43d880b0364b55559dbeade3af174f929001 43git clone --single-branch --no-checkout https://chromium.googlesource.com/chromiumos/platform/crosvm /platform/crosvm 44pushd /platform/crosvm 45git checkout "$CROSVM_VERSION" 46 47RUSTFLAGS='-L native=/usr/local/lib' cargo install \ 48 bindgen \ 49 -j ${FDO_CI_CONCURRENT:-4} \ 50 --root /usr/local \ 51 $EXTRA_CARGO_ARGS 52 53RUSTFLAGS='-L native=/usr/local/lib' cargo install \ 54 -j ${FDO_CI_CONCURRENT:-4} \ 55 --locked \ 56 --features 'default-no-sandbox gpu x virgl_renderer virgl_renderer_next' \ 57 --path . \ 58 --root /usr/local \ 59 $EXTRA_CARGO_ARGS 60 61popd 62 63rm -rf $PLATFORM2_ROOT $AOSP_EXTERNAL_ROOT/minijail $THIRD_PARTY_ROOT/adhd $THIRD_PARTY_ROOT/rust-vmm /platform/crosvm 64