Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Update toolchain and tests #252

Merged
merged 6 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions resources/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,22 @@ 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" \
&& rustup component add rustfmt \
&& 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" \
Expand All @@ -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
8 changes: 6 additions & 2 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 1 addition & 8 deletions scripts/fetch_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<BlockRequestHeader>() 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 {
Expand All @@ -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::<BlockRequestFooter>() as u32;
d.flags = VIRTQ_DESC_F_WRITE;
Expand Down
2 changes: 1 addition & 1 deletion src/efi/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/efi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 0 additions & 12 deletions src/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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() {
Expand Down