这是indexloc提供的服务,不要输入任何密码
Skip to content
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
22 changes: 13 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
rust:
- nightly

# Minimum supported version.
# Keep this in sync with Cargo.toml and README.md
- 1.59.0

steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -23,32 +27,32 @@ jobs:
components: rust-src, rustfmt, clippy

- name: Setup QEMU
run: sudo apt-get install -y qemu-system-x86
if: ${{ matrix.rust == 'nightly' }}
run: sudo apt-get update && sudo apt-get install -y qemu-system-x86

- name: Build as x86_64
- name: Build (without testing) as x86_64
if: ${{ matrix.rust == 'nightly' }} # Tier 2 (precompiled libcore in rustup) since 1.62
uses: actions-rs/cargo@v1
with:
command: build
args: --target x86_64-unknown-none

- name: Build as i686
uses: actions-rs/cargo@v1
with:
command: build
args: --target i686-unknown-none.json

- name: Test
- name: Build and test as i686
if: ${{ matrix.rust == 'nightly' }}
uses: actions-rs/cargo@v1
with:
command: test
args: --target i686-unknown-none.json

- name: Rustfmt
if: ${{ matrix.rust == 'nightly' }}
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Clippy
if: ${{ matrix.rust == 'nightly' }}
uses: actions-rs/cargo@v1
with:
command: clippy
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ keywords = ["qemu", "fw_cfg"]
categories = ["no-std", "embedded", "hardware-support"]
readme = "README.md"

# Keep this in sync with README.md and .github/workflows/ci.yml
rust-version = "1.59"

[features]
default = ["alloc"]
alloc = []
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ if running_in_qemu() {

## Rust support

Currently, `qemu-fw-cfg` required nightly compiler to build.
<!-- Keep this in sync with Cargo.toml and .github/workflows/ci.yml -->
The minimum supported Rust version for `qemu-fw-cfg` is 1.59.0.

However, testing for x86 currently requires Rust Nightly as it uses
[Cargo’s `build-std`](https://doc.rust-lang.org/cargo/reference/unstable.html#build-std).

## License

Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly"
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl FwCfg {
const FW_CFG_FILE_SIZE: usize = 64;

/// A struct that contains information of a fw_cfg file.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FwCfgFile<'a> {
size: usize,
key: u16,
Expand Down
3 changes: 2 additions & 1 deletion tests/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![no_std]
#![no_main]
#![feature(default_alloc_error_handler)]
#![cfg_attr(feature = "alloc", feature(default_alloc_error_handler))]

use qemu_fw_cfg::FwCfg;

Expand Down Expand Up @@ -42,6 +42,7 @@ fn main() {
);

// Read file
#[cfg(feature = "alloc")]
assert_eq!(DATA_INPUT_TXT, fw_cfg.read_file(&file_input_txt));

// Read file with buffer
Expand Down