diff --git a/resources/Dockerfile b/resources/Dockerfile index c61fb6d7..a28c97a9 100644 --- a/resources/Dockerfile +++ b/resources/Dockerfile @@ -84,6 +84,14 @@ ENV AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu/ ENV AARCH64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu/ ENV OPENSSL_INCLUDE_DIR=/usr/include/ +# Checkout coreboot repository and setup cross toolchains +RUN if [ "$TARGETARCH" = "amd64" ]; then \ + git clone --quiet --branch "$COREBOOT_VERSION" --depth 1 https://github.com/coreboot/coreboot.git "$COREBOOT_DIR" \ + && cd "$COREBOOT_DIR" \ + && git submodule update --init --checkout \ + && make crossgcc-i386 CPUS=`nproc`; \ + fi + # Install the rust toolchain RUN export ARCH="$(uname -m)" \ && nohup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \ @@ -91,6 +99,7 @@ RUN export ARCH="$(uname -m)" \ && rustup component add clippy \ && rustup component add rust-src \ && rustup target add aarch64-unknown-linux-gnu \ + && rustup target add riscv64gc-unknown-linux-gnu \ && rustup target add x86_64-unknown-linux-gnu \ && rm -rf "$CARGO_HOME/registry" \ && ln -s "$CARGO_REGISTRY_DIR" "$CARGO_HOME/registry" \ @@ -101,11 +110,3 @@ RUN export ARCH="$(uname -m)" \ RUN echo 'source $CARGO_HOME/env' >> $HOME/.bashrc \ && mkdir $HOME/.cargo \ && ln -s $CARGO_HOME/env $HOME/.cargo/env - -# Checkout coreboot repository and setup cross toolchains -RUN if [ "$TARGETARCH" = "amd64" ]; then \ - git clone --quiet --branch "$COREBOOT_VERSION" --depth 1 https://github.com/coreboot/coreboot.git "$COREBOOT_DIR" \ - && cd "$COREBOOT_DIR" \ - && git submodule update --init --checkout \ - && make crossgcc-i386 CPUS=`nproc`; \ - fi diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 27c3246f..8ecb9d64 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,9 @@ [toolchain] -channel = "nightly-2023-02-10" +channel = "nightly-2023-05-26" components = ["rust-src", "clippy", "rustfmt"] -targets = ["aarch64-unknown-linux-gnu", "x86_64-unknown-linux-gnu"] +targets = [ + "aarch64-unknown-linux-gnu", + "riscv64gc-unknown-linux-gnu", + "x86_64-unknown-linux-gnu", +] profile = "default" diff --git a/scripts/fetch_images.sh b/scripts/fetch_images.sh index 52e92e83..b68f6b25 100755 --- a/scripts/fetch_images.sh +++ b/scripts/fetch_images.sh @@ -3,7 +3,7 @@ set -x fetch_ch() { CH_PATH="$1" - CH_VERSION="v30.0" + CH_VERSION="v32.0" CH_URL="https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/$CH_VERSION/cloud-hypervisor" if [ ! -f "$CH_PATH" ]; then wget --quiet $CH_URL -O $CH_PATH @@ -39,13 +39,6 @@ fetch_disk_images() { CLEAR_OS_IMAGE_URL="$CLEAR_OS_URL_BASE/$CLEAR_OS_IMAGE_NAME" fetch_image "$CLEAR_OS_IMAGE_NAME" "$CLEAR_OS_IMAGE_URL" - BIONIC_OS_IMAGE_NAME="bionic-server-cloudimg-amd64.img" - BIONIC_OS_RAW_IMAGE_NAME="bionic-server-cloudimg-amd64-raw.img" - BIONIC_OS_IMAGE_BASE="https://cloud-images.ubuntu.com/bionic/current" - BIONIC_OS_IMAGE_URL="$BIONIC_OS_IMAGE_BASE/$BIONIC_OS_IMAGE_NAME" - fetch_image "$BIONIC_OS_IMAGE_NAME" "$BIONIC_OS_IMAGE_URL" - convert_image "$BIONIC_OS_IMAGE_NAME" "$BIONIC_OS_RAW_IMAGE_NAME" - FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64.img" FOCAL_OS_RAW_IMAGE_NAME="focal-server-cloudimg-amd64-raw.img" FOCAL_OS_IMAGE_BASE="https://cloud-images.ubuntu.com/focal/current" diff --git a/src/block.rs b/src/block.rs index 24917839..e6ed210c 100644 --- a/src/block.rs +++ b/src/block.rs @@ -262,14 +262,14 @@ impl<'a> VirtioBlockDevice<'a> { let mut state = self.state.borrow_mut(); let next_head = state.next_head; - let mut d = &mut state.descriptors[next_head]; + let d = &mut state.descriptors[next_head]; let next_desc = (next_head + 1) % QUEUE_SIZE; d.addr = (&header as *const _) as u64; d.length = core::mem::size_of::() as u32; d.flags = VIRTQ_DESC_F_NEXT; d.next = next_desc as u16; - let mut d = &mut state.descriptors[next_desc]; + let d = &mut state.descriptors[next_desc]; let next_desc = (next_desc + 1) % QUEUE_SIZE; if request != RequestType::Flush { match data { @@ -294,7 +294,7 @@ impl<'a> VirtioBlockDevice<'a> { }; d.next = next_desc as u16; - let mut d = &mut state.descriptors[next_desc]; + let d = &mut state.descriptors[next_desc]; d.addr = (&footer as *const _) as u64; d.length = core::mem::size_of::() as u32; d.flags = VIRTQ_DESC_F_WRITE; diff --git a/src/efi/alloc.rs b/src/efi/alloc.rs index c306af06..6d31a616 100644 --- a/src/efi/alloc.rs +++ b/src/efi/alloc.rs @@ -55,7 +55,7 @@ impl Allocator { self.key += 1; if self.first_allocation.is_none() { - let mut a = &mut self.allocations[0]; + let a = &mut self.allocations[0]; a.in_use = true; a.next_allocation = None; diff --git a/src/efi/mod.rs b/src/efi/mod.rs index eb245cfd..10df108d 100644 --- a/src/efi/mod.rs +++ b/src/efi/mod.rs @@ -212,8 +212,8 @@ fn convert_internal_pointer(descriptors: &[alloc::MemoryDescriptor], ptr: u64) - } unsafe fn fixup_at_virtual(descriptors: &[alloc::MemoryDescriptor]) { - let mut st = &mut ST; - let mut rs = &mut RS; + let st = &mut ST; + let rs = &mut RS; let ptr = convert_internal_pointer(descriptors, (not_available as *const ()) as u64).unwrap(); rs.get_time = transmute(ptr); @@ -1174,7 +1174,7 @@ pub fn efi_exec( let mut stdin = console::STDIN; let mut stdout = console::STDOUT; - let mut st = unsafe { &mut ST }; + let st = unsafe { &mut ST }; st.con_in = &mut stdin; st.con_out = &mut stdout; st.std_err = &mut stdout; diff --git a/src/integration.rs b/src/integration.rs index 5c244892..3b4904d1 100644 --- a/src/integration.rs +++ b/src/integration.rs @@ -609,16 +609,10 @@ mod tests { handle_child_output(&tmp_dir, r, &output); } - const BIONIC_IMAGE_NAME: &str = "bionic-server-cloudimg-amd64-raw.img"; const FOCAL_IMAGE_NAME: &str = "focal-server-cloudimg-amd64-raw.img"; const JAMMY_IMAGE_NAME: &str = "jammy-server-cloudimg-amd64-raw.img"; const CLEAR_IMAGE_NAME: &str = "clear-31311-cloudguest.img"; - #[test] - fn test_boot_qemu_bionic() { - test_boot(BIONIC_IMAGE_NAME, &UbuntuCloudInit {}, spawn_qemu) - } - #[test] fn test_boot_qemu_focal() { test_boot(FOCAL_IMAGE_NAME, &UbuntuCloudInit {}, spawn_qemu) @@ -634,12 +628,6 @@ mod tests { test_boot(CLEAR_IMAGE_NAME, &ClearCloudInit {}, spawn_qemu) } - #[test] - #[cfg(not(feature = "coreboot"))] - fn test_boot_ch_bionic() { - test_boot(BIONIC_IMAGE_NAME, &UbuntuCloudInit {}, spawn_ch) - } - #[test] #[cfg(not(feature = "coreboot"))] fn test_boot_ch_focal() {