Skip to content

Build for linux/windows only from crates.io #196

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
162 changes: 152 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions framework_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,40 @@ spin = { version = "0.9.8" }
no-std-compat = { version = "0.4.1", features = [ "alloc" ] }
hidapi = { version = "2.6.3", features = [ "windows-native" ], optional = true }
rusb = { version = "0.9.4", optional = true }
guid-create = { git = "https://github.com/FrameworkComputer/guid-create", branch = "no-rand", default-features = false }

[target.'cfg(target_os = "uefi")'.dependencies]
uefi = { version = "0.20", features = ["alloc"] }
uefi-services = "0.17"
plain = "0.2.3"
redox_hwio = { git = "https://github.com/FrameworkComputer/rust-hwio", branch = "freebsd", default-features = false }
smbios-lib = { git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std", default-features = false }
redox_hwio = { version = "0.1.6", default-features = false }
smbios-lib-no-std = { package = "smbios-lib", git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std", default-features = false }
guid-create-no-std = { package = "guid-create", git = "https://github.com/FrameworkComputer/guid-create", branch = "no_std", default-features = false }

[target.'cfg(windows)'.dependencies]
wmi = "0.15.0"
smbios-lib = { git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std" }
smbios-lib = "0.9.2"
env_logger = "0.11"
clap = { version = "4.5", features = ["derive", "cargo"] }
clap-num = { version = "1.2.0" }
clap-verbosity-flag = { version = "2.2.1" }
windows-version = "0.1.4"
guid-create = "0.4.1"

[target.'cfg(unix)'.dependencies]
libc = "0.2.155"
nix = { version = "0.29.0", features = ["ioctl", "user"] }
redox_hwio = { git = "https://github.com/FrameworkComputer/rust-hwio", branch = "freebsd" }
smbios-lib = { git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std" }
smbios-lib = "0.9.2"
env_logger = "0.11"
clap = { version = "4.5", features = ["derive", "cargo"] }
clap-num = { version = "1.2.0" }
clap-verbosity-flag = { version = "2.2.1" }
guid-create = "0.4.1"

[target.'cfg(target_os="linux")'.dependencies]
redox_hwio = "0.1.6"

[target.'cfg(target_os="freebsd")'.dependencies]
redox_hwio_freebsd = { package = "redox_hwio", git = "https://github.com/FrameworkComputer/rust-hwio", branch = "freebsd" }

[target.'cfg(windows)'.dependencies.windows]
version = "0.59.0"
Expand Down
8 changes: 4 additions & 4 deletions framework_lib/src/capsule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

use std::prelude::v1::*;

use crate::guid::CGuid;
use core::prelude::rust_2021::derive;
use guid_create::Guid;
#[cfg(not(feature = "uefi"))]
use std::fs::File;
#[cfg(not(feature = "uefi"))]
Expand All @@ -21,7 +21,7 @@ use std::io::prelude::*;
#[repr(C)]
pub struct EfiCapsuleHeader {
/// A GUID that defines the contents of a capsule.
pub capsule_guid: Guid,
pub capsule_guid: CGuid,

/// The size of the capsule header. This may be larger than the size of
/// the EFI_CAPSULE_HEADER since CapsuleGuid may imply
Expand Down Expand Up @@ -205,14 +205,14 @@ mod tests {
let data = fs::read(capsule_path).unwrap();
let cap = parse_capsule_header(&data).unwrap();
let expected_header = EfiCapsuleHeader {
capsule_guid: Guid::from(esrt::WINUX_GUID),
capsule_guid: CGuid::from(esrt::WINUX_GUID),
header_size: 28,
flags: 65536,
capsule_image_size: 676898,
};
assert_eq!(cap, expected_header);

assert_eq!(cap.capsule_guid, Guid::from(esrt::WINUX_GUID));
assert_eq!(cap.capsule_guid, CGuid::from(esrt::WINUX_GUID));
let ux_header = parse_ux_header(&data);
assert_eq!(
ux_header,
Expand Down
4 changes: 3 additions & 1 deletion framework_lib/src/chromium_ec/portio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use alloc::string::ToString;
use alloc::vec;
use alloc::vec::Vec;
use core::convert::TryInto;
#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_os = "freebsd")))]
use hwio::{Io, Pio};
#[cfg(target_os = "freebsd")]
use hwio_freebsd::{Io, Pio};
#[cfg(target_os = "linux")]
use libc::ioperm;
use log::Level;
Expand Down
3 changes: 3 additions & 0 deletions framework_lib/src/chromium_ec/portio_mec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use alloc::vec::Vec;

use log::Level;

#[cfg(all(not(windows), not(target_os = "freebsd")))]
use hwio::{Io, Pio};
#[cfg(target_os = "freebsd")]
use hwio_freebsd::{Io, Pio};
#[cfg(target_os = "linux")]
use libc::ioperm;

Expand Down
Loading
Loading