From a29fffe30220ce85fc8acd10cceef0eb4fb537a8 Mon Sep 17 00:00:00 2001 From: Nick Rirush Date: Sun, 28 Oct 2018 18:11:39 +0800 Subject: [PATCH] Initialize repo --- .gitignore | 2 + Cargo.lock | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 11 +++++ rust-toolchain | 1 + src/main.rs | 18 ++++++++ x86_64-uefi.json | 26 +++++++++++ 6 files changed, 194 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 rust-toolchain create mode 100644 src/main.rs create mode 100644 x86_64-uefi.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..53eaa21 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +**/*.rs.bk diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..8c3cb4e --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,136 @@ +[[package]] +name = "bit_field" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "coonboot" +version = "0.1.0" +dependencies = [ + "uefi 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", + "uefi-alloc 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", + "uefi-exts 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", + "uefi-logger 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", + "uefi-services 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", +] + +[[package]] +name = "log" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "os_bootinfo" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rlibc" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ucs2" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "uefi" +version = "0.1.0" +source = "git+https://github.com/GabrielMajeri/uefi-rs#efacc77ebe2d62c23a06634bb28ed40d380005ca" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ucs2 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "uefi-alloc" +version = "0.1.0" +source = "git+https://github.com/GabrielMajeri/uefi-rs#efacc77ebe2d62c23a06634bb28ed40d380005ca" +dependencies = [ + "uefi 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", +] + +[[package]] +name = "uefi-exts" +version = "0.1.0" +source = "git+https://github.com/GabrielMajeri/uefi-rs#efacc77ebe2d62c23a06634bb28ed40d380005ca" +dependencies = [ + "uefi 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", + "uefi-services 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", +] + +[[package]] +name = "uefi-logger" +version = "0.1.0" +source = "git+https://github.com/GabrielMajeri/uefi-rs#efacc77ebe2d62c23a06634bb28ed40d380005ca" +dependencies = [ + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "uefi 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", +] + +[[package]] +name = "uefi-services" +version = "0.1.0" +source = "git+https://github.com/GabrielMajeri/uefi-rs#efacc77ebe2d62c23a06634bb28ed40d380005ca" +dependencies = [ + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rlibc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uefi 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", + "uefi-alloc 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", + "uefi-logger 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)", + "x86_64 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "usize_conversions" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ux" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "x86_64" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "os_bootinfo 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "usize_conversions 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ux 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed8765909f9009617974ab6b7d332625b320b33c326b1e9321382ef1999b5d56" +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" +"checksum os_bootinfo 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "66481dbeb5e773e7bd85b63cd6042c30786f834338288c5ec4f3742673db360a" +"checksum rlibc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" +"checksum ucs2 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e583483194b07714e09e7f72ae3ed447d17fe6855f66a2ccbf6751e52df82e0" +"checksum uefi 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)" = "" +"checksum uefi-alloc 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)" = "" +"checksum uefi-exts 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)" = "" +"checksum uefi-logger 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)" = "" +"checksum uefi-services 0.1.0 (git+https://github.com/GabrielMajeri/uefi-rs)" = "" +"checksum usize_conversions 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f70329e2cbe45d6c97a5112daad40c34cd9a4e18edb5a2a18fefeb584d8d25e5" +"checksum ux 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53d8df5dd8d07fedccd202de1887d94481fadaea3db70479f459e8163a1fab41" +"checksum x86_64 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2bd647af1614659e1febec1d681231aea4ebda4818bf55a578aff02f3e4db4b4" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c211d58 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "coonboot" +version = "0.1.0" +authors = ["rirush"] + +[dependencies] +uefi = { git = "https://github.com/GabrielMajeri/uefi-rs" } +uefi-alloc = { git = "https://github.com/GabrielMajeri/uefi-rs" } +uefi-exts = { git = "https://github.com/GabrielMajeri/uefi-rs" } +uefi-logger = { git = "https://github.com/GabrielMajeri/uefi-rs" } +uefi-services = { git = "https://github.com/GabrielMajeri/uefi-rs" } diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..07ade69 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +nightly \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..64a35e8 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,18 @@ +#![no_std] +#![no_main] + +extern crate uefi; +extern crate uefi_alloc; +extern crate uefi_services; +extern crate uefi_exts; +extern crate uefi_logger; + +use uefi::prelude::*; + +#[no_mangle] +pub extern "win64" fn uefi_start(image: uefi::Handle, table: SystemTable) -> Status { + uefi_services::init(&table).expect_success("Unable to initialize utilities"); + table.stdout().reset(false).expect_success("Failed to reset stdout"); + + Status::SUCCESS +} diff --git a/x86_64-uefi.json b/x86_64-uefi.json new file mode 100644 index 0000000..a6acb0d --- /dev/null +++ b/x86_64-uefi.json @@ -0,0 +1,26 @@ +{ + "llvm-target": "x86_64-pc-windows-gnu", + "env": "gnu", + "target-family": "windows", + "target-endian": "little", + "target-pointer-width": "64", + "target-c-int-width": "32", + "os": "uefi", + "arch": "x86_64", + "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "linker": "rust-lld", + "linker-flavor": "lld-link", + "pre-link-args": { + "lld-link": [ + "/Subsystem:EFI_Application", + "/Entry:uefi_start" + ] + }, + "panic-strategy": "abort", + "default-hidden-visibility": true, + "executables": true, + "position-independent-executables": true, + "exe-suffix": ".efi", + "is-like-windows": true, + "emit-debug-gdb-scripts": false + } \ No newline at end of file