pax_global_header00006660000000000000000000000064151426321450014515gustar00rootroot0000000000000052 comment=5b1a6e6727242d370701b212694ceada20c0ed61 lace-0.1.0/000077500000000000000000000000001514263214500124175ustar00rootroot00000000000000lace-0.1.0/.gitattributes000066400000000000000000000000321514263214500153050ustar00rootroot00000000000000ulib/** linguist-vendored lace-0.1.0/.github/000077500000000000000000000000001514263214500137575ustar00rootroot00000000000000lace-0.1.0/.github/copilot-instructions.md000066400000000000000000000250111514263214500205130ustar00rootroot00000000000000# Copilot Instructions for Lace ## Project Overview **Lace** is a Rust-based firmware development project focused on building bootloaders and firmware for embedded systems. The project integrates Rust code with U-Boot's C codebase through a library interface called "ulib". ### Key Components - **lace-boot**: Bootloader implementation supporting multiple platforms (sandbox, EFI, bare metal) - **lace-util**: Core utility library with hardware identification (CHID), SMBIOS parsing, EDID handling, PE image parsing, and other firmware-related utilities - **lace-platform**: Platform abstraction layer for different firmware environments - **lace-util-derive**: Procedural macros for enum utilities - **tools/**: Helper utilities (pewrap, collect-hwids, fakeedid) - **ulib/**: U-Boot C codebase (external dependency - DO NOT MODIFY) ### Build System The project uses a **Cargo workspace** for Rust code and a **custom Makefile** for lace-boot builds that integrate with U-Boot. **Two build variants exist:** - **Standard builds**: Link with ulib (U-Boot library) for full firmware functionality - **Pure builds**: Standalone Rust-only binaries (controlled by `pure` feature flag) **Supported platforms:** - `sandbox`: Native Linux binary for testing and development - `efi`: UEFI applications (efi-x86_app64, efi-x86_app32) - `metal`: Bare metal ROM images (qemu-x86) ## Code Style and Conventions ### Follow STYLE.md Rigorously The project has a detailed style guide in `STYLE.md`. Key points: #### Comments - Module-level `//!` doc comments explain purpose and design - Public items require `///` doc comments - Reference specifications when relevant (e.g., "per RFC 9562", "see SMBIOS spec §7.1") - Aim for 80 column width - **Don't comment obvious code** - comment the "why", not the "what" #### Naming - Constants: `SCREAMING_SNAKE_CASE` - Types: `PascalCase` - Functions/variables: `snake_case` - Boolean functions: prefix with `is_`, `has_`, `can_` - Use domain terminology consistently: `chid`, `smbios`, `guid`, `edid` #### Integer Constants - Avoid explicit type suffixes unless necessary - Use underscores for readability: `0x1234_5678`, `1_000_000` - Use lowercase hex (`0xabc`) for bit patterns, flags, addresses - Use decimal for counts, sizes, human-meaningful quantities - Prefer the `bitflags` crate for type-safe flag handling #### Code Organization 1. Imports at top (formatted by cargo fmt) 2. Constants next 3. Type declarations 4. Functions (public before private) 5. Tests at bottom in `#[cfg(test)] mod test` 6. **Important**: Do not rearrange existing code when making changes #### Tests - Naming: `#[test] fn test__()` - Place unit tests in `#[cfg(test)] mod test` at file bottom - Use specific assertions with context: `assert_eq!(a, b, "CHID type {} mismatch", i)` - Test happy path, edge cases, and error conditions ### Licensing All Lace code (excluding `ulib/`) uses dual licensing: **Required header for all Rust source files:** ```rust // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Name ``` **For Python/Shell scripts:** ```python #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # Copyright (C) 2025, Canonical Ltd. ``` **Note**: Files in `ulib/` use GPL-2.0+ and should not be modified as they are part of the U-Boot codebase. ## Building and Testing ### Quick Build Commands ```bash # Run all pre-commit checks (formatting, linting, compilation, and tests) pre-commit run --all-files # Format code only (if not using pre-commit) ./scripts/cargo_ci.py fmt --all # Run tests only (if not using pre-commit) ./scripts/cargo_ci.py test --workspace --exclude lace-stubble --exclude fakeedid --exclude u-boot-sys # Only run these if you modified lace-boot: # Test all board configurations (lace-boot changes only) ./scripts/test-builds.sh # Build lace-boot for specific board (lace-boot changes only) make -C lace-boot config all BOARD=sandbox make -C lace-boot config all BOARD=efi-x86_app64 ``` **Note**: Pre-commit hooks automatically run cargo fmt, cargo check, cargo clippy, and cargo test, so you typically only need to run `pre-commit run --all-files` before committing. ### CI Pipeline GitHub Actions runs four jobs: 1. **check**: `cargo check` for all workspace members 2. **fmt**: Format checking with `rustfmt` 3. **clippy**: Linting with **all warnings as errors** (`-D warnings`) 4. **test**: Unit tests ### The cargo_ci.py Wrapper The `./scripts/cargo_ci.py` wrapper is used instead of direct `cargo` commands because: - It splits packages into multiple runs to avoid Cargo feature unification issues - Use `--workspace` to run on all members, `--exclude` to skip specific crates - Always exclude `lace-boot` from most workspace commands (it has special build requirements) ## Common Issues and Workarounds ### binman Conflicts **Issue**: If you have a 'binman' tool from another source (e.g., a git binary manager), it may conflict with U-Boot's binman tool required for qemu-x86 builds. **Solution**: Remove conflicting binman from PATH or ensure U-Boot's binman (from `ulib/tools/binman`) takes precedence. ### Profile Warnings You may see warnings like: ``` warning: profiles for the non root package will be ignored, specify profiles at the workspace root ``` This is **expected** and can be ignored. The `panic = "abort"` setting is defined at workspace root in `Cargo.toml`. ### Pure vs Standard Builds - **Pure builds** are Rust-only and don't link with ulib - **Standard builds** require ulib and link with U-Boot C code - qemu-x86 **does not support pure builds** (needs ulib for startup code) - Use the `pure` feature flag to control which variant is built ### No-std Environment Most crates use `#![no_std]` as they target firmware environments: - Use `extern crate alloc;` for heap allocations - Import from `core::` instead of `std::` - `lace-util` has an optional `std` feature (default enabled) ## Domain-Specific Knowledge ### Key Concepts - **CHID (Computer Hardware ID)**: GUIDs derived from system information (SMBIOS, EDID) used for firmware updates (fwupd/LVFS) and device tree selection. Follows Microsoft's CHID specification and RFC 9562. - **SMBIOS**: System Management BIOS tables containing system information - **EDID**: Extended Display Identification Data for monitors/panels - **GUID/UUID**: Globally Unique Identifiers used throughout firmware - **DTB/FDT**: Device Tree Blob/Flattened Device Tree for hardware description - **PE Image**: Portable Executable format (used for EFI binaries) ### Critical Files to Understand - `lace-util/src/chid.rs`: CHID computation algorithm - `lace-util/src/chid_mapping.rs`: Device tree compatible string mapping - `lace-util/src/smbios.rs`: SMBIOS table parsing - `lace-util/src/edid.rs`: EDID parsing - `lace-boot/build.rs`: Build script handling different targets and ulib linking - `lace-boot/Makefile`: Complex build system integrating Cargo with U-Boot builds ## Commit Message Format Follow the conventions in `CONTRIBUTING.md`: ``` component: Short summary in imperative mood Longer explanation of what and why (not how). Wrap at 72 columns. Reference issues or specs as needed. ``` ### Component Prefixes - Crate-specific: `lace-util/chid`, `lace-boot`, `lace-platform/efi` - Repo-wide: `doc`, `ci`, `build` - Scripts: `scripts` or script name ### Rules - Capitalize first word after component prefix - Use present/imperative tense ("Add feature" not "Added feature") - First line ≤50 chars ideally, 72 max - No `Signed-off-by` (but you may GPG sign with `git commit -S`) ### Examples - `lace-util/chid: Add support for EDID panel source` - `lace-util/smbios: Fix parsing of type 3 tables` - `ci: Update Rust toolchain to 1.75` ## Development Workflow ### Making Changes 1. **Understand the codebase first** - Read related code and tests 2. **Follow the style guide** - Check `STYLE.md` and existing code patterns 3. **Add/update tests** - Unit tests in `#[cfg(test)] mod test` 4. **Run pre-commit checks before committing**: `pre-commit run --all-files` (runs formatting, linting, compilation checks, and unit tests) 5. **If you modified lace-boot**: Run `./scripts/test-builds.sh` or build specific boards with `make -C lace-boot config all BOARD=` 6. **Commit with proper message format** **Note**: Pre-commit hooks are configured in `.pre-commit-config.yaml` and run automatically on `git commit` if installed. They include cargo fmt, cargo check, cargo clippy, cargo test, and file quality checks. Always run `pre-commit run --all-files` before using **report_progress** (an internal progress-reporting command used in some automated workflows) to ensure all checks pass; if you do not use that workflow, you can ignore this part of the note. ### Before Submitting PR - [ ] Code follows STYLE.md - [ ] All files have proper license headers - [ ] Tests added for new functionality - [ ] Pre-commit hooks pass (`pre-commit run --all-files`) - [ ] Commit messages follow conventions ## Safety and Error Handling - Document safety invariants for `unsafe` blocks - Use `Result` and `Option` types appropriately - Avoid panics in production code paths (remember: `panic = "abort"`) - For `no_std` code, consider whether panics are acceptable ## Dependencies - Minimize new dependencies - Prefer well-maintained crates from the ecosystem - For `no_std` compatibility, check that dependencies support it - Use `default-features = false` where appropriate ### Common Dependencies - `zerocopy`: Zero-copy parsing of binary structures - `bitflags`: Type-safe bitfield handling - `fdt`: Flattened Device Tree parsing - `uefi`, `uefi-raw`: UEFI API bindings - `clap`: CLI argument parsing (for tools) ## Useful References - [Project Style Guide](STYLE.md) - [Contributing Guidelines](CONTRIBUTING.md) - [Canonical Rust Best Practices](https://canonical.github.io/rust-best-practices/cosmetic-discipline.html) - Microsoft CHID Specification - RFC 9562 (UUID/GUID specification) - UEFI Specification - SMBIOS Specification ## Tips for Efficient Development 1. **Use `cargo_ci.py` instead of `cargo`** directly for consistency with CI 2. **Exclude lace-boot** from most workspace commands (it has special build requirements) 3. **Read the `lace-boot/README.md`** for detailed build system documentation 4. **Check existing tests** for patterns before writing new ones 5. **Reference specifications** in comments when implementing protocols/standards 6. **Don't rearrange code** unnecessarily - preserve existing organization 7. **Think about `no_std`** - most code runs in firmware environments without a full standard library lace-0.1.0/.github/dependabot.yml000066400000000000000000000007701514263214500166130ustar00rootroot00000000000000# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only version: 2 updates: # Monitor root Cargo workspace # This will monitor the workspace members defined in the root Cargo.toml. # Note: ulib/ is not monitored as it contains no external dependencies. - package-ecosystem: "cargo" directory: "/" schedule: interval: "weekly" open-pull-requests-limit: 10 groups: minor: applies-to: version-updates update-types: - "minor" - "patch" lace-0.1.0/.github/workflows/000077500000000000000000000000001514263214500160145ustar00rootroot00000000000000lace-0.1.0/.github/workflows/pre-commit.yml000066400000000000000000000011641514263214500206150ustar00rootroot00000000000000# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only name: Pre-commit on: push: branches: [ main ] pull_request: branches: [ main ] permissions: contents: read jobs: pre-commit: name: Pre-commit checks runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable components: rustfmt, clippy - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Run pre-commit uses: pre-commit/action@v3.0.1 lace-0.1.0/.github/workflows/rust-ci.yml000066400000000000000000000030561514263214500201310ustar00rootroot00000000000000# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only name: Rust CI on: push: branches: [ main ] pull_request: branches: [ main ] env: CARGO_TERM_COLOR: always permissions: contents: read jobs: check: name: Cargo Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable - name: Run cargo check run: ./scripts/cargo_ci.py check --workspace fmt: name: Format Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable components: rustfmt - name: Check formatting run: ./scripts/cargo_ci.py fmt --all -- --check clippy: name: Clippy Lints runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable components: clippy - name: Run clippy run: ./scripts/cargo_ci.py clippy --workspace -- -D warnings test: name: Unit tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable - name: Run unit tests run: ./scripts/cargo_ci.py test --workspace lace-0.1.0/.gitignore000066400000000000000000000006611514263214500144120ustar00rootroot00000000000000# Cargo build target /target # Rust executable outputs /laceboot /laceboot-static # Rust debug files **/*.rs.bk # build-efi disk /efi.img # IDE / LSP files /compile_commands.json /workspace.code-workspace /.cache # github files (but allow workflows and dependabot config) /.github/* !/.github/workflows !/.github/dependabot.yml !/.github/copilot-instructions.md # images and EFI files /*.fd /*.img # test directories /vm /man lace-0.1.0/.pre-commit-config.yaml000066400000000000000000000030701514263214500167000ustar00rootroot00000000000000# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: trailing-whitespace exclude: ^(ulib|data/hwids)/ - id: end-of-file-fixer exclude: ^(ulib|data/hwids)/ - id: check-yaml exclude: ^(ulib|data/hwids)/ - id: check-toml - id: check-added-large-files - repo: local hooks: - id: cargo-fmt name: cargo fmt description: Format Rust code with rustfmt entry: ./scripts/cargo_ci.py fmt --all language: system types: [rust] pass_filenames: false - id: cargo-check name: cargo check description: Check that Rust code compiles entry: ./scripts/cargo_ci.py check --workspace language: system types: [rust] pass_filenames: false - id: cargo-clippy name: cargo clippy description: Run Clippy lints entry: ./scripts/cargo_ci.py clippy --workspace -- -D warnings language: system types: [rust] pass_filenames: false - id: cargo-test name: cargo test description: Run unit tests entry: ./scripts/cargo_ci.py test --workspace language: system types: [rust] pass_filenames: false - repo: https://github.com/EmbarkStudios/cargo-deny rev: 0.19.0 hooks: - id: cargo-deny args: ["--all-features", "check"] lace-0.1.0/CODE_OF_CONDUCT.md000066400000000000000000000001571514263214500152210ustar00rootroot00000000000000lace has adopted the [Ubuntu Code of Conduct](coc). [coc]: https://ubuntu.com/community/ethos/code-of-conduct lace-0.1.0/CONTRIBUTING.md000066400000000000000000000046331514263214500146560ustar00rootroot00000000000000# Contributing to lace The lace team welcomes contributions via GitHub pull requests. To get your PR merged, you need to sign [Canonical's contributor license agreement (CLA)][cla]. Please follow the project [style guide](STYLE.md) for code formatting, comments and tests. ## Commit Messages ### Format ``` component: Short summary in imperative mood Longer explanation of what and why (not how). Wrap at 72 columns. Reference issues or specs as needed. ``` ### Component prefix The component identifies which part of the codebase is affected: - For crate-specific modules, use `crate/module`: `lace-util/chid`, `lace-lib/fdt` - For top-level crate changes, use the crate name: `lace-util`, `lace-boot` - For repo-wide files, use a descriptive prefix: `doc`, `ci`, `build` - For scripts, use `scripts` or the script name: `scripts/vm-run` Examples: - `lace-util/chid.rs` → `lace-util/chid: ...` - `lace-util/src/smbios/mod.rs` → `lace-util/smbios: ...` - `lace-boot/src/main.rs` → `lace-boot: ...` - `STYLE.md`, `README.md` → `doc: ...` - `.github/workflows/` → `ci: ...` ### Rules - Capitalize the first word after the component prefix - Use present/imperative tense ("Add feature" not "Added feature") - First line ≤50 chars ideally, 72 max - Blank line between summary and body - Body wrapped at 72 columns - Do not use `Signed-off-by` - You may sign your commits (i.e. `git commit -S`) but it is not required ### Examples - `lace-util/chid: Add support for EDID panel source` - `lace-util/smbios: Fix parsing of type 3 tables` - `lace-util/lib: Refactor GUID handling for clarity` ## Development Setup This repository uses [pre-commit](https://pre-commit.com/) hooks to ensure code quality. To set up pre-commit hooks: ```bash pip install pre-commit pre-commit install ``` The hooks will run automatically on `git commit` and include: - Code formatting checks (`cargo fmt`) - Compilation checks (`cargo check`) - Lint checks (`cargo clippy`) - Unit tests (`cargo test` on most workspace crates) - General file checks (trailing whitespace, YAML/TOML syntax, etc.) **Before committing**, you can run the hooks manually to catch issues early: ```bash pre-commit run --all-files ``` If pre-commit is installed, it will automatically run on every commit and prevent commits with failing checks. This ensures all code meets quality standards before being pushed to the repository. [cla]: https://ubuntu.com/legal/contributors lace-0.1.0/COPYING.GPL-3.0.txt000066400000000000000000001045151514263214500152150ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . lace-0.1.0/COPYING.txt000066400000000000000000000431001514263214500142660ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see . Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Moe Ghoul, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. lace-0.1.0/Cargo.lock000066400000000000000000000441701514263214500143320ustar00rootroot00000000000000# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "adler2" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aho-corasick" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] [[package]] name = "anstream" version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ "windows-sys 0.61.2", ] [[package]] name = "anstyle-wincon" version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", "windows-sys 0.61.2", ] [[package]] name = "bit_field" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" [[package]] name = "bitflags" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "cfg-if" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "clap" version = "4.5.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a" dependencies = [ "clap_builder", "clap_derive", ] [[package]] name = "clap_builder" version = "4.5.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", "terminal_size", ] [[package]] name = "clap_derive" version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" dependencies = [ "heck", "proc-macro2", "quote", "syn", ] [[package]] name = "clap_lex" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "clap_mangen" version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ea63a92086df93893164221ad4f24142086d535b3a0957b9b9bea2dc86301" dependencies = [ "clap", "roff", ] [[package]] name = "collect-hwids" version = "0.1.0" dependencies = [ "clap", "lace-util", "regex", "zerocopy", "zip", ] [[package]] name = "colorchoice" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "crc32fast" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", "windows-sys 0.61.2", ] [[package]] name = "fakeedid" version = "0.1.0" dependencies = [ "uefi", ] [[package]] name = "fdt" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784a4df722dc6267a04af36895398f59d21d07dce47232adf31ec0ff2fa45e67" [[package]] name = "flate2" version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" dependencies = [ "crc32fast", "libz-rs-sys", "miniz_oxide", ] [[package]] name = "hashbrown" version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "is_terminal_polyfill" version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itoa" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "lace-platform" version = "0.1.0" dependencies = [ "bitflags", "lace-util", "lace-util-derive", "spin", "uefi", "uefi-raw", ] [[package]] name = "lace-stubble" version = "0.1.0" dependencies = [ "lace-platform", "lace-util", "uefi", ] [[package]] name = "lace-util" version = "0.1.0" dependencies = [ "fdt", "zerocopy", ] [[package]] name = "lace-util-derive" version = "0.1.0" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "libc" version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libz-rs-sys" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15413ef615ad868d4d65dce091cb233b229419c7c0c4bcaa746c0901c49ff39c" dependencies = [ "zlib-rs", ] [[package]] name = "linux-raw-sys" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "lock_api" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ "scopeguard", ] [[package]] name = "log" version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "memchr" version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miniz_oxide" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", "simd-adler32", ] [[package]] name = "once_cell_polyfill" version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "pewrap" version = "0.1.0" dependencies = [ "clap", "lace-util", "serde", "serde_json", "zerocopy", ] [[package]] name = "proc-macro2" version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "ptr_meta" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b9a0cf95a1196af61d4f1cbdab967179516d9a4a4312af1f31948f8f6224a79" dependencies = [ "ptr_meta_derive", ] [[package]] name = "ptr_meta_derive" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7347867d0a7e1208d93b46767be83e2b8f978c3dad35f775ac8d8847551d6fe1" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "quote" version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] [[package]] name = "regex" version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "roff" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3" [[package]] name = "rustix" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys 0.61.2", ] [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", "serde_derive", ] [[package]] name = "serde_core" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_json" version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", "serde", "serde_core", "zmij", ] [[package]] name = "simd-adler32" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "spin" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" dependencies = [ "lock_api", ] [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "terminal_size" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" dependencies = [ "rustix", "windows-sys 0.60.2", ] [[package]] name = "typed-path" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43ffa54726cdc9ea78392023ffe9fe9cf9ac779e1c6fcb0d23f9862e3879d20" [[package]] name = "ucs2" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df79298e11f316400c57ec268f3c2c29ac3c4d4777687955cd3d4f3a35ce7eba" dependencies = [ "bit_field", ] [[package]] name = "uefi" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71fe9058b73ee2b6559524af9e33199c13b2485ddbf3ad1181b68051cdc50c17" dependencies = [ "bitflags", "cfg-if", "log", "ptr_meta", "ucs2", "uefi-macros", "uefi-raw", "uguid", ] [[package]] name = "uefi-macros" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4687412b5ac74d245d5bfb1733ede50c31be19bf8a4b6a967a29b451bab49e67" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "uefi-raw" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f64fe59e11af447d12fd60a403c74106eb104309f34b4c6dbce6e927d97da9d" dependencies = [ "bitflags", "uguid", ] [[package]] name = "uguid" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c8352f8c05e47892e7eaf13b34abd76a7f4aeaf817b716e88789381927f199c" [[package]] name = "unicode-ident" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-sys" version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ "windows-targets", ] [[package]] name = "windows-sys" version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ "windows-link", ] [[package]] name = "windows-targets" version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ "windows-link", "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[package]] name = "windows_aarch64_msvc" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" [[package]] name = "windows_i686_gnu" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" [[package]] name = "windows_i686_gnullvm" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" [[package]] name = "windows_i686_msvc" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[package]] name = "windows_x86_64_gnu" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" [[package]] name = "windows_x86_64_gnullvm" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" [[package]] name = "windows_x86_64_msvc" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "xtask" version = "0.1.0" dependencies = [ "clap", "clap_mangen", "collect-hwids", "pewrap", ] [[package]] name = "zerocopy" version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "zip" version = "7.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc12baa6db2b15a140161ce53d72209dacea594230798c24774139b54ecaa980" dependencies = [ "crc32fast", "flate2", "indexmap", "memchr", "typed-path", ] [[package]] name = "zlib-rs" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51f936044d677be1a1168fae1d03b583a285a5dd9d8cbf7b24c23aa1fc775235" [[package]] name = "zmij" version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30e0d8dffbae3d840f64bda38e28391faef673a7b5a6017840f2a106c8145868" lace-0.1.0/Cargo.toml000066400000000000000000000004721514263214500143520ustar00rootroot00000000000000# SPDX-License-Identifier: GPL-2.0+ [workspace] resolver = "2" members = [ "lace-platform", "lace-stubble", "lace-util", "lace-util-derive", "tools/collect-hwids", "tools/fakeedid", "tools/pewrap", "tools/xtask", ] [profile.dev] panic = "abort" [profile.release] panic = "abort" lace-0.1.0/README.md000066400000000000000000000021221514263214500136730ustar00rootroot00000000000000# lace Lace is a framework for writing boot applications. The current list of applications is: * `lace-stubble` - a "stub" EFI binary that can be specialized into a bootable image by embedding resources (kernel, initrd, etc.) into PE sections. * `tools/pewrap` - a tool to wrap assets into a stubble image * `tools/collect-hwids` - a helper tool to collect hwids from a running laptop They use the following library crates: * `lace-platform` - An abstraction of the underlying platform (such as UEFI). * `lace-util` - Platform-independent utilities * `lace-util-derive` - Platform-independent macros # Contributing Lace is licensed under the GPL-2.0 or GPL-3.0. Contributions are subject to the Canonical CLA. See the file `CONTRIBUTING.md` for details. You may want to use development tools: * `scripts/cargo_ci.py` - A wrapper around cargo avoiding feature unification * `scripts/vm_manage.py` - a helper tool to setup and run test VMs * `tools/fakeedid` - a helper tool to fake some EDID data in a test VM # Discussions Feel free to join our Matrix channel: https://matrix.to/#/#lace:ubuntu.com lace-0.1.0/STYLE.md000066400000000000000000000103301514263214500136360ustar00rootroot00000000000000# Style Guide This guide covers aspects not handled by rustfmt. See also . ## Comments ### When to comment - Module-level `//!` doc comments explaining the module's purpose and design - Public items (`pub fn`, `pub struct`, `pub const`) get `///` doc comments - Complex algorithms or non-obvious logic get inline `//` comments - Constants that represent magic values or external specifications - Safety invariants for `unsafe` blocks ### When not to comment - Obvious code that reads clearly on its own - Private helper functions with self-explanatory names and few arguments - Restating what the code does rather than why ### Comment style - Aim for 80 columns - Use complete sentences with proper punctuation for doc comments - Use sentence fragments for inline comments (no trailing period for single-line) - Reference specifications (e.g., "per RFC 9562", "see SMBIOS spec §7.1") ### Doc comment structure for functions ```rust /// Verify that data matches an expected CRC32 checksum. /// /// Longer explanation if needed. /// /// # Examples /// /// ``` /// let data = [0x12, 0x34, 0x56, 0x78]; /// assert!(verify_crc32(&data, 0x114)); /// ``` fn verify_crc32(data: &[u8], expected: u32) -> bool { ... } ``` See for a fuller example (see the 'Source' link at the top). ## Tests ### Naming ```rust #[test] fn test__() { } ``` ### Structure - Place unit tests in a `#[cfg(test)] mod test` at the bottom of the file - Place larger / fuzz tests in a separate tests/ directory - Use real-world test data where possible - Comment test cases that come from external sources or known-good values ### What to test - Happy path with representative inputs - Edge cases (empty input, max values, etc.) - Error conditions (return `None`, `Err`, etc.) - Regression tests for fixed bugs ### Assertions - Use specific assertion macros (`assert_eq!`, `assert_ne!`) - Include context message: `assert_eq!(a, b, "CHID type {} mismatch", i)` ## Naming Conventions - Constants: `SCREAMING_SNAKE_CASE` - Types: `PascalCase` - Functions/variables: `snake_case` - Prefix boolean functions with `is_`, `has_`, `can_` - Use domain terminology consistently (e.g., `chid`, `smbios`, `guid`) ## Integer Constants ### Declaration Avoid specifying an explicit type for integer constants unless needed: ```rust const MAGIC: 0x1234_5678; const REG_OFFSET: u16 = 0x100; const MAX_ENTRIES: u32 = 256; ``` Use underscores to separate groups of digits for readability: ```rust const SIZE: 1_000_000; const FLAGS: 0b1010_0011; const ADDR: 0xdead_beef_cafe_babe; ``` ### Hex vs decimal - Use lower-case hex (`0xabc`) for bit patterns, flags, addresses, and hardware constants - Use decimal for counts, sizes, and human-meaningful quantities ### Type suffixes Avoid type suffixes on literals when the type is clear from context: ```rust // Preferred: type is implied by the constant const SIZE: 4096; // Avoid: redundant suffix const SIZE: u32 = 4096u32; // OK: suffix to disambiguate in expressions let x: 1_u64 << 32; // OK: rely on the inferencer to get the type right let y = 1 << 32; ``` ### Bitmasks and flags Prefer the `bitflags` crate for type-safe flag handling: ```rust use bitflags::bitflags; bitflags! { #[derive(Debug, Clone, Copy)] pub struct Permissions: u32 { const READ = 1 << 0; const WRITE = 1 << 1; const EXEC = 1 << 2; } } const DEFAULT_PERMS: Permissions = Permissions::READ.union(Permissions::WRITE); ``` ## Code Organization Remember that these are general guidelines, not fixed requirements. In some cases constants and types are better with the functions which use them. Use your discretion. When reviewing code, try to accept what is there unless you have a good reason for a change. - Imports go at the top of the file, as formatted by cargo - Constants come next (assuming they don't need a type declaration) - Type declarations after that - Functions after that - Public items before private items (but don't move functions in existing code when making them public / private) - Tests at the bottom in `mod test` - Note: Existing code should not be rearranged when making changes lace-0.1.0/data/000077500000000000000000000000001514263214500133305ustar00rootroot00000000000000lace-0.1.0/data/hwids/000077500000000000000000000000001514263214500144465ustar00rootroot00000000000000lace-0.1.0/data/hwids/finddtbs.py000077500000000000000000000025761514263214500166320ustar00rootroot00000000000000#!/usr/bin/python3 # SPDX-License-Identifier: 0BSD from pathlib import Path import json import sys import glob import libfdt def collect_compats(jsondir: Path): compats = [] json_files = jsondir.rglob('*.json') for json_file in json_files: with open(json_file, 'r', encoding='utf-8') as f: j = json.load(f) # Having FIXME! as compatible is probably an error if j['compatible'] == 'FIXME!': print("warning: {} contains \"compatible: FIXME!\"".format(json_file)); compats.append(j['compatible']) return compats def find_dtbs(dtbdir: Path, compatibles_in: list[str]): files = [] dtb_files = dtbdir.glob('**/*[!el2].dtb') for dtb_file in dtb_files: # XXX: Filter el2 with open(dtb_file, 'rb') as f: fdt = libfdt.Fdt(f.read()) root = fdt.path_offset('/') compatibles = fdt.getprop(root, 'compatible').as_stringlist() # XXX: Check duplicates? if set(compatibles_in).intersection(compatibles) != set(): files.append(dtb_file) return files jsondir = Path('./json') dtbdir = Path() if len(sys.argv) > 1: dtbdir = Path(sys.argv[1]) if len(sys.argv) > 2: jsondir = Path(sys.argv[2]) compats = collect_compats(jsondir) dtb_paths = find_dtbs(dtbdir, compats) for p in dtb_paths: print("{}".format(p)) lace-0.1.0/data/hwids/hwid2json.py000077500000000000000000000044701514263214500167370ustar00rootroot00000000000000#!/usr/bin/python3 # SPDX-License-Identifier: 0BSD from uuid import UUID from pathlib import Path from typing import * import re import json import sys guid_regexp = re.compile(r'\{[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}\}', re.I) filter_regexp = re.compile(r".*<- (Manufacturer \+ EnclosureKind|Manufacturer \+ Family|Manufacturer|Manufacturer \+ BiosVendor|Manufacturer \+ BaseboardManufacturer \+ BaseboardProduct)$") def parse_hwid_file(hwid_file: Path, inpath: Path, outpath: Path) -> None: data: dict[str, str] = { 'Manufacturer': '', 'Family': '', 'Compatible': 'FIXME!', } guids: list[UUID] = [] # Check if outpath exists and preserve Compatible try: with open(str(outpath / hwid_file.relative_to(inpath).with_suffix('.json')), 'r', encoding='utf-8') as f: j = json.load(f) data['Compatible'] = j['compatible'] except: pass content = hwid_file.open().readlines() for line in content: for k in data: if line.startswith(k): data[k] = line.split(':')[1].strip() break else: # Skip ambiguous HWIDs m = filter_regexp.match(line) if m is not None: continue guid = guid_regexp.match(line) if guid is not None: guids.append(UUID(guid.group(0)[1:-1])) for k, v in data.items(): if not v: raise ValueError(f'hwid description file "{hwid_file}" does not contain "{k}"') name = data['Manufacturer'] + ' ' + data['Family'] compatible = data['Compatible'] device = { 'type': 'devicetree', 'name': name, 'compatible': compatible, 'hwids': guids, } with open(str(outpath / hwid_file.relative_to(inpath).with_suffix('.json')), 'w', encoding='utf-8') as f: json.dump(device, f, ensure_ascii=False, indent=4, default=str) def parse_hwid_dir(inpath: Path, outpath: Path) -> None: hwid_files = inpath.rglob('*.txt') for hwid_file in hwid_files: parse_hwid_file(hwid_file, inpath, outpath) inpath = Path('./txt') outpath = Path('./json') if len(sys.argv) > 1: inpath = Path(sys.argv[1]) if len(sys.argv) > 2: outpath = Path(sys.argv[2]) parse_hwid_dir(inpath, outpath) lace-0.1.0/data/hwids/json/000077500000000000000000000000001514263214500154175ustar00rootroot00000000000000lace-0.1.0/data/hwids/json/msm8998-lenovo-miix-630-81f1.json000066400000000000000000000011251514263214500226760ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO Miix 630", "compatible": "lenovo,miix-630", "hwids": [ "16a55446-eba9-5f97-80e3-5e39d8209bc3", "c4c9a6be-5383-5de7-af35-c2de505edec8", "14f581d2-d059-5cb2-9f8b-56d8be7932c9", "a51054fb-5eef-594a-a5a0-cd87632d0aea", "307ab358-ed84-57fe-bf05-e9195a28198d", "7e613574-5445-5797-9567-2d0ed86e6ffa", "b0f4463c-f851-5ec3-b031-2ccb873a609a", "08b75d1f-6643-52a1-9bdd-071052860b33", "34df58d6-b605-50aa-9313-9b34f5c4b6fc", "e0a96696-f0a6-5466-a6db-207fbe8bae3c" ] }lace-0.1.0/data/hwids/json/sc7180-acer-aspire1.json000066400000000000000000000012001514263214500215020ustar00rootroot00000000000000{ "type": "devicetree", "name": "Acer Aspire 1", "compatible": "acer,aspire1", "hwids": [ "45d37dbe-40fb-57bd-a257-55f422d4dc0a", "373bfde5-ffaa-504c-84f3-f8f5357dfc29", "e12521bf-0ed8-5406-af87-adad812c57c5", "faa12ed4-bd49-5471-8f74-75c2267c3b46", "965e3681-de3b-5e39-bb62-7d4917d7e36f", "82fe1869-361c-56b2-b853-631747e64aa7", "7e15f49e-04b4-5d56-a567-e7a15ba2aca1", "7c107a7f-2d77-51aa-aef8-8d777e26ffbc", "68b38fff-aadc-512c-937b-99d9c13eb484", "260192d4-06d4-5124-ab46-ba210f4c14d7", "175f000b-3d05-5c01-aedd-817b1a141f93" ] }lace-0.1.0/data/hwids/json/sc8180x-lenovo-flex-5g-81xe.json000066400000000000000000000012141514263214500227560ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO Yoga 5G 14Q8CX05", "compatible": "lenovo,flex-5g", "hwids": [ "ea646c11-3da1-5c8d-9346-8ff156746650", "5100eeed-c5e2-5b74-9c24-a22ca0644826", "ddb3bcda-db7b-579d-9dd9-bcc4f5b052b8", "fb364c09-efc0-5d16-ac97-0a3e6235b16c", "7e7007ac-603c-55ef-bb77-3548784b9578", "566b9ae8-a7fd-5c44-94d6-bac3e4cf38a7", "6f3bdfb7-f832-5c5f-9777-9e3db35e22a6", "c4ea686c-c56c-5e8e-a91e-89056683d417", "a1a13249-2689-5c6d-a43f-98af040284c4", "01439aea-e75c-5fbb-8842-18dcd1a7b8b3", "65ab9f32-bbc8-52d3-87f9-b618fda7c07e" ] }lace-0.1.0/data/hwids/json/sc8180x-lenovo-flex-5g-82ak.json000066400000000000000000000012141514263214500227360ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO Flex 5G 14Q8CX05", "compatible": "lenovo,flex-5g", "hwids": [ "ad47f2e9-2f8c-5cd1-a44e-82f35a43e44e", "997c1c76-5595-5300-9f58-94d2c6ffc586", "b9bf941f-3a32-57da-b609-5fff7fb382cd", "ea658d2b-f644-555d-9b72-e1642401a795", "fb5c3077-39d5-5a44-97ce-2d3be5f6bfec", "16551bd5-37b0-571d-a94c-da61a9cfccf5", "df3ecc56-b61b-5f8e-896f-801a42b536d6", "06675172-9a6e-5276-a505-d205688a87f0", "23dcfb84-d132-5f60-878e-64fe0b9417d6", "12c0e5b0-8886-5444-b42b-93692fa736df", "39fca706-c9a2-54d4-8c7c-d5e292d0a725" ] }lace-0.1.0/data/hwids/json/sc8280xp-huawei-gaokun3.json000066400000000000000000000013461514263214500224420ustar00rootroot00000000000000{ "type": "devicetree", "name": "HUAWEI MateBook E", "compatible": "huawei,gaokun3", "hwids": [ "80c86c24-c7a7-5714-abf2-4c48f348cecc", "1c2effc1-1038-584d-ae8b-7c912c8e9504", "6eb75906-3a4e-5de4-94c5-374d8f9723e5", "4f04f31f-17f0-583f-802f-82c3a0b34128", "e1b94e53-0f20-5d01-abfc-cfb348544a31", "b866fc5c-261b-56d8-99e8-03ea0646af8f", "d8846172-f0a0-55ba-bf41-55641f588ea7", "7ea8b73b-2cbb-562b-aecc-7f0f64c42630", "3eb6683b-0153-5365-81c6-cc599783e9c7", "e5a0ed2b-7fed-5e2d-94ed-43dbaf0b9ccc", "0c78ef16-4fe0-5e33-908e-b038949ee608", "e98c95a8-b50e-5d8b-b2db-c679a39163df", "13311789-793f-5d95-942c-3b6414a8ad1a" ] }lace-0.1.0/data/hwids/json/sc8280xp-lenovo-thinkpad-x13s-21bx.json000066400000000000000000000012251514263214500242570ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO ThinkPad X13s Gen 1", "compatible": "lenovo,thinkpad-x13s", "hwids": [ "810e34c6-cc69-5e36-8675-2f6e354272d3", "f22c935e-2dc8-5949-9486-09bbf10361b2", "abdbb2cb-ab52-5674-9d0a-2e2cb69bcbb4", "ddf28a3f-43fc-54a4-a6a7-4cba5ad46b3e", "4df470e6-7878-5b0f-b2e0-733d5d9fa228", "3ad863ab-0181-5a2f-9cc1-70eedc446da9", "69c47e1e-fde2-5062-b777-acbeab73784b", "3486eccc-d0ac-534a-9e2f-a1c18bc310c6", "c869f39e-f205-5ca0-be7b-d90f90ef5556", "b470d002-ad8e-5d5c-a7bf-bb1333f2ce4b", "64b71f12-4341-5e5c-b7cd-25b6503799e3" ] }lace-0.1.0/data/hwids/json/sc8280xp-lenovo-thinkpad-x13s-21by.json000066400000000000000000000012251514263214500242600ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO ThinkPad X13s Gen 1", "compatible": "lenovo,thinkpad-x13s", "hwids": [ "b265d777-007e-56e5-b0e2-bd666ab867be", "3f9d2d91-73b2-5316-8c72-a0ecb3f0dae5", "4b189129-8eb2-585c-a1bb-a4cfc979433a", "fbf92a11-bb6f-5adb-b5a7-8abf9acbd7d9", "0909a1c3-3a02-59a0-b1ea-04f1449c104f", "69acf6bf-ed33-5806-857f-c76971d7061e", "ddfbdaa2-7c46-5103-be64-84a9f88c485f", "b41f58ed-7631-561f-9b0c-449a9c293afa", "9f47e28f-e1ee-5cb5-b4ce-8f0605752b3d", "873455fb-b2c5-5c0c-9c2c-90e80d44da57", "a1dfe209-99e5-5ff2-9922-aa4c11491b49" ] }lace-0.1.0/data/hwids/json/sc8280xp-lenovo-thinkpad-x13s-4810.json000066400000000000000000000013661514263214500241050ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO ThinkPad X13s Gen 1", "compatible": "lenovo,thinkpad-x13s", "hwids": [ "e4e1e851-389a-5be8-bc77-d32bc3e96ba2", "a84d13c1-3864-5d56-8c7c-15ad37074a3f", "6026ec60-e5e0-56bf-9d71-f3465d7314c8", "dc4ecdd0-c09b-5e84-ac5f-ccf0182e1ec6", "04392ed0-22bc-56a4-ae4e-dcb325cb6899", "6d8e538a-e089-5901-97ed-5ef670416fca", "93a4dd46-2007-56bf-b176-390519d6f5bd", "4a971ccf-1223-5f4d-b939-dcb8efc0b350", "56eafd87-9fbc-5388-a5fd-ec9a9178fb1c", "5188008f-3241-5f05-8d21-774b5c7a2887", "1305c7fb-2943-53e5-aba5-5a948d96ed94", "db1387e0-f13d-5000-889d-ff7cca53846a", "30c7a7fe-f4bf-5ce1-aad8-f5e6db904c53" ] } lace-0.1.0/data/hwids/json/sc8280xp-microsoft-blackrock.json000066400000000000000000000012271514263214500235470ustar00rootroot00000000000000{ "type": "devicetree", "name": "Microsoft Corporation Surface", "compatible": "microsoft,blackrock", "hwids": [ "69ba0503-ca94-5fa3-b78c-5fa21a66c620", "ad2ee931-a048-5253-b350-98c482670765", "5bd24fc5-5edb-51f6-82e6-31a9ef954c5b", "d67e799e-2ba7-555a-a874-a0523a8b3b11", "813677fa-6d11-5756-a44d-dde0f552d3f6", "ce83144b-b123-59e5-8a9a-0c1a13643fc4", "53b87f48-fc47-54e9-ade5-f1a95e885681", "046fefee-341b-5c40-b0a3-1c647d31b500", "f59639f4-4970-5706-9a75-519dd059f69e", "08f06457-aa19-51c5-be4c-0087ce4fa2ed", "11b80238-dbee-57bc-8b26-83c9e5b4057d" ] }lace-0.1.0/data/hwids/json/sc8280xp-microsoft-surface-pro-9-5G.json000066400000000000000000000012241514263214500244560ustar00rootroot00000000000000{ "type": "devicetree", "name": "Microsoft Corporation Surface", "compatible": "microsoft,arcata", "hwids": [ "e3d941fa-2bfa-5875-8efd-87ce997f8338", "a659ee2b-502d-50f7-9921-bdbd34734e0b", "5caa88bc-ea9b-5d73-a69a-89024bfff854", "c0cf7078-c325-5cf6-966b-3bbbc155275b", "6309fbb9-68f4-54f9-bbc9-b3ca9685b48c", "9d70dcfd-f56b-58bf-b1bd-a1b8f2b0ec7e", "9bac72c6-83f6-5e21-af8e-bc1f5c2b7cc8", "94fb24a7-ff7a-5d70-9ac8-518a9e44ea64", "009d2337-4f76-514e-b2c1-b2816447b048", "3a486e6f-3b0a-5603-a483-503381d3d8c3", "636b6071-7848-50d5-b0b5-6290c49e9306" ] }lace-0.1.0/data/hwids/json/sdm850-lenovo-yoga-c630.json000066400000000000000000000012151514263214500222370ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO YOGA C630-13Q50", "compatible": "lenovo,yoga-c630", "hwids": [ "b8c71349-3669-56f3-99ee-ae473a2edd96", "d17c132e-f06e-5e38-8084-9cd642dd9b34", "8f56cf17-7bdd-5414-832d-97cd26837114", "b323d38a-88c6-5cf6-af0d-0db3f3c2560d", "43b71948-9c47-5372-a5cb-18db47bb873f", "67a23be6-42a6-5900-8325-847a318ce252", "94f73d29-3981-59a8-8f25-214f84d1522a", "5ca3cf2b-d6e9-5b54-93f7-1cebd7b3704f", "81f308c0-db65-50c2-a660-52e06fc0ff9f", "30b031c0-9de7-5d31-a61c-dee772871b7d", "382926c0-ce35-53af-8ff9-ca9cc06cfc7b" ] }lace-0.1.0/data/hwids/json/x1e001de-devkit.json000066400000000000000000000006351514263214500210310ustar00rootroot00000000000000{ "type": "devicetree", "name": "Qualcomm SCP_HAMOA", "compatible": "qcom,x1e001de-devkit", "hwids": [ "baa7a649-12d8-56c7-93c5-a4e10f4852be", "c8e75ab8-555c-5952-a3e3-5b607bea031d", "4bb05d50-6c4f-525d-a9ec-8924afd6edea", "830bd4a2-2498-55cf-b561-48f7dc5f4820", "f37dc44b-0be4-5a70-86bd-81f3dacff2e9", "9cba20d0-17ad-559f-94cd-cfcbbf5f71f5" ] }lace-0.1.0/data/hwids/json/x1e78100-lenovo-thinkpad-t14s-lcd.json000066400000000000000000000011001514263214500240300ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO ThinkPad T14s Gen 6 (LCD)", "compatible": "lenovo,thinkpad-t14s-lcd", "hwids": [ "83579fdf-8faf-57b4-b265-d2e817c7cf3f", "b0e14398-0a96-5736-840b-7349e5c0b85c", "53b6927f-d6ca-5674-a0e8-a50a989d4ba0", "a8852b56-45ea-5377-ba2d-1910a5c897bb", "1538c7fb-26b6-5144-b16f-2500b5a0a503", "1480f3ca-b01a-5d7c-bbc9-7a17d7b4b58d", "48a732b5-3989-5ac3-b661-516a46f00792", "2b1b6e68-cee9-549b-b8ae-10c274b8c3a6", "a07b8e34-d6b6-58b2-9963-38216ec67159" ] } lace-0.1.0/data/hwids/json/x1e78100-lenovo-thinkpad-t14s-oled.json000066400000000000000000000006621514263214500242250ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO ThinkPad T14s Gen 6 (OLED)", "compatible": "lenovo,thinkpad-t14s-oled", "hwids": [ "27378ce5-d999-5c3b-acde-0404805afd3b", "7c09107d-0ac3-5582-837f-c614d518cf62", "77ffaabe-038a-550f-b6ea-485dc49d4b45", "e78c4e7a-68c3-5b29-b2a0-dbd2785e28cd", "c012b92d-a6a6-57fa-ba06-4f3062d891d4", "08ba7f5b-8136-5938-835a-fd99143d34a5" ] } lace-0.1.0/data/hwids/json/x1e78100-lenovo-thinkpad-t14s.json000066400000000000000000000025521514263214500233040ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO ThinkPad T14s Gen 6", "compatible": "lenovo,thinkpad-t14s-lcd", "hwids": [ "c81fee2f-cf41-5d5a-8c7b-afd6585b1d81", "a9b59fea-e841-508a-a245-3a2d8d2802de", "74593764-b6b9-58e9-bedc-93ebbb1eb057", "e5d83424-0ecb-5632-b7b1-500f04e82725", "76032e78-67a8-5dab-8512-157bfcfb8f75", "dd83478e-e01b-5631-ae74-92ae275a9b4e", "791ecd9d-1547-58e6-b72a-5ce417b729dd", "8c602147-5363-5374-859e-8b7fe2d4d3ce", "498d60ae-9b1d-5b67-8abd-af571babfa94", "acbac5af-aa6a-5690-88f3-e910f04a7ead", "5180bc01-5d18-5870-b955-969da38b2647", "19b622ef-27fe-5c2e-bc53-13a79b862c65", "ac09e50f-9b3b-53c0-9752-377c3a0baaa0", "1d9f3ebb-96de-5dd6-8c88-38308b0c1c44", "578dd7d5-5871-5bd5-92a9-be07f1067b92", "ed647f93-3075-598b-9d89-d0f30ec11707", "f6cd4a9f-9632-516e-b748-65952f7380c5", "a5a4e3c1-5922-5ed6-b78e-9f0ea873a988", "a20ae3ec-49a1-5cb5-acb8-5d31c77b105a", "8cfd85bb-0d77-59df-8546-264239be475e", "513976f8-3f51-5b42-9ae0-931ce23c5f38", "86a0d770-3ca1-57fa-ac05-413481c00a24", "5c20e964-d530-5dd7-9efd-4aed9e73c3cb", "d93b21c0-5ed9-5955-911a-5b15f114d786", "82fa4a02-8c3c-55f9-b0c9-e8feb669fd3a", "34e7fadd-9c7d-5f91-ba7f-cedb04d59b9a" ] } lace-0.1.0/data/hwids/json/x1e80100-asus-vivobook-s15.json000066400000000000000000000014001514263214500226060ustar00rootroot00000000000000{ "type": "devicetree", "name": "ASUSTeK COMPUTER INC. ASUS Vivobook S 15", "compatible": "asus,vivobook-s15", "hwids": [ "6d634332-21fc-57c8-bc6b-e0f800f69f95", "d0fce8d6-a709-5bf0-8be0-6ac6ab44b8e0", "80430e03-90f0-5355-84b2-28fb17367203", "fa342b0a-9e22-541f-8e95-93106778f97d", "137a5f94-8fcf-5581-8ac6-70d50fdba4a6", "3a3ef092-d5f1-5d4d-acea-70b38ef56e53", "a6debedb-f954-5aa1-8260-4dc3b567c95f", "f3a6ca3e-4791-5bb0-915e-0b31856ec19c", "4262e277-58d3-5ac4-9858-c0751ad06f5c", "f54cd4e6-3666-5b56-abd3-a5f2df50c534", "807fe49f-cfd2-537d-b635-47bec9e36baf", "c71e903b-4255-56cb-b961-a8f87b452cbe", "1b6a0689-3f70-57e0-8bf3-39a8a74213e8" ] }lace-0.1.0/data/hwids/json/x1e80100-asus-zenbook-a14-oled.json000066400000000000000000000003741514263214500233260ustar00rootroot00000000000000{ "type": "devicetree", "name": "ASUSTeK COMPUTER INC. ASUS Zenbook A14", "compatible": "asus,zenbook-a14-ux3407qa-oled", "hwids": [ "f84ba711-7075-5c1b-a03c-57d2521a1ac2", "91971b38-ae5d-5e14-9f44-7c0316710593" ] } lace-0.1.0/data/hwids/json/x1e80100-asus-zenbook-a14.json000066400000000000000000000014071514263214500224030ustar00rootroot00000000000000{ "type": "devicetree", "name": "ASUSTeK COMPUTER INC. ASUS Zenbook A14", "compatible": "asus,zenbook-a14-ux3407ra", "hwids": [ "c41d2cda-fda7-522c-b1a7-4a835c15c43d", "0bfddfaf-e393-5dfe-a805-39b8b1098c81", "f0bb1cd4-995a-5c90-946b-9bb958f35f42", "2d610a5e-ef69-5e60-b15e-7786d0ebd79e", "6f892377-a51e-5f99-a363-b79f28fc55f9", "0c3f5e9c-eddb-5ba2-88ee-06ae0221a53d", "20b8b77d-e450-550b-b1ff-55d3317f59a6", "24652d54-00f4-59ae-96fb-f7adbfa4a939", "5c9fc73f-f915-52bf-a82d-9c7fe2274ecc", "3884ad58-4d63-589a-be98-b8ab1ddf3b93", "cedbcc19-3a5a-5bae-9973-f8e158188de7", "1f2f1045-a811-5e42-b31e-b433e384fc79", "b307ab54-c79d-58ca-a3b2-d1b1e325bfc3" ] } lace-0.1.0/data/hwids/json/x1e80100-crd.json000066400000000000000000000010521514263214500201440ustar00rootroot00000000000000{ "type": "devicetree", "name": "Qualcomm SCP_HAMOA", "compatible": "qcom,x1e80100-crd", "hwids": [ "e73870a5-90e8-528d-93fd-3da59f78df18", "2405af0b-d21d-5196-a228-4acffe7b3a10", "8fa88c58-23eb-5aea-9ea7-c4a98ded7352", "7faef667-9eb2-53f4-9764-26fe0e92fbff", "b6d4eee8-30f3-564a-8246-e83935cf8dbb", "4bb05d50-6c4f-525d-a9ec-8924afd6edea", "339fc6d2-e0f4-5226-9dd9-62c4dc41881d", "d52e3fb6-202c-5cfa-a27c-e3ffe15339fb", "361b3d63-be90-52c2-8798-a05fbd68b773" ] }lace-0.1.0/data/hwids/json/x1e80100-dell-inspiron-14-plus-7441.json000066400000000000000000000013641514263214500237610ustar00rootroot00000000000000{ "type": "devicetree", "name": "Dell Inc. Inspiron", "compatible": "dell,inspiron-14-plus-7441", "hwids": [ "4689ccaf-4f31-5146-887f-ca965da0f28a", "e4c9fe83-73ba-5160-bc18-57d4a98e960d", "efc06900-f603-5944-88e5-4de722816f91", "90117b25-1646-515b-bfeb-286e74f2a1e8", "c1190be1-8ed5-50f1-9097-2a73ad9c4eb1", "0d9ce3bc-620c-5209-9e82-7382cb6cffcd", "ff394805-0b5f-52f6-9e1d-afb1d2bee411", "07c6477a-7ef7-56c7-91d9-73d23295b0c0", "a66b1244-0027-5451-a96a-dfcfc42ab892", "ef84110e-bd09-5f0f-a3dd-7995b4a3a706", "07c6bbd9-caf8-5025-84d8-4efdb790f663", "bea2e67a-b660-5044-8acd-0d28e8c2e974", "8548ce7c-fdf3-55d0-95ba-606ca8db50da" ] } lace-0.1.0/data/hwids/json/x1e80100-dell-latitude-7455.json000066400000000000000000000011331514263214500225270ustar00rootroot00000000000000{ "type": "devicetree", "name": "Dell Inc. Latitude", "compatible": "dell,latitude-7455", "hwids": [ "903e3a6f-e14b-5643-9d55-244f917aadb6", "59e5c810-9e60-5a89-8665-db36c56b34d6", "2b9277cd-85b1-51ee-9a38-d477632532da", "6e01222b-b2aa-531e-b95f-0e4b2a063364", "93055898-8c85-50e7-adde-8115f194579a", "b3e5b59d-84ae-597d-9222-8a4d48480bc3", "4f73f73b-e639-5353-bbf7-d851e48f18fc", "68822228-a3e0-5b12-942d-9408751405d1", "683e4579-8440-5bc1-89ac-dfcd7c25b307", "fb7493ec-9634-5c5a-9f26-69cbf9b92460" ] }lace-0.1.0/data/hwids/json/x1e80100-dell-xps13-9345.json000066400000000000000000000012031514263214500216700ustar00rootroot00000000000000{ "type": "devicetree", "name": "Dell Inc. XPS", "compatible": "dell,xps13-9345", "hwids": [ "eedeb5d9-1a0e-56e6-9137-eb6a723e58d1", "1eb87d70-2f37-5f18-85de-30e46c17d540", "1d1baf60-e2f3-5821-9d98-19a131bf8d93", "7c7c2920-cb59-56ad-bc8a-939e803b0192", "940c6349-f0a5-54ba-8deb-10e709e0b76c", "3b9a1d76-f2e8-52e8-84de-14c5942b3d41", "3c2649a7-2275-5130-a0c4-cc5f9809a2c1", "36e8dd88-512d-5a74-86a4-039333f9e15a", "e656b5f2-69c3-55da-bf22-4dd58d5f6d4f", "bc685cec-e979-5cb9-bf02-e15586c7cb4b", "81972cb8-6fc7-5e08-b140-b0063ed4fefa" ] }lace-0.1.0/data/hwids/json/x1e80100-hp-elitebook-ultra-g1q.json000066400000000000000000000013771514263214500236030ustar00rootroot00000000000000{ "type": "devicetree", "name": "HP 103C_5336AN HP EliteBook Ultra", "compatible": "hp,elitebook-ultra-g1q", "hwids": [ "ba2ddd3d-a06b-5b1f-9b2a-ce58f748486c", "9145c311-f1b1-5f0f-902d-f6828baf8c46", "5275e89b-e839-589e-9e90-e1bd6854255b", "7bfc4a0e-15c1-58b3-b27b-4e5f60d4397e", "a3c9ef57-67ab-5f75-a4cb-48cb7475b025", "72a81f9e-c30b-5bf0-8449-948f8e593e92", "829d699c-f082-5835-967a-8e7022cb20b5", "25f49237-b3b4-58b2-9e58-6cc379781901", "07be634a-0442-51fb-8a77-ecb370b5262b", "e4944bcc-a1c3-540e-b400-cd91953b7ba9", "ec4cdb9c-e6ff-581c-ac22-d597b5e880a2", "b7f376e9-f5f8-5718-b00e-6bd7c265aeab", "5473ba61-2807-585b-b2ac-f0366d84bdc0" ] } lace-0.1.0/data/hwids/json/x1e80100-hp-omnibook-x14.json000066400000000000000000000011421514263214500222300ustar00rootroot00000000000000{ "type": "devicetree", "name": "HP 103C_5335M8 HP OmniBook X", "compatible": "hp,omnibook-x14", "hwids": [ "045dfd0f-068b-5e57-86bd-f41b4b906006", "ca5dab4f-a301-53c6-b753-c2db56172e0a", "811126e6-4aee-5f9e-827d-d0f12f6a6f00", "6a4511bc-0a3b-5b10-9c8b-dbcb834ecd83", "abb2ffec-2acd-5750-8dfd-c3845fd4bf2a", "1a192aee-2cfd-5ab5-95f9-8093218a48ef", "eaab52c6-ed22-5e1b-b788-fc5a0531291d", "848aeb1d-302b-5b6b-9109-0f4632535915", "54500b82-f7ae-592d-ae68-8c8e362a1475", "68d24be5-01b6-5d88-83fb-df2bcfa879aa" ] }lace-0.1.0/data/hwids/json/x1e80100-lenovo-yoga-slim7x.json000066400000000000000000000012221514263214500230530ustar00rootroot00000000000000{ "type": "devicetree", "name": "LENOVO Yoga Slim 7 14Q8X9", "compatible": "lenovo,yoga-slim7x", "hwids": [ "3fb1e5ba-05cd-5153-ad64-1d8bc6dc7a1b", "d99f6cb2-4a96-5e4a-8e29-19d52dfc2870", "6d53c38f-6adb-578b-a418-2abda4d8485d", "8073dbed-501f-5f5e-a619-4cdd9c00e865", "d27cf20e-e185-578e-bd46-f4cc3a718bb2", "8477f828-512b-56cf-af55-c711a6831551", "f7f92b85-ff01-5e93-a453-c7f91029aa55", "0700776d-0de7-5ea7-b9bf-77e0454d35e1", "ee39b629-4187-5ff7-84c0-e354555562cd", "fdb12a4f-1e8b-524e-97b5-feef23a8a8da", "63429d43-c970-570d-aaa7-54300924e0c5" ] }lace-0.1.0/data/hwids/json/x1e80100-microsoft-denali.json000066400000000000000000000013641514263214500226410ustar00rootroot00000000000000{ "type": "devicetree", "name": "Microsoft Corporation Surface", "compatible": "microsoft,denali", "hwids": [ "66f9d954-5c66-5577-b3e4-e3f14f87d2ff", "5a384f15-464d-5da8-9311-a2c021759afc", "14b96570-4bc4-541a-9aef-1b7e2b61d7cd", "aca467c0-5fc2-59ad-8ed5-1b7a0988d11c", "95971fb3-d478-591f-9ea3-eb0af0d1dfb5", "c9c14db9-2b61-597a-a4ba-84397fe75f63", "7cef06f5-e7e6-56d7-b123-a6d640a5d302", "48b86a5e-1955-5799-9577-150f9e1a69e4", "06128fee-87dc-50f6-8a3f-97cd9a6d8bf6", "84b2e1d1-e695-5f41-8c41-cf1f059c616a", "16a47337-1f8b-5bd3-b3bd-8e50b31cb1c9", "01bf1e61-d2e0-518b-bb46-eb4d1f2b1af1", "584a5084-15f2-5d20-917b-57f299e61f7e" ] }lace-0.1.0/data/hwids/json/x1e80100-microsoft-romulus13.json000066400000000000000000000013701514263214500232540ustar00rootroot00000000000000{ "type": "devicetree", "name": "Microsoft Corporation Surface", "compatible": "microsoft,romulus13", "hwids": [ "4ecd5e53-42ea-51a3-9602-aecdfee5c09d", "53368ca9-12d5-5ee1-820b-ce979fa2cb0b", "cb196e28-20bc-5e78-93f1-0ac41726bcf8", "fdfca0f3-41b6-5872-a2ea-53539fd5160c", "11696377-327d-5ad1-b01d-02a7dbb9b99a", "892e90c9-31e3-5131-a217-a02632dba5e9", "786c71b6-f60e-51c7-9ddc-f2999b75a3c5", "f0d12ad9-f530-5b56-96d8-897dd704059e", "3c329240-a447-5ec5-b79b-d1149420ac62", "224ba2ff-14c1-5b33-ac10-079ccc217be2", "924900a0-9be2-53ca-90d7-b0e38827f5c5", "95c06fde-19b0-55dc-9ca6-55403bae23f5", "c735618b-d526-5f71-9651-8d149340d620" ] } lace-0.1.0/data/hwids/json/x1e80100-microsoft-romulus15.json000066400000000000000000000013701514263214500232560ustar00rootroot00000000000000{ "type": "devicetree", "name": "Microsoft Corporation Surface", "compatible": "microsoft,romulus15", "hwids": [ "e56cd9fa-d992-5947-9f80-82345827e8e6", "e1fbd53f-3738-5fa6-aa7b-5ae319663d6b", "e4cef54f-d5b2-56b1-8aa0-07b48c3deedf", "ebce3085-12c1-58f3-9456-ccdf741a1538", "f91b1a95-926c-5fd7-9826-4a101e142f97", "892e90c9-31e3-5131-a217-a02632dba5e9", "27ec66e4-3f81-5c06-997e-e1ea0a98b8a1", "90482ef5-831d-5069-8d40-92d339a75c77", "3c329240-a447-5ec5-b79b-d1149420ac62", "224ba2ff-14c1-5b33-ac10-079ccc217be2", "924900a0-9be2-53ca-90d7-b0e38827f5c5", "109cd8d8-6086-50b6-9c2d-d0aca0f418da", "c735618b-d526-5f71-9651-8d149340d620" ] } lace-0.1.0/data/hwids/json/x1p42100-asus-zenbook-a14.json000066400000000000000000000014131514263214500224110ustar00rootroot00000000000000{ "type": "devicetree", "name": "ASUSTeK COMPUTER INC. ASUS Zenbook A14", "compatible": "asus,zenbook-a14-ux3407qa-lcd", "hwids": [ "c6d100b1-9de7-5636-a3cc-f28fa46fb926", "85f50d27-f4cb-54df-9aae-f6f09700b132", "8a72a2ea-3971-55e3-b982-cb6b82868f0e", "a034eff6-2891-5de0-b0db-9c5ff350b968", "a5b5becc-2a55-5017-b159-087f3846da26", "59793319-4344-5755-9194-17f29f030d5d", "14643426-35fa-5a20-bc31-3b6095d2b451", "24652d54-00f4-59ae-96fb-f7adbfa4a939", "a8425d85-573a-56f8-9d9d-98a196d712fa", "7e6d3df4-bf5f-59ab-ad7b-e00677c0ae5a", "00bc5418-646d-5bab-b772-4efb06f4e7f1", "3ca4e2d9-50df-51a5-a87f-4636d425e97d", "0b8b84da-462b-5620-bdb5-70272e0ddd94" ] } lace-0.1.0/data/hwids/json/x1p42100-hp-omnibook-x14.json000066400000000000000000000011471514263214500222460ustar00rootroot00000000000000{ "type": "devicetree", "name": "HP 103C_5335M8 HP OmniBook X", "compatible": "hp,omnibook-x14-fe1", "hwids": [ "3fdb269e-c359-5004-b4e3-8541ef3580c9", "29a43fda-41e4-5db5-b6d3-012d0674d84f", "9c3e4a5b-8fa2-5045-9c4f-441307fa3b08", "271cca67-bd9e-5dd6-8e5f-b5f6b969da97", "612e268b-1233-5af6-b478-5596d3573d35", "1d8361a7-1b3a-5915-8a35-03a3c1cf9c2e", "6fe7a469-b01a-5530-9a34-2dd089e0e006", "5120f011-8f7e-5ca5-9143-de545e288712", "d4db0558-de1b-562b-bc23-3e0caadd4c94", "38e7030f-993f-5bda-9ce8-ae13a13d7b5a" ] } lace-0.1.0/data/hwids/json/x1p64100-acer-swift-sf14-11.json000066400000000000000000000013521514263214500224520ustar00rootroot00000000000000{ "type": "devicetree", "name": "Acer Swift 14 AI", "compatible": "acer,swift-sf14-11", "hwids": [ "27d2dba8-e6f1-5c19-ba1c-c25a4744c161", "676172cd-d185-53ed-aac6-245d0caa02c4", "20c2cf2f-231c-5d02-ae9b-c837ab5653ed", "f2ea7095-999d-5e5b-8f2a-4b636a1e399f", "331d7526-8b88-5923-bf98-450cf3ea82a4", "98ad068a-f812-5f13-920c-3ff3d34d263f", "3f49141c-d8fb-5a6f-8b4a-074a2397874d", "7c107a7f-2d77-51aa-aef8-8d777e26ffbc", "6a12c9bc-bcfa-5448-9f66-4159dbe8c326", "f55122fb-303f-58bc-b342-6ef653956d1d", "ee8fa049-e5f4-51e4-89d8-89a0140b8f38", "058c0739-1843-5a10-bab7-fae8aaf30add", "100917f4-9c0a-5ac3-a297-794222da9bc9" ] } lace-0.1.0/data/hwids/txt/000077500000000000000000000000001514263214500152655ustar00rootroot00000000000000lace-0.1.0/data/hwids/txt/msm8998-lenovo-miix-630-81f1.txt000066400000000000000000000034231514263214500224150ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: 8WCN25WW Manufacturer: LENOVO Family: Miix 630 ProductName: 81F1 ProductSku: LENOVO_MT_81F1_BU_idea_FM_Miix 630 EnclosureKind: 32 BaseboardManufacturer: LENOVO BaseboardProduct: LNVNB161216 Hardware IDs ------------ not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown {16a55446-eba9-5f97-80e3-5e39d8209bc3} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {c4c9a6be-5383-5de7-af35-c2de505edec8} <- Manufacturer + Family + ProductName + ProductSku {14f581d2-d059-5cb2-9f8b-56d8be7932c9} <- Manufacturer + Family + ProductName {a51054fb-5eef-594a-a5a0-cd87632d0aea} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {307ab358-ed84-57fe-bf05-e9195a28198d} <- Manufacturer + ProductSku {7e613574-5445-5797-9567-2d0ed86e6ffa} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {b0f4463c-f851-5ec3-b031-2ccb873a609a} <- Manufacturer + ProductName {08b75d1f-6643-52a1-9bdd-071052860b33} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {dacf4a59-8e87-55c5-8b93-6912ded6bf7f} <- Manufacturer + Family {d0a8deb1-4cb5-50cd-bdda-595cfc13230c} <- Manufacturer + EnclosureKind {71d86d4d-02f8-5566-a7a1-529cef184b7e} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer Extra Hardware IDs ------------------ {34df58d6-b605-50aa-9313-9b34f5c4b6fc} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {e0a96696-f0a6-5466-a6db-207fbe8bae3c} <- Manufacturer + Family + ProductName + BiosVendor {99431f53-09a1-5869-be79-65e2fa3f341d} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/sc7180-acer-aspire1.txt000066400000000000000000000035131514263214500212270ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Phoenix BiosVersion: V1.13 BiosMajorRelease: 1 BiosMinorRelease: 13 FirmwareMajorRelease: 01 FirmwareMinorRelease: 07 Manufacturer: Acer Family: Aspire 1 ProductName: Aspire A114-61 ProductSku: EnclosureKind: a BaseboardManufacturer: S7C BaseboardProduct: Daisy_7C Hardware IDs ------------ {45d37dbe-40fb-57bd-a257-55f422d4dc0a} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {373bfde5-ffaa-504c-84f3-f8f5357dfc29} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {e12521bf-0ed8-5406-af87-adad812c57c5} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {faa12ed4-bd49-5471-8f74-75c2267c3b46} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {965e3681-de3b-5e39-bb62-7d4917d7e36f} <- Manufacturer + Family + ProductName + ProductSku {82fe1869-361c-56b2-b853-631747e64aa7} <- Manufacturer + Family + ProductName {7e15f49e-04b4-5d56-a567-e7a15ba2aca1} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {7c107a7f-2d77-51aa-aef8-8d777e26ffbc} <- Manufacturer + ProductSku {68b38fff-aadc-512c-937b-99d9c13eb484} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {260192d4-06d4-5124-ab46-ba210f4c14d7} <- Manufacturer + ProductName {175f000b-3d05-5c01-aedd-817b1a141f93} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {24277a94-7064-500f-9854-5264f20cfa99} <- Manufacturer + Family {92dcc94d-48f7-5ee8-b9ec-a6393fb7a484} <- Manufacturer + EnclosureKind {d234a917-df0b-5453-a3d9-f27c06307395} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {1e301734-5d49-5df4-9ed2-aa1c0a9dddda} <- Manufacturer lace-0.1.0/data/hwids/txt/sc8180x-lenovo-flex-5g-81xe.txt000066400000000000000000000036051514263214500225000ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: EACN41WW(V1.13) BiosMajorRelease: 1 BiosMinorRelease: 41 FirmwareMajorRelease: 01 FirmwareMinorRelease: 29 Manufacturer: LENOVO Family: Yoga 5G 14Q8CX05 ProductName: 81XE ProductSku: LENOVO_MT_81XE_BU_idea_FM_Yoga 5G 14Q8CX05 EnclosureKind: 1f BaseboardManufacturer: LENOVO BaseboardProduct: LNVNB161216 Hardware IDs ------------ {ea646c11-3da1-5c8d-9346-8ff156746650} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {5100eeed-c5e2-5b74-9c24-a22ca0644826} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {ddb3bcda-db7b-579d-9dd9-bcc4f5b052b8} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {fb364c09-efc0-5d16-ac97-0a3e6235b16c} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {7e7007ac-603c-55ef-bb77-3548784b9578} <- Manufacturer + Family + ProductName + ProductSku {566b9ae8-a7fd-5c44-94d6-bac3e4cf38a7} <- Manufacturer + Family + ProductName {6f3bdfb7-f832-5c5f-9777-9e3db35e22a6} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {c4ea686c-c56c-5e8e-a91e-89056683d417} <- Manufacturer + ProductSku {a1a13249-2689-5c6d-a43f-98af040284c4} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {01439aea-e75c-5fbb-8842-18dcd1a7b8b3} <- Manufacturer + ProductName {65ab9f32-bbc8-52d3-87f9-b618fda7c07e} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {41ba2569-88df-57d4-b5e3-350ff985434a} <- Manufacturer + Family {32b7e294-a252-5a72-b3c6-6197f08c64f1} <- Manufacturer + EnclosureKind {71d86d4d-02f8-5566-a7a1-529cef184b7e} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer lace-0.1.0/data/hwids/txt/sc8180x-lenovo-flex-5g-82ak.txt000066400000000000000000000036061514263214500224610ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: EACN43WW(V1.15) BiosMajorRelease: 1 BiosMinorRelease: 43 FirmwareMajorRelease: 01 FirmwareMinorRelease: 2b Manufacturer: LENOVO Family: Flex 5G 14Q8CX05 ProductName: 82AK ProductSku: LENOVO_MT_82AK_BU_idea_FM_Flex 5G 14Q8CX05 EnclosureKind: 1f BaseboardManufacturer: LENOVO BaseboardProduct: LNVNB161216 Hardware IDs ------------ {ad47f2e9-2f8c-5cd1-a44e-82f35a43e44e} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {997c1c76-5595-5300-9f58-94d2c6ffc586} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {b9bf941f-3a32-57da-b609-5fff7fb382cd} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {ea658d2b-f644-555d-9b72-e1642401a795} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {fb5c3077-39d5-5a44-97ce-2d3be5f6bfec} <- Manufacturer + Family + ProductName + ProductSku {16551bd5-37b0-571d-a94c-da61a9cfccf5} <- Manufacturer + Family + ProductName {df3ecc56-b61b-5f8e-896f-801a42b536d6} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {06675172-9a6e-5276-a505-d205688a87f0} <- Manufacturer + ProductSku {23dcfb84-d132-5f60-878e-64fe0b9417d6} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {12c0e5b0-8886-5444-b42b-93692fa736df} <- Manufacturer + ProductName {39fca706-c9a2-54d4-8c7c-d5e292d0a725} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {6e266ee4-0ba4-561c-9758-9fd4876af2e2} <- Manufacturer + Family {32b7e294-a252-5a72-b3c6-6197f08c64f1} <- Manufacturer + EnclosureKind {71d86d4d-02f8-5566-a7a1-529cef184b7e} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer lace-0.1.0/data/hwids/txt/sc8280xp-huawei-gaokun3.txt000066400000000000000000000042031514263214500221510ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: HUAWEI BiosVersion: 2.16 BiosMajorRelease: 2 BiosMinorRelease: 16 FirmwareMajorRelease: 02 FirmwareMinorRelease: 10 Manufacturer: HUAWEI Family: MateBook E ProductName: GK-W7X ProductSku: C233 EnclosureKind: 20 BaseboardManufacturer: HUAWEI BaseboardProduct: GK-W7X-PCB Hardware IDs ------------ {80c86c24-c7a7-5714-abf2-4c48f348cecc} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {1c2effc1-1038-584d-ae8b-7c912c8e9504} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {6eb75906-3a4e-5de4-94c5-374d8f9723e5} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {4f04f31f-17f0-583f-802f-82c3a0b34128} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {e1b94e53-0f20-5d01-abfc-cfb348544a31} <- Manufacturer + Family + ProductName + ProductSku {b866fc5c-261b-56d8-99e8-03ea0646af8f} <- Manufacturer + Family + ProductName {d8846172-f0a0-55ba-bf41-55641f588ea7} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {7ea8b73b-2cbb-562b-aecc-7f0f64c42630} <- Manufacturer + ProductSku {3eb6683b-0153-5365-81c6-cc599783e9c7} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {e5a0ed2b-7fed-5e2d-94ed-43dbaf0b9ccc} <- Manufacturer + ProductName {0c78ef16-4fe0-5e33-908e-b038949ee608} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {8187555f-3681-5463-a0fa-e6b74e49d4c1} <- Manufacturer + Family {39bed59d-bfe0-5938-9a76-b2f4739af786} <- Manufacturer + EnclosureKind {c562b393-1c28-5cc3-a77c-c13c798e5698} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {0df4aa3f-2706-51d4-9296-80119e47f1e1} <- Manufacturer Extra Hardware IDs ------------------ {e98c95a8-b50e-5d8b-b2db-c679a39163df} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {13311789-793f-5d95-942c-3b6414a8ad1a} <- Manufacturer + Family + ProductName + BiosVendor {04798471-7c9b-5189-b99b-4d19e1a6fa89} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/sc8280xp-lenovo-thinkpad-x13s-21bx.txt000066400000000000000000000036221514263214500237760ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: N3HET88W (1.60 ) BiosMajorRelease: 1 BiosMinorRelease: 60 FirmwareMajorRelease: 01 FirmwareMinorRelease: 17 Manufacturer: LENOVO Family: ThinkPad X13s Gen 1 ProductName: 21BXCTO1WW ProductSku: LENOVO_MT_21BX_BU_Think_FM_ThinkPad X13s Gen 1 EnclosureKind: a BaseboardManufacturer: LENOVO BaseboardProduct: 21BXCTO1WW Hardware IDs ------------ {810e34c6-cc69-5e36-8675-2f6e354272d3} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {f22c935e-2dc8-5949-9486-09bbf10361b2} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {abdbb2cb-ab52-5674-9d0a-2e2cb69bcbb4} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {ddf28a3f-43fc-54a4-a6a7-4cba5ad46b3e} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {4df470e6-7878-5b0f-b2e0-733d5d9fa228} <- Manufacturer + Family + ProductName + ProductSku {3ad863ab-0181-5a2f-9cc1-70eedc446da9} <- Manufacturer + Family + ProductName {69c47e1e-fde2-5062-b777-acbeab73784b} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {3486eccc-d0ac-534a-9e2f-a1c18bc310c6} <- Manufacturer + ProductSku {c869f39e-f205-5ca0-be7b-d90f90ef5556} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {b470d002-ad8e-5d5c-a7bf-bb1333f2ce4b} <- Manufacturer + ProductName {64b71f12-4341-5e5c-b7cd-25b6503799e3} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {f249803d-0d95-54f3-a28f-f26c14a03f3b} <- Manufacturer + Family {e093d715-70f7-51f4-b6c8-b4a7e31def85} <- Manufacturer + EnclosureKind {156c9b34-bedb-5bfd-ae1f-ef5d2a994967} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer lace-0.1.0/data/hwids/txt/sc8280xp-lenovo-thinkpad-x13s-21by.txt000066400000000000000000000036211514263214500237760ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: N3HET86W (1.58 ) BiosMajorRelease: 1 BiosMinorRelease: 58 FirmwareMajorRelease: 01 FirmwareMinorRelease: 17 Manufacturer: LENOVO Family: ThinkPad X13s Gen 1 ProductName: 21BYS03Y00 ProductSku: LENOVO_MT_21BY_BU_Think_FM_ThinkPad X13s Gen 1 EnclosureKind: a BaseboardManufacturer: LENOVO BaseboardProduct: 21BYS03Y00 Hardware IDs ------------ {b265d777-007e-56e5-b0e2-bd666ab867be} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {3f9d2d91-73b2-5316-8c72-a0ecb3f0dae5} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {4b189129-8eb2-585c-a1bb-a4cfc979433a} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {fbf92a11-bb6f-5adb-b5a7-8abf9acbd7d9} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {0909a1c3-3a02-59a0-b1ea-04f1449c104f} <- Manufacturer + Family + ProductName + ProductSku {69acf6bf-ed33-5806-857f-c76971d7061e} <- Manufacturer + Family + ProductName {ddfbdaa2-7c46-5103-be64-84a9f88c485f} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {b41f58ed-7631-561f-9b0c-449a9c293afa} <- Manufacturer + ProductSku {9f47e28f-e1ee-5cb5-b4ce-8f0605752b3d} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {873455fb-b2c5-5c0c-9c2c-90e80d44da57} <- Manufacturer + ProductName {a1dfe209-99e5-5ff2-9922-aa4c11491b49} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {f249803d-0d95-54f3-a28f-f26c14a03f3b} <- Manufacturer + Family {e093d715-70f7-51f4-b6c8-b4a7e31def85} <- Manufacturer + EnclosureKind {920b6e26-11c6-5beb-8643-fcf5cd74033f} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer lace-0.1.0/data/hwids/txt/sc8280xp-lenovo-thinkpad-x13s-4810.txt000066400000000000000000000043041514263214500236140ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: N3HET94W (1.66 ) BiosMajorRelease: 1 BiosMinorRelease: 66 FirmwareMajorRelease: 01 FirmwareMinorRelease: 18 Manufacturer: LENOVO Family: ThinkPad X13s Gen 1 ProductName: 4810QL0100 ProductSku: LENOVO_MT_4810_BU_Think_FM_ThinkPad X13s Gen 1 EnclosureKind: a BaseboardManufacturer: LENOVO BaseboardProduct: 4810QL0100 Hardware IDs ------------ {e4e1e851-389a-5be8-bc77-d32bc3e96ba2} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {a84d13c1-3864-5d56-8c7c-15ad37074a3f} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {6026ec60-e5e0-56bf-9d71-f3465d7314c8} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {dc4ecdd0-c09b-5e84-ac5f-ccf0182e1ec6} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {04392ed0-22bc-56a4-ae4e-dcb325cb6899} <- Manufacturer + Family + ProductName + ProductSku {6d8e538a-e089-5901-97ed-5ef670416fca} <- Manufacturer + Family + ProductName {93a4dd46-2007-56bf-b176-390519d6f5bd} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {4a971ccf-1223-5f4d-b939-dcb8efc0b350} <- Manufacturer + ProductSku {56eafd87-9fbc-5388-a5fd-ec9a9178fb1c} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {5188008f-3241-5f05-8d21-774b5c7a2887} <- Manufacturer + ProductName {1305c7fb-2943-53e5-aba5-5a948d96ed94} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {f249803d-0d95-54f3-a28f-f26c14a03f3b} <- Manufacturer + Family {e093d715-70f7-51f4-b6c8-b4a7e31def85} <- Manufacturer + EnclosureKind {86a88b51-0f55-5ada-b232-41a5483b0797} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer Extra Hardware IDs ------------------ {db1387e0-f13d-5000-889d-ff7cca53846a} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {30c7a7fe-f4bf-5ce1-aad8-f5e6db904c53} <- Manufacturer + Family + ProductName + BiosVendor {99431f53-09a1-5869-be79-65e2fa3f341d} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/sc8280xp-microsoft-blackrock.txt000066400000000000000000000036271514263214500232710ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Microsoft Corporation BiosVersion: 12.6.235 BiosMajorRelease: 255 BiosMinorRelease: 255 FirmwareMajorRelease: ff FirmwareMinorRelease: ff Manufacturer: Microsoft Corporation Family: Surface ProductName: Windows Dev Kit 2023 ProductSku: 2043 EnclosureKind: 3 BaseboardManufacturer: Microsoft Corporation BaseboardProduct: Windows Dev Kit 2023 Hardware IDs ------------ {69ba0503-ca94-5fa3-b78c-5fa21a66c620} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {ad2ee931-a048-5253-b350-98c482670765} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {5bd24fc5-5edb-51f6-82e6-31a9ef954c5b} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {d67e799e-2ba7-555a-a874-a0523a8b3b11} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {813677fa-6d11-5756-a44d-dde0f552d3f6} <- Manufacturer + Family + ProductName + ProductSku {ce83144b-b123-59e5-8a9a-0c1a13643fc4} <- Manufacturer + Family + ProductName {53b87f48-fc47-54e9-ade5-f1a95e885681} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {046fefee-341b-5c40-b0a3-1c647d31b500} <- Manufacturer + ProductSku {f59639f4-4970-5706-9a75-519dd059f69e} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {08f06457-aa19-51c5-be4c-0087ce4fa2ed} <- Manufacturer + ProductName {11b80238-dbee-57bc-8b26-83c9e5b4057d} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {ca2e5189-1d32-509f-88a0-d4ebcc721899} <- Manufacturer + Family {7ce6d32b-3711-5701-b31a-cc79f61a5719} <- Manufacturer + EnclosureKind {2c1da402-8915-572d-a493-c966d32f96cb} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {cc0aea32-ad2c-5013-8bed-cede6be8c9f4} <- Manufacturer lace-0.1.0/data/hwids/txt/sc8280xp-microsoft-surface-pro-9-5G.txt000066400000000000000000000036371514263214500242040ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Microsoft Corporation BiosVersion: 17.4.235 BiosMajorRelease: 255 BiosMinorRelease: 255 FirmwareMajorRelease: ff FirmwareMinorRelease: ff Manufacturer: Microsoft Corporation Family: Surface ProductName: Surface Pro 9 ProductSku: Surface_Pro_9_With_5G_1996 EnclosureKind: 9 BaseboardManufacturer: Microsoft Corporation BaseboardProduct: Surface Pro 9 Hardware IDs ------------ {e3d941fa-2bfa-5875-8efd-87ce997f8338} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {a659ee2b-502d-50f7-9921-bdbd34734e0b} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {5caa88bc-ea9b-5d73-a69a-89024bfff854} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {c0cf7078-c325-5cf6-966b-3bbbc155275b} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {6309fbb9-68f4-54f9-bbc9-b3ca9685b48c} <- Manufacturer + Family + ProductName + ProductSku {9d70dcfd-f56b-58bf-b1bd-a1b8f2b0ec7e} <- Manufacturer + Family + ProductName {9bac72c6-83f6-5e21-af8e-bc1f5c2b7cc8} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {94fb24a7-ff7a-5d70-9ac8-518a9e44ea64} <- Manufacturer + ProductSku {009d2337-4f76-514e-b2c1-b2816447b048} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {3a486e6f-3b0a-5603-a483-503381d3d8c3} <- Manufacturer + ProductName {636b6071-7848-50d5-b0b5-6290c49e9306} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {ca2e5189-1d32-509f-88a0-d4ebcc721899} <- Manufacturer + Family {aca387a9-183e-5da9-8f9d-f460c3f50f54} <- Manufacturer + EnclosureKind {7fa0755a-ec45-59cd-a206-bb9a956b030f} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {cc0aea32-ad2c-5013-8bed-cede6be8c9f4} <- Manufacturer lace-0.1.0/data/hwids/txt/sdm850-lenovo-yoga-c630.txt000066400000000000000000000036031514263214500217560ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: 9UCN33WW(V2.06) BiosMajorRelease: 1 BiosMinorRelease: 33 FirmwareMajorRelease: 01 FirmwareMinorRelease: 21 Manufacturer: LENOVO Family: YOGA C630-13Q50 ProductName: 81JL ProductSku: LENOVO_MT_81JL_BU_idea_FM_YOGA C630-13Q50 EnclosureKind: 20 BaseboardManufacturer: LENOVO BaseboardProduct: LNVNB161216 Hardware IDs ------------ {b8c71349-3669-56f3-99ee-ae473a2edd96} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {d17c132e-f06e-5e38-8084-9cd642dd9b34} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {8f56cf17-7bdd-5414-832d-97cd26837114} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {b323d38a-88c6-5cf6-af0d-0db3f3c2560d} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {43b71948-9c47-5372-a5cb-18db47bb873f} <- Manufacturer + Family + ProductName + ProductSku {67a23be6-42a6-5900-8325-847a318ce252} <- Manufacturer + Family + ProductName {94f73d29-3981-59a8-8f25-214f84d1522a} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {5ca3cf2b-d6e9-5b54-93f7-1cebd7b3704f} <- Manufacturer + ProductSku {81f308c0-db65-50c2-a660-52e06fc0ff9f} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {30b031c0-9de7-5d31-a61c-dee772871b7d} <- Manufacturer + ProductName {382926c0-ce35-53af-8ff9-ca9cc06cfc7b} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {dd3a12ef-e928-519d-83d7-6674a2ae0ffa} <- Manufacturer + Family {6c95fc34-96cc-5c9f-8e78-6baaffde78ce} <- Manufacturer + EnclosureKind {71d86d4d-02f8-5566-a7a1-529cef184b7e} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer lace-0.1.0/data/hwids/txt/x1e001de-devkit.txt000066400000000000000000000025771514263214500205540ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Qualcomm Technologies, Inc. BiosVersion: 6.0.240901.BOOT.MXF.2.4-00468-HAMOA-1 Manufacturer: Qualcomm Family: SCP_HAMOA ProductName: Snapdragon-Devkit ProductSku: 6 Hardware IDs ------------ not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown not available as 'BaseboardManufacturer' unknown {baa7a649-12d8-56c7-93c5-a4e10f4852be} <- Manufacturer + Family + ProductName + ProductSku {c8e75ab8-555c-5952-a3e3-5b607bea031d} <- Manufacturer + Family + ProductName not available as 'BaseboardManufacturer' unknown {4bb05d50-6c4f-525d-a9ec-8924afd6edea} <- Manufacturer + ProductSku not available as 'BaseboardManufacturer' unknown {830bd4a2-2498-55cf-b561-48f7dc5f4820} <- Manufacturer + ProductName not available as 'BaseboardManufacturer' unknown {b36a40fa-4640-5b1b-8fa1-6dbde103c80d} <- Manufacturer + Family not available as 'EnclosureKind' unknown not available as 'BaseboardManufacturer' unknown {0d601876-0ac6-533e-8386-3a58203d8c33} <- Manufacturer Extra Hardware IDs ------------------ {f37dc44b-0be4-5a70-86bd-81f3dacff2e9} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {9cba20d0-17ad-559f-94cd-cfcbbf5f71f5} <- Manufacturer + Family + ProductName + BiosVendor {d86bea02-5d71-5ee5-98dc-4f74d5777dde} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e78100-lenovo-thinkpad-t14s-21n1.txt000066400000000000000000000043051514263214500234750ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: N42ET53W (1.27 ) BiosMajorRelease: 1 BiosMinorRelease: 27 FirmwareMajorRelease: 01 FirmwareMinorRelease: 0f Manufacturer: LENOVO Family: ThinkPad T14s Gen 6 ProductName: 21N10001US ProductSku: LENOVO_MT_21N1_BU_Think_FM_ThinkPad T14s Gen 6 EnclosureKind: a BaseboardManufacturer: LENOVO BaseboardProduct: 21N10001US Hardware IDs ------------ {c81fee2f-cf41-5d5a-8c7b-afd6585b1d81} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {a9b59fea-e841-508a-a245-3a2d8d2802de} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {74593764-b6b9-58e9-bedc-93ebbb1eb057} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {e5d83424-0ecb-5632-b7b1-500f04e82725} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {76032e78-67a8-5dab-8512-157bfcfb8f75} <- Manufacturer + Family + ProductName + ProductSku {dd83478e-e01b-5631-ae74-92ae275a9b4e} <- Manufacturer + Family + ProductName {791ecd9d-1547-58e6-b72a-5ce417b729dd} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {8c602147-5363-5374-859e-8b7fe2d4d3ce} <- Manufacturer + ProductSku {498d60ae-9b1d-5b67-8abd-af571babfa94} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {acbac5af-aa6a-5690-88f3-e910f04a7ead} <- Manufacturer + ProductName {5180bc01-5d18-5870-b955-969da38b2647} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {431ff9e9-cd92-51c1-8917-46b0a0ef147c} <- Manufacturer + Family {e093d715-70f7-51f4-b6c8-b4a7e31def85} <- Manufacturer + EnclosureKind {c124cecf-e6dc-5d35-a320-712980cfb68d} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer Extra Hardware IDs ------------------ {19b622ef-27fe-5c2e-bc53-13a79b862c65} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {ac09e50f-9b3b-53c0-9752-377c3a0baaa0} <- Manufacturer + Family + ProductName + BiosVendor {99431f53-09a1-5869-be79-65e2fa3f341d} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e78100-lenovo-thinkpad-t14s-21n2.txt000066400000000000000000000043041514263214500234750ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: N42ET88W (2.18 ) BiosMajorRelease: 2 BiosMinorRelease: 18 FirmwareMajorRelease: 01 FirmwareMinorRelease: 1b Manufacturer: LENOVO Family: ThinkPad T14s Gen 6 ProductName: 21N2ZC5QUS ProductSku: LENOVO_MT_21N2_BU_Think_FM_ThinkPad T14s Gen 6 EnclosureKind: a BaseboardManufacturer: LENOVO BaseboardProduct: 21N2ZC5QUS Hardware IDs ------------ {1d9f3ebb-96de-5dd6-8c88-38308b0c1c44} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {578dd7d5-5871-5bd5-92a9-be07f1067b92} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {ed647f93-3075-598b-9d89-d0f30ec11707} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {f6cd4a9f-9632-516e-b748-65952f7380c5} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {a5a4e3c1-5922-5ed6-b78e-9f0ea873a988} <- Manufacturer + Family + ProductName + ProductSku {a20ae3ec-49a1-5cb5-acb8-5d31c77b105a} <- Manufacturer + Family + ProductName {8cfd85bb-0d77-59df-8546-264239be475e} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {513976f8-3f51-5b42-9ae0-931ce23c5f38} <- Manufacturer + ProductSku {86a0d770-3ca1-57fa-ac05-413481c00a24} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {5c20e964-d530-5dd7-9efd-4aed9e73c3cb} <- Manufacturer + ProductName {d93b21c0-5ed9-5955-911a-5b15f114d786} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {431ff9e9-cd92-51c1-8917-46b0a0ef147c} <- Manufacturer + Family {e093d715-70f7-51f4-b6c8-b4a7e31def85} <- Manufacturer + EnclosureKind {62631c9b-2642-5d4f-b7e2-1b917809d08d} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer Extra Hardware IDs ------------------ {82fa4a02-8c3c-55f9-b0c9-e8feb669fd3a} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {34e7fadd-9c7d-5f91-ba7f-cedb04d59b9a} <- Manufacturer + Family + ProductName + BiosVendor {99431f53-09a1-5869-be79-65e2fa3f341d} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-asus-vivobook-s15.txt000066400000000000000000000043151514263214500223320ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Insyde BiosVersion: S5507QAD.307 BiosMajorRelease: 1 BiosMinorRelease: 27 FirmwareMajorRelease: 03 FirmwareMinorRelease: 02 Manufacturer: ASUSTeK COMPUTER INC. Family: ASUS Vivobook S 15 ProductName: ASUS Vivobook S 15 S5507QA_S5507QAD ProductSku: (null) EnclosureKind: a BaseboardManufacturer: ASUSTeK COMPUTER INC. BaseboardProduct: S5507QAD Hardware IDs ------------ {6d634332-21fc-57c8-bc6b-e0f800f69f95} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {d0fce8d6-a709-5bf0-8be0-6ac6ab44b8e0} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {80430e03-90f0-5355-84b2-28fb17367203} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {fa342b0a-9e22-541f-8e95-93106778f97d} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {137a5f94-8fcf-5581-8ac6-70d50fdba4a6} <- Manufacturer + Family + ProductName + ProductSku {3a3ef092-d5f1-5d4d-acea-70b38ef56e53} <- Manufacturer + Family + ProductName {a6debedb-f954-5aa1-8260-4dc3b567c95f} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {f3a6ca3e-4791-5bb0-915e-0b31856ec19c} <- Manufacturer + ProductSku {4262e277-58d3-5ac4-9858-c0751ad06f5c} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {f54cd4e6-3666-5b56-abd3-a5f2df50c534} <- Manufacturer + ProductName {807fe49f-cfd2-537d-b635-47bec9e36baf} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {51df1ece-cd39-547a-8f9f-8f036fcfe752} <- Manufacturer + Family {665276be-80c5-5e5d-929f-fa85d18e2d50} <- Manufacturer + EnclosureKind {05cd2c3f-53cc-5239-94db-f7a00903ac1d} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {65605ed1-09e2-57aa-bd0f-a26c1d35433f} <- Manufacturer Extra Hardware IDs ------------------ {c71e903b-4255-56cb-b961-a8f87b452cbe} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {1b6a0689-3f70-57e0-8bf3-39a8a74213e8} <- Manufacturer + Family + ProductName + BiosVendor {9d1b57fb-8282-5287-bd50-3c93d43921fa} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-asus-zenbook-a14.txt000066400000000000000000000043021514263214500221140ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Insyde BiosVersion: UX3407RA.305 BiosMajorRelease: 3 BiosMinorRelease: 5 FirmwareMajorRelease: 03 FirmwareMinorRelease: 0b Manufacturer: ASUSTeK COMPUTER INC. Family: ASUS Zenbook A14 ProductName: ASUS Zenbook A14 UX3407RA_UX3407RA ProductSku: EnclosureKind: a BaseboardManufacturer: ASUSTeK COMPUTER INC. BaseboardProduct: UX3407RA Hardware IDs ------------ {c41d2cda-fda7-522c-b1a7-4a835c15c43d} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {0bfddfaf-e393-5dfe-a805-39b8b1098c81} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {f0bb1cd4-995a-5c90-946b-9bb958f35f42} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {2d610a5e-ef69-5e60-b15e-7786d0ebd79e} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {6f892377-a51e-5f99-a363-b79f28fc55f9} <- Manufacturer + Family + ProductName + ProductSku {0c3f5e9c-eddb-5ba2-88ee-06ae0221a53d} <- Manufacturer + Family + ProductName {20b8b77d-e450-550b-b1ff-55d3317f59a6} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {24652d54-00f4-59ae-96fb-f7adbfa4a939} <- Manufacturer + ProductSku {5c9fc73f-f915-52bf-a82d-9c7fe2274ecc} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {3884ad58-4d63-589a-be98-b8ab1ddf3b93} <- Manufacturer + ProductName {cedbcc19-3a5a-5bae-9973-f8e158188de7} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {c5647aaf-bd0a-5863-bdda-49afd00c5329} <- Manufacturer + Family {665276be-80c5-5e5d-929f-fa85d18e2d50} <- Manufacturer + EnclosureKind {1038788a-2a89-5898-8292-9db114671c04} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {65605ed1-09e2-57aa-bd0f-a26c1d35433f} <- Manufacturer Extra Hardware IDs ------------------ {1f2f1045-a811-5e42-b31e-b433e384fc79} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {b307ab54-c79d-58ca-a3b2-d1b1e325bfc3} <- Manufacturer + Family + ProductName + BiosVendor {9d1b57fb-8282-5287-bd50-3c93d43921fa} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-crd.txt000066400000000000000000000034021514263214500176610ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Qualcomm Technologies, Inc. BiosVersion: 6.0.240718.BOOT.MXF.2.4-00515-HAMOA-1 BiosMajorRelease: 255 BiosMinorRelease: 255 FirmwareMajorRelease: 00 FirmwareMinorRelease: 14 Manufacturer: Qualcomm Family: SCP_HAMOA ProductName: CRD ProductSku: 6 Hardware IDs ------------ {e73870a5-90e8-528d-93fd-3da59f78df18} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {2405af0b-d21d-5196-a228-4acffe7b3a10} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {8fa88c58-23eb-5aea-9ea7-c4a98ded7352} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease not available as 'BaseboardManufacturer' unknown {7faef667-9eb2-53f4-9764-26fe0e92fbff} <- Manufacturer + Family + ProductName + ProductSku {b6d4eee8-30f3-564a-8246-e83935cf8dbb} <- Manufacturer + Family + ProductName not available as 'BaseboardManufacturer' unknown {4bb05d50-6c4f-525d-a9ec-8924afd6edea} <- Manufacturer + ProductSku not available as 'BaseboardManufacturer' unknown {339fc6d2-e0f4-5226-9dd9-62c4dc41881d} <- Manufacturer + ProductName not available as 'BaseboardManufacturer' unknown {b36a40fa-4640-5b1b-8fa1-6dbde103c80d} <- Manufacturer + Family not available as 'EnclosureKind' unknown not available as 'BaseboardManufacturer' unknown {0d601876-0ac6-533e-8386-3a58203d8c33} <- Manufacturer Extra Hardware IDs ------------------ {d52e3fb6-202c-5cfa-a27c-e3ffe15339fb} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {361b3d63-be90-52c2-8798-a05fbd68b773} <- Manufacturer + Family + ProductName + BiosVendor {d86bea02-5d71-5ee5-98dc-4f74d5777dde} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-dell-inspiron-14-plus-7441.txt000066400000000000000000000042211514263214500234700ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Dell Inc. BiosVersion: 2.9.0 BiosMajorRelease: 2 BiosMinorRelease: 9 FirmwareMajorRelease: ff FirmwareMinorRelease: ff Manufacturer: Dell Inc. Family: Inspiron ProductName: Inspiron 14 Plus 7441 ProductSku: C86 EnclosureKind: a BaseboardManufacturer: Dell Inc. BaseboardProduct: YWPR3 Hardware IDs ------------ {4689ccaf-4f31-5146-887f-ca965da0f28a} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {e4c9fe83-73ba-5160-bc18-57d4a98e960d} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {efc06900-f603-5944-88e5-4de722816f91} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {90117b25-1646-515b-bfeb-286e74f2a1e8} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {c1190be1-8ed5-50f1-9097-2a73ad9c4eb1} <- Manufacturer + Family + ProductName + ProductSku {0d9ce3bc-620c-5209-9e82-7382cb6cffcd} <- Manufacturer + Family + ProductName {ff394805-0b5f-52f6-9e1d-afb1d2bee411} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {07c6477a-7ef7-56c7-91d9-73d23295b0c0} <- Manufacturer + ProductSku {a66b1244-0027-5451-a96a-dfcfc42ab892} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {ef84110e-bd09-5f0f-a3dd-7995b4a3a706} <- Manufacturer + ProductName {07c6bbd9-caf8-5025-84d8-4efdb790f663} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {717bca8b-c237-5776-9736-3922a63c6938} <- Manufacturer + Family {5c163113-9296-5c8d-a92d-ae04eb59a0f7} <- Manufacturer + EnclosureKind {f27f8f9a-723c-5e17-933c-bdc4bbce3bce} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {85d38fda-fc0e-5c6f-808f-076984ae7978} <- Manufacturer Extra Hardware IDs ------------------ {bea2e67a-b660-5044-8acd-0d28e8c2e974} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {8548ce7c-fdf3-55d0-95ba-606ca8db50da} <- Manufacturer + Family + ProductName + BiosVendor {36cb5c6e-fb91-55e9-8077-e004f2b1ddad} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-dell-latitude-7455.txt000066400000000000000000000033771514263214500222570ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Dell Inc. BiosVersion: 2.8.0 Manufacturer: Dell Inc. Family: Latitude ProductName: Latitude 7455 ProductSku: 0C85 EnclosureKind: 10 BaseboardManufacturer: Dell Inc. BaseboardProduct: 0FK7MX Hardware IDs ------------ not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown {903e3a6f-e14b-5643-9d55-244f917aadb6} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {59e5c810-9e60-5a89-8665-db36c56b34d6} <- Manufacturer + Family + ProductName + ProductSku {2b9277cd-85b1-51ee-9a38-d477632532da} <- Manufacturer + Family + ProductName {6e01222b-b2aa-531e-b95f-0e4b2a063364} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {93055898-8c85-50e7-adde-8115f194579a} <- Manufacturer + ProductSku {b3e5b59d-84ae-597d-9222-8a4d48480bc3} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {4f73f73b-e639-5353-bbf7-d851e48f18fc} <- Manufacturer + ProductName {68822228-a3e0-5b12-942d-9408751405d1} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {41b0b5d7-ad12-5d86-9a3d-826f9b20adcc} <- Manufacturer + Family {a26f8d6d-d9ab-5705-939a-aec8fed37cd4} <- Manufacturer + EnclosureKind {cb846e91-7a9f-564f-8f33-6cf5bc04a5b8} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {85d38fda-fc0e-5c6f-808f-076984ae7978} <- Manufacturer Extra Hardware IDs ------------------ {683e4579-8440-5bc1-89ac-dfcd7c25b307} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {fb7493ec-9634-5c5a-9f26-69cbf9b92460} <- Manufacturer + Family + ProductName + BiosVendor {36cb5c6e-fb91-55e9-8077-e004f2b1ddad} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-dell-xps13-9345.txt000066400000000000000000000035171514263214500214160ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Dell Inc. BiosVersion: 2.0.0 BiosMajorRelease: 2 BiosMinorRelease: 0 FirmwareMajorRelease: ff FirmwareMinorRelease: ff Manufacturer: Dell Inc. Family: XPS ProductName: XPS 13 9345 ProductSku: C69 EnclosureKind: a BaseboardManufacturer: Dell Inc. BaseboardProduct: DXPNM Hardware IDs ------------ {eedeb5d9-1a0e-56e6-9137-eb6a723e58d1} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {1eb87d70-2f37-5f18-85de-30e46c17d540} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {1d1baf60-e2f3-5821-9d98-19a131bf8d93} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {7c7c2920-cb59-56ad-bc8a-939e803b0192} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {940c6349-f0a5-54ba-8deb-10e709e0b76c} <- Manufacturer + Family + ProductName + ProductSku {3b9a1d76-f2e8-52e8-84de-14c5942b3d41} <- Manufacturer + Family + ProductName {3c2649a7-2275-5130-a0c4-cc5f9809a2c1} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {36e8dd88-512d-5a74-86a4-039333f9e15a} <- Manufacturer + ProductSku {e656b5f2-69c3-55da-bf22-4dd58d5f6d4f} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {bc685cec-e979-5cb9-bf02-e15586c7cb4b} <- Manufacturer + ProductName {81972cb8-6fc7-5e08-b140-b0063ed4fefa} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {61178075-a8fd-563c-9045-44227d8c121f} <- Manufacturer + Family {5c163113-9296-5c8d-a92d-ae04eb59a0f7} <- Manufacturer + EnclosureKind {1302793c-52b1-5354-b1cf-f2cd9206c157} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {85d38fda-fc0e-5c6f-808f-076984ae7978} <- Manufacturer lace-0.1.0/data/hwids/txt/x1e80100-hp-elitebook-ultra-g1q.txt000066400000000000000000000042661514263214500233170ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Insyde BiosVersion: F.32 BiosMajorRelease: 15 BiosMinorRelease: 32 FirmwareMajorRelease: 11 FirmwareMinorRelease: 2c Manufacturer: HP Family: 103C_5336AN HP EliteBook Ultra ProductName: HP EliteBook Ultra G1q 14 inch Notebook AI PC ProductSku: A3LZ2AA#ABA EnclosureKind: a BaseboardManufacturer: HP BaseboardProduct: 8CBE Hardware IDs ------------ {ba2ddd3d-a06b-5b1f-9b2a-ce58f748486c} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {9145c311-f1b1-5f0f-902d-f6828baf8c46} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {5275e89b-e839-589e-9e90-e1bd6854255b} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {7bfc4a0e-15c1-58b3-b27b-4e5f60d4397e} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {a3c9ef57-67ab-5f75-a4cb-48cb7475b025} <- Manufacturer + Family + ProductName + ProductSku {72a81f9e-c30b-5bf0-8449-948f8e593e92} <- Manufacturer + Family + ProductName {829d699c-f082-5835-967a-8e7022cb20b5} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {25f49237-b3b4-58b2-9e58-6cc379781901} <- Manufacturer + ProductSku {07be634a-0442-51fb-8a77-ecb370b5262b} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {e4944bcc-a1c3-540e-b400-cd91953b7ba9} <- Manufacturer + ProductName {ec4cdb9c-e6ff-581c-ac22-d597b5e880a2} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {15d9c11f-c7d2-5fd5-99a1-682211c8fc6a} <- Manufacturer + Family {f999e8e2-2bed-5ee7-85be-a69096b9544d} <- Manufacturer + EnclosureKind {2ae478e9-ef65-5485-bb06-a233136e53c7} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {93f84748-c854-5d6b-b78a-13c2361e0758} <- Manufacturer Extra Hardware IDs ------------------ {b7f376e9-f5f8-5718-b00e-6bd7c265aeab} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {5473ba61-2807-585b-b2ac-f0366d84bdc0} <- Manufacturer + Family + ProductName + BiosVendor {ad0b7f58-06f2-50b9-856b-343f54261425} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-hp-omnibook-x14.txt000066400000000000000000000034241514263214500217510ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Insyde BiosVersion: F.09 Manufacturer: HP Family: 103C_5335M8 HP OmniBook X ProductName: HP OmniBook X Laptop 14-fe0xxx ProductSku: A3NY2EA#ABD EnclosureKind: 10 BaseboardManufacturer: HP BaseboardProduct: 8CBE Hardware IDs ------------ not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown {045dfd0f-068b-5e57-86bd-f41b4b906006} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {ca5dab4f-a301-53c6-b753-c2db56172e0a} <- Manufacturer + Family + ProductName + ProductSku {811126e6-4aee-5f9e-827d-d0f12f6a6f00} <- Manufacturer + Family + ProductName {6a4511bc-0a3b-5b10-9c8b-dbcb834ecd83} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {abb2ffec-2acd-5750-8dfd-c3845fd4bf2a} <- Manufacturer + ProductSku {1a192aee-2cfd-5ab5-95f9-8093218a48ef} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {eaab52c6-ed22-5e1b-b788-fc5a0531291d} <- Manufacturer + ProductName {848aeb1d-302b-5b6b-9109-0f4632535915} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {5d43face-6ba8-5d41-8914-12f3410bbcf9} <- Manufacturer + Family {4c84c882-b54c-58d5-b412-26bcdf254c3e} <- Manufacturer + EnclosureKind {2ae478e9-ef65-5485-bb06-a233136e53c7} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {93f84748-c854-5d6b-b78a-13c2361e0758} <- Manufacturer Extra Hardware IDs ------------------ {54500b82-f7ae-592d-ae68-8c8e362a1475} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {68d24be5-01b6-5d88-83fb-df2bcfa879aa} <- Manufacturer + Family + ProductName + BiosVendor {ad0b7f58-06f2-50b9-856b-343f54261425} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-lenovo-yoga-slim7x.txt000066400000000000000000000036011514263214500225720ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: NHCN36WW BiosMajorRelease: 1 BiosMinorRelease: 36 FirmwareMajorRelease: 01 FirmwareMinorRelease: 35 Manufacturer: LENOVO Family: Yoga Slim 7 14Q8X9 ProductName: 83ED ProductSku: LENOVO_MT_83ED_BU_idea_FM_Yoga Slim 7 14Q8X9 EnclosureKind: a BaseboardManufacturer: LENOVO BaseboardProduct: LNVNB161216 Hardware IDs ------------ {3fb1e5ba-05cd-5153-ad64-1d8bc6dc7a1b} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {d99f6cb2-4a96-5e4a-8e29-19d52dfc2870} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {6d53c38f-6adb-578b-a418-2abda4d8485d} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {8073dbed-501f-5f5e-a619-4cdd9c00e865} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {d27cf20e-e185-578e-bd46-f4cc3a718bb2} <- Manufacturer + Family + ProductName + ProductSku {8477f828-512b-56cf-af55-c711a6831551} <- Manufacturer + Family + ProductName {f7f92b85-ff01-5e93-a453-c7f91029aa55} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {0700776d-0de7-5ea7-b9bf-77e0454d35e1} <- Manufacturer + ProductSku {ee39b629-4187-5ff7-84c0-e354555562cd} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {fdb12a4f-1e8b-524e-97b5-feef23a8a8da} <- Manufacturer + ProductName {63429d43-c970-570d-aaa7-54300924e0c5} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {8f143f12-40dc-5801-8e61-08a88cd68c1e} <- Manufacturer + Family {e093d715-70f7-51f4-b6c8-b4a7e31def85} <- Manufacturer + EnclosureKind {71d86d4d-02f8-5566-a7a1-529cef184b7e} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer lace-0.1.0/data/hwids/txt/x1e80100-microsoft-denali.txt000066400000000000000000000044031514263214500223520ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Microsoft Corporation BiosVersion: 175.77.235 BiosMajorRelease: 255 BiosMinorRelease: 255 FirmwareMajorRelease: ff FirmwareMinorRelease: ff Manufacturer: Microsoft Corporation Family: Surface ProductName: Microsoft Surface Pro, 11th Edition ProductSku: Surface_Pro_11th_Edition_2076 EnclosureKind: 9 BaseboardManufacturer: Microsoft Corporation BaseboardProduct: Microsoft Surface Pro, 11th Edition Hardware IDs ------------ {66f9d954-5c66-5577-b3e4-e3f14f87d2ff} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {5a384f15-464d-5da8-9311-a2c021759afc} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {14b96570-4bc4-541a-9aef-1b7e2b61d7cd} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {aca467c0-5fc2-59ad-8ed5-1b7a0988d11c} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {95971fb3-d478-591f-9ea3-eb0af0d1dfb5} <- Manufacturer + Family + ProductName + ProductSku {c9c14db9-2b61-597a-a4ba-84397fe75f63} <- Manufacturer + Family + ProductName {7cef06f5-e7e6-56d7-b123-a6d640a5d302} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {48b86a5e-1955-5799-9577-150f9e1a69e4} <- Manufacturer + ProductSku {06128fee-87dc-50f6-8a3f-97cd9a6d8bf6} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {84b2e1d1-e695-5f41-8c41-cf1f059c616a} <- Manufacturer + ProductName {16a47337-1f8b-5bd3-b3bd-8e50b31cb1c9} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {ca2e5189-1d32-509f-88a0-d4ebcc721899} <- Manufacturer + Family {aca387a9-183e-5da9-8f9d-f460c3f50f54} <- Manufacturer + EnclosureKind {fdef4ae0-6bfb-5706-8aae-a565639505f5} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {cc0aea32-ad2c-5013-8bed-cede6be8c9f4} <- Manufacturer Extra Hardware IDs ------------------ {01bf1e61-d2e0-518b-bb46-eb4d1f2b1af1} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {584a5084-15f2-5d20-917b-57f299e61f7e} <- Manufacturer + Family + ProductName + BiosVendor {9914cecc-aab7-570e-8fce-e86009ea6bbb} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-microsoft-romulus13.txt000066400000000000000000000044111514263214500227670ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Microsoft Corporation BiosVersion: 144.18.235 BiosMajorRelease: 255 BiosMinorRelease: 255 FirmwareMajorRelease: ff FirmwareMinorRelease: ff Manufacturer: Microsoft Corporation Family: Surface ProductName: Microsoft Surface Laptop, 7th Edition ProductSku: Surface_Laptop_7th_Edition_2036 EnclosureKind: 9 BaseboardManufacturer: Microsoft Corporation BaseboardProduct: Microsoft Surface Laptop, 7th Edition Hardware IDs ------------ {4ecd5e53-42ea-51a3-9602-aecdfee5c09d} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {53368ca9-12d5-5ee1-820b-ce979fa2cb0b} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {cb196e28-20bc-5e78-93f1-0ac41726bcf8} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {fdfca0f3-41b6-5872-a2ea-53539fd5160c} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {11696377-327d-5ad1-b01d-02a7dbb9b99a} <- Manufacturer + Family + ProductName + ProductSku {892e90c9-31e3-5131-a217-a02632dba5e9} <- Manufacturer + Family + ProductName {786c71b6-f60e-51c7-9ddc-f2999b75a3c5} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {f0d12ad9-f530-5b56-96d8-897dd704059e} <- Manufacturer + ProductSku {3c329240-a447-5ec5-b79b-d1149420ac62} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {224ba2ff-14c1-5b33-ac10-079ccc217be2} <- Manufacturer + ProductName {924900a0-9be2-53ca-90d7-b0e38827f5c5} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {ca2e5189-1d32-509f-88a0-d4ebcc721899} <- Manufacturer + Family {aca387a9-183e-5da9-8f9d-f460c3f50f54} <- Manufacturer + EnclosureKind {1c07beb2-8442-5086-baab-2c44a468e3a3} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {cc0aea32-ad2c-5013-8bed-cede6be8c9f4} <- Manufacturer Extra Hardware IDs ------------------ {95c06fde-19b0-55dc-9ca6-55403bae23f5} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {c735618b-d526-5f71-9651-8d149340d620} <- Manufacturer + Family + ProductName + BiosVendor {9914cecc-aab7-570e-8fce-e86009ea6bbb} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1e80100-microsoft-romulus15.txt000066400000000000000000000044121514263214500227720ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Microsoft Corporation BiosVersion: 175.126.235 BiosMajorRelease: 255 BiosMinorRelease: 255 FirmwareMajorRelease: ff FirmwareMinorRelease: ff Manufacturer: Microsoft Corporation Family: Surface ProductName: Microsoft Surface Laptop, 7th Edition ProductSku: Surface_Laptop_7th_Edition_2037 EnclosureKind: 9 BaseboardManufacturer: Microsoft Corporation BaseboardProduct: Microsoft Surface Laptop, 7th Edition Hardware IDs ------------ {e56cd9fa-d992-5947-9f80-82345827e8e6} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {e1fbd53f-3738-5fa6-aa7b-5ae319663d6b} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {e4cef54f-d5b2-56b1-8aa0-07b48c3deedf} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {ebce3085-12c1-58f3-9456-ccdf741a1538} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {f91b1a95-926c-5fd7-9826-4a101e142f97} <- Manufacturer + Family + ProductName + ProductSku {892e90c9-31e3-5131-a217-a02632dba5e9} <- Manufacturer + Family + ProductName {27ec66e4-3f81-5c06-997e-e1ea0a98b8a1} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {90482ef5-831d-5069-8d40-92d339a75c77} <- Manufacturer + ProductSku {3c329240-a447-5ec5-b79b-d1149420ac62} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {224ba2ff-14c1-5b33-ac10-079ccc217be2} <- Manufacturer + ProductName {924900a0-9be2-53ca-90d7-b0e38827f5c5} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {ca2e5189-1d32-509f-88a0-d4ebcc721899} <- Manufacturer + Family {aca387a9-183e-5da9-8f9d-f460c3f50f54} <- Manufacturer + EnclosureKind {1c07beb2-8442-5086-baab-2c44a468e3a3} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {cc0aea32-ad2c-5013-8bed-cede6be8c9f4} <- Manufacturer Extra Hardware IDs ------------------ {109cd8d8-6086-50b6-9c2d-d0aca0f418da} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {c735618b-d526-5f71-9651-8d149340d620} <- Manufacturer + Family + ProductName + BiosVendor {9914cecc-aab7-570e-8fce-e86009ea6bbb} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1p42100-asus-vivobook-s15.txt000066400000000000000000000043031514263214500223400ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Insyde BiosVersion: S5507QA.318 BiosMajorRelease: 3 BiosMinorRelease: 10 FirmwareMajorRelease: 03 FirmwareMinorRelease: 07 Manufacturer: ASUSTeK COMPUTER INC. Family: ASUS Vivobook S 15 ProductName: ASUS Vivobook S 15 S5507QA_S5507QA ProductSku: EnclosureKind: a BaseboardManufacturer: ASUSTeK COMPUTER INC. BaseboardProduct: S5507QA Hardware IDs ------------ {c4575028-e938-504d-850d-f36fbb6b300d} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {920bc3d2-69f0-5705-83d8-3e0019ab5223} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {ac5b6293-c2ac-5e82-98f2-0475efbc11fc} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {0c926a29-b883-5482-aea7-ddda46084840} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {c5fed9eb-6a7b-5378-b093-484d9322150b} <- Manufacturer + Family + ProductName + ProductSku {c9cd4052-8d61-5a5b-ad16-b9f12a993822} <- Manufacturer + Family + ProductName {be521b64-7759-5835-a0b2-c10300a191fa} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {24652d54-00f4-59ae-96fb-f7adbfa4a939} <- Manufacturer + ProductSku {52499218-2ce9-5d3c-b276-e3cee52f2f7a} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {172515ff-feb1-5f61-bc14-116a23ea70da} <- Manufacturer + ProductName {f6b44a44-c913-572c-8c9c-0ff0f9c010f0} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {51df1ece-cd39-547a-8f9f-8f036fcfe752} <- Manufacturer + Family {665276be-80c5-5e5d-929f-fa85d18e2d50} <- Manufacturer + EnclosureKind {aeb1c925-81b7-5c73-ae9b-49bc5365de8f} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {65605ed1-09e2-57aa-bd0f-a26c1d35433f} <- Manufacturer Extra Hardware IDs ------------------ {2ad07794-e07a-55da-b1a1-b9b56ed4cdcd} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {ab36b5d3-4e77-58be-9d55-939c7e6734c6} <- Manufacturer + Family + ProductName + BiosVendor {9d1b57fb-8282-5287-bd50-3c93d43921fa} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1p42100-asus-zenbook-a14.txt000066400000000000000000000043021514263214500221250ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Insyde BiosVersion: UX3407QA.305 BiosMajorRelease: 3 BiosMinorRelease: 5 FirmwareMajorRelease: 03 FirmwareMinorRelease: 0b Manufacturer: ASUSTeK COMPUTER INC. Family: ASUS Zenbook A14 ProductName: ASUS Zenbook A14 UX3407QA_UX3407QA ProductSku: EnclosureKind: a BaseboardManufacturer: ASUSTeK COMPUTER INC. BaseboardProduct: UX3407QA Hardware IDs ------------ {c6d100b1-9de7-5636-a3cc-f28fa46fb926} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {85f50d27-f4cb-54df-9aae-f6f09700b132} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {8a72a2ea-3971-55e3-b982-cb6b82868f0e} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {a034eff6-2891-5de0-b0db-9c5ff350b968} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {a5b5becc-2a55-5017-b159-087f3846da26} <- Manufacturer + Family + ProductName + ProductSku {59793319-4344-5755-9194-17f29f030d5d} <- Manufacturer + Family + ProductName {14643426-35fa-5a20-bc31-3b6095d2b451} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {24652d54-00f4-59ae-96fb-f7adbfa4a939} <- Manufacturer + ProductSku {a8425d85-573a-56f8-9d9d-98a196d712fa} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {7e6d3df4-bf5f-59ab-ad7b-e00677c0ae5a} <- Manufacturer + ProductName {00bc5418-646d-5bab-b772-4efb06f4e7f1} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {c5647aaf-bd0a-5863-bdda-49afd00c5329} <- Manufacturer + Family {665276be-80c5-5e5d-929f-fa85d18e2d50} <- Manufacturer + EnclosureKind {7c5098e1-fa78-597c-a6ba-8b69ccc1cf75} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {65605ed1-09e2-57aa-bd0f-a26c1d35433f} <- Manufacturer Extra Hardware IDs ------------------ {3ca4e2d9-50df-51a5-a87f-4636d425e97d} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {0b8b84da-462b-5620-bdb5-70272e0ddd94} <- Manufacturer + Family + ProductName + BiosVendor {9d1b57fb-8282-5287-bd50-3c93d43921fa} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1p42100-hp-omnibook-x14.txt000066400000000000000000000034241514263214500217620ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Insyde BiosVersion: F.21 Manufacturer: HP Family: 103C_5335M8 HP OmniBook X ProductName: HP OmniBook X Laptop 14-fe1xxx ProductSku: AP4R1EA#UUW EnclosureKind: 10 BaseboardManufacturer: HP BaseboardProduct: 8CCF Hardware IDs ------------ not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown not available as 'BiosMajorRelease' unknown {3fdb269e-c359-5004-b4e3-8541ef3580c9} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {29a43fda-41e4-5db5-b6d3-012d0674d84f} <- Manufacturer + Family + ProductName + ProductSku {9c3e4a5b-8fa2-5045-9c4f-441307fa3b08} <- Manufacturer + Family + ProductName {271cca67-bd9e-5dd6-8e5f-b5f6b969da97} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {612e268b-1233-5af6-b478-5596d3573d35} <- Manufacturer + ProductSku {1d8361a7-1b3a-5915-8a35-03a3c1cf9c2e} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {6fe7a469-b01a-5530-9a34-2dd089e0e006} <- Manufacturer + ProductName {5120f011-8f7e-5ca5-9143-de545e288712} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {5d43face-6ba8-5d41-8914-12f3410bbcf9} <- Manufacturer + Family {4c84c882-b54c-58d5-b412-26bcdf254c3e} <- Manufacturer + EnclosureKind {8766bc19-d22e-5a07-9c23-f8762c4907fb} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {93f84748-c854-5d6b-b78a-13c2361e0758} <- Manufacturer Extra Hardware IDs ------------------ {d4db0558-de1b-562b-bc23-3e0caadd4c94} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {38e7030f-993f-5bda-9ce8-ae13a13d7b5a} <- Manufacturer + Family + ProductName + BiosVendor {ad0b7f58-06f2-50b9-856b-343f54261425} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1p42100-lenovo-ideapad-5-2in1.txt000066400000000000000000000042771514263214500227350ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: LENOVO BiosVersion: Q1CN22WW BiosMajorRelease: 1 BiosMinorRelease: 22 FirmwareMajorRelease: 01 FirmwareMinorRelease: 16 Manufacturer: LENOVO Family: IdeaPad 5 2-in-1 14Q8X9 ProductName: 83GH ProductSku: LENOVO_MT_83GH_BU_idea_FM_IdeaPad 5 2-in-1 14Q8X9 EnclosureKind: 1f BaseboardManufacturer: LENOVO BaseboardProduct: LNVNB161216 Hardware IDs ------------ {d51c6a3a-45a7-5a6f-9628-9074f72783d5} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {6e60bb5f-6c91-564d-9d57-ca3b2d9c280f} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {8b55e9a3-c4bf-5418-bd93-2af3e9263694} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {d622845f-0305-5b33-b081-b7519488ed65} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {9b723570-d493-5541-ae58-49087512f816} <- Manufacturer + Family + ProductName + ProductSku {eb458c6d-45b2-5299-95b7-87723235240e} <- Manufacturer + Family + ProductName {920bf110-b027-51fc-97e5-bb9b46e78c75} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {9276913a-a9da-5237-b4e8-c8502197264a} <- Manufacturer + ProductSku {a8a28ecb-200f-59c6-8fe3-62fa670fb80d} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {24248bed-dbd2-5e4f-ba41-4e03a09b904a} <- Manufacturer + ProductName {68320834-1316-5dad-babf-ae31cc3ff58c} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {d15b437b-55bf-5bd8-8a88-eb4b9e54cb97} <- Manufacturer + Family {32b7e294-a252-5a72-b3c6-6197f08c64f1} <- Manufacturer + EnclosureKind {71d86d4d-02f8-5566-a7a1-529cef184b7e} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {6de5d951-d755-576b-bd09-c5cf66b27234} <- Manufacturer Extra Hardware IDs ------------------ {63fd3926-001c-5392-9c34-fdd477025bd8} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {4ff87ce0-b6ce-5e37-899b-389129fc099e} <- Manufacturer + Family + ProductName + BiosVendor {99431f53-09a1-5869-be79-65e2fa3f341d} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1p42100-microsoft-surface-pro-12in.txt000066400000000000000000000044311514263214500241250ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Microsoft Corporation BiosVersion: 8.722.235 BiosMajorRelease: 255 BiosMinorRelease: 255 FirmwareMajorRelease: ff FirmwareMinorRelease: ff Manufacturer: Microsoft Corporation Family: Surface ProductName: Surface Pro 12in 1st Ed with Snapdragon ProductSku: Surface_Pro_12in_1st_Ed_with_Snapdragon_2110 EnclosureKind: 9 BaseboardManufacturer: Microsoft Corporation BaseboardProduct: Surface Pro 12in 1st Ed with Snapdragon Hardware IDs ------------ {38f75a5d-c3fc-5306-bb2e-bbb516e1ea91} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {57ba7c1d-8e88-59a9-82c9-044e765788e7} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {10cb324b-df3c-5081-bc7d-b5cc6795eeef} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {7c967d92-123c-5bfc-9fe8-430e6bba5ecb} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {277a48e4-924d-5ab0-81b9-d29c2ff47ad5} <- Manufacturer + Family + ProductName + ProductSku {0a3f15dc-fcde-5159-baf8-1b55f5e1ae57} <- Manufacturer + Family + ProductName {d17ea34a-39dc-5a14-8046-f47f082b4065} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {94996ddd-cdc3-5617-a625-3052726c4654} <- Manufacturer + ProductSku {ef716fc4-b1b0-595c-b66e-1e3df6a0dc1d} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {b3930262-2a19-5f3f-adf0-b34629632fbb} <- Manufacturer + ProductName {2cdac0d6-d408-54ab-bf1e-a124b6c5425b} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {ca2e5189-1d32-509f-88a0-d4ebcc721899} <- Manufacturer + Family {aca387a9-183e-5da9-8f9d-f460c3f50f54} <- Manufacturer + EnclosureKind {fb899afb-72ea-5a6b-ae82-995730f73d6f} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {cc0aea32-ad2c-5013-8bed-cede6be8c9f4} <- Manufacturer Extra Hardware IDs ------------------ {abbf3314-7dde-5966-980c-a1be8cf163b8} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {587dab3d-0f40-5962-b043-6fc86e41cba2} <- Manufacturer + Family + ProductName + BiosVendor {9914cecc-aab7-570e-8fce-e86009ea6bbb} <- Manufacturer + BiosVendor lace-0.1.0/data/hwids/txt/x1p64100-acer-swift-sf14-11.txt000066400000000000000000000042101514263214500221620ustar00rootroot00000000000000Computer Information -------------------- BiosVendor: Insyde Corp. BiosVersion: V1.24 BiosMajorRelease: 0 BiosMinorRelease: 0 FirmwareMajorRelease: 01 FirmwareMinorRelease: 15 Manufacturer: Acer Family: Swift 14 AI ProductName: Swift SF14-11 ProductSku: EnclosureKind: a BaseboardManufacturer: SX1 BaseboardProduct: Bluetang_SX1 Hardware IDs ------------ {27d2dba8-e6f1-5c19-ba1c-c25a4744c161} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {676172cd-d185-53ed-aac6-245d0caa02c4} <- Manufacturer + Family + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {20c2cf2f-231c-5d02-ae9b-c837ab5653ed} <- Manufacturer + ProductName + BiosVendor + BiosVersion + BiosMajorRelease + BiosMinorRelease {f2ea7095-999d-5e5b-8f2a-4b636a1e399f} <- Manufacturer + Family + ProductName + ProductSku + BaseboardManufacturer + BaseboardProduct {331d7526-8b88-5923-bf98-450cf3ea82a4} <- Manufacturer + Family + ProductName + ProductSku {98ad068a-f812-5f13-920c-3ff3d34d263f} <- Manufacturer + Family + ProductName {3f49141c-d8fb-5a6f-8b4a-074a2397874d} <- Manufacturer + ProductSku + BaseboardManufacturer + BaseboardProduct {7c107a7f-2d77-51aa-aef8-8d777e26ffbc} <- Manufacturer + ProductSku {6a12c9bc-bcfa-5448-9f66-4159dbe8c326} <- Manufacturer + ProductName + BaseboardManufacturer + BaseboardProduct {f55122fb-303f-58bc-b342-6ef653956d1d} <- Manufacturer + ProductName {ee8fa049-e5f4-51e4-89d8-89a0140b8f38} <- Manufacturer + Family + BaseboardManufacturer + BaseboardProduct {4cdff732-fd0c-5bac-b33e-9002788ea557} <- Manufacturer + Family {92dcc94d-48f7-5ee8-b9ec-a6393fb7a484} <- Manufacturer + EnclosureKind {32f83b0f-1fad-5be2-88be-5ab020e7a70e} <- Manufacturer + BaseboardManufacturer + BaseboardProduct {1e301734-5d49-5df4-9ed2-aa1c0a9dddda} <- Manufacturer Extra Hardware IDs ------------------ {058c0739-1843-5a10-bab7-fae8aaf30add} <- Manufacturer + Family + ProductName + ProductSku + BiosVendor {100917f4-9c0a-5ac3-a297-794222da9bc9} <- Manufacturer + Family + ProductName + BiosVendor {86654360-65f0-5935-bc87-81102c6a022b} <- Manufacturer + BiosVendor lace-0.1.0/deny.toml000066400000000000000000000272561514263214500142670ustar00rootroot00000000000000# This template contains all of the possible sections and their default values # Note that all fields that take a lint level have these possible values: # * deny - An error will be produced and the check will fail # * warn - A warning will be produced, but the check will not fail # * allow - No warning or error will be produced, though in some cases a note # will be # The values provided in this template are the default values that will be used # when any section or field is not specified in your own configuration # Root options # The graph table configures how the dependency graph is constructed and thus # which crates the checks are performed against [graph] # If 1 or more target triples (and optionally, target_features) are specified, # only the specified targets will be checked when running `cargo deny check`. # This means, if a particular package is only ever used as a target specific # dependency, such as, for example, the `nix` crate only being used via the # `target_family = "unix"` configuration, that only having windows targets in # this list would mean the nix crate, as well as any of its exclusive # dependencies not shared by any other crates, would be ignored, as the target # list here is effectively saying which targets you are building for. targets = [ # The triple can be any string, but only the target triples built in to # rustc (as of 1.40) can be checked against actual config expressions #"x86_64-unknown-linux-musl", # You can also specify which target_features you promise are enabled for a # particular target. target_features are currently not validated against # the actual valid features supported by the target architecture. #{ triple = "wasm32-unknown-unknown", features = ["atomics"] }, ] # When creating the dependency graph used as the source of truth when checks are # executed, this field can be used to prune crates from the graph, removing them # from the view of cargo-deny. This is an extremely heavy hammer, as if a crate # is pruned from the graph, all of its dependencies will also be pruned unless # they are connected to another crate in the graph that hasn't been pruned, # so it should be used with care. The identifiers are [Package ID Specifications] # (https://doc.rust-lang.org/cargo/reference/pkgid-spec.html) #exclude = [] # If true, metadata will be collected with `--all-features`. Note that this can't # be toggled off if true, if you want to conditionally enable `--all-features` it # is recommended to pass `--all-features` on the cmd line instead all-features = false # If true, metadata will be collected with `--no-default-features`. The same # caveat with `all-features` applies no-default-features = false # If set, these feature will be enabled when collecting metadata. If `--features` # is specified on the cmd line they will take precedence over this option. #features = [] # The output table provides options for how/if diagnostics are outputted [output] # When outputting inclusion graphs in diagnostics that include features, this # option can be used to specify the depth at which feature edges will be added. # This option is included since the graphs can be quite large and the addition # of features from the crate(s) to all of the graph roots can be far too verbose. # This option can be overridden via `--feature-depth` on the cmd line feature-depth = 1 # This section is considered when running `cargo deny check advisories` # More documentation for the advisories section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html [advisories] # The path where the advisory databases are cloned/fetched into #db-path = "$CARGO_HOME/advisory-dbs" # The url(s) of the advisory databases to use #db-urls = ["https://github.com/rustsec/advisory-db"] # A list of advisory IDs to ignore. Note that ignored advisories will still # output a note when they are encountered. ignore = [ #"RUSTSEC-0000-0000", #{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" }, #"a-crate-that-is-yanked@0.1.1", # you can also ignore yanked crate versions if you wish #{ crate = "a-crate-that-is-yanked@0.1.1", reason = "you can specify why you are ignoring the yanked crate" }, ] # If this is true, then cargo deny will use the git executable to fetch advisory database. # If this is false, then it uses a built-in git library. # Setting this to true can be helpful if you have special authentication requirements that cargo-deny does not support. # See Git Authentication for more information about setting up git authentication. #git-fetch-with-cli = true # This section is considered when running `cargo deny check licenses` # More documentation for the licenses section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html [licenses] # List of explicitly allowed licenses # See https://spdx.org/licenses/ for list of possible licenses # [possible values: any SPDX 3.11 short identifier (+ optional exception)]. allow = [ "BSD-2-Clause", "MIT", "MPL-2.0", "Zlib", "Unicode-3.0", ] # The confidence threshold for detecting a license from license text. # The higher the value, the more closely the license text must be to the # canonical license text of a valid SPDX license file. # [possible values: any between 0.0 and 1.0]. confidence-threshold = 0.8 # Allow 1 or more licenses on a per-crate basis, so that particular licenses # aren't accepted for every possible crate as with the normal allow list exceptions = [ # Work around the inability to specify "GPL-2.0-only or GPL-3.0 only" # https://github.com/EmbarkStudios/cargo-deny/issues/827 { allow = ["GPL-2.0-only"], crate = "xtask" }, { allow = ["GPL-2.0-only"], crate = "pewrap" }, { allow = ["GPL-2.0-only"], crate = "fakeedid" }, { allow = ["GPL-2.0-only"], crate = "collect-hwids" }, { allow = ["GPL-2.0-only"], crate = "lace-stubble" }, { allow = ["GPL-2.0-only"], crate = "lace-platform" }, { allow = ["GPL-2.0-only"], crate = "lace-util" }, { allow = ["GPL-2.0-only"], crate = "lace-util-derive" }, { allow = ["GPL-2.0-only"], crate = "lace-fit" }, { allow = ["GPL-2.0-only"], crate = "lace-boot" }, { allow = ["GPL-2.0-only"], crate = "u-boot-sys" }, ] # Some crates don't have (easily) machine readable licensing information, # adding a clarification entry for it allows you to manually specify the # licensing information #[[licenses.clarify]] # The package spec the clarification applies to #crate = "ring" # The SPDX expression for the license requirements of the crate #expression = "MIT AND ISC AND OpenSSL" # One or more files in the crate's source used as the "source of truth" for # the license expression. If the contents match, the clarification will be used # when running the license check, otherwise the clarification will be ignored # and the crate will be checked normally, which may produce warnings or errors # depending on the rest of your configuration #license-files = [ # Each entry is a crate relative path, and the (opaque) hash of its contents #{ path = "LICENSE", hash = 0xbd0eed23 } #] [licenses.private] # If true, ignores workspace crates that aren't published, or are only # published to private registries. # To see how to mark a crate as unpublished (to the official registry), # visit https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field. ignore = true # One or more private registries that you might publish crates to, if a crate # is only published to private registries, and ignore is true, the crate will # not have its license(s) checked registries = [ #"https://sekretz.com/registry ] # This section is considered when running `cargo deny check bans`. # More documentation about the 'bans' section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html [bans] # Lint level for when multiple versions of the same crate are detected multiple-versions = "warn" # Lint level for when a crate version requirement is `*` wildcards = "allow" # The graph highlighting used when creating dotgraphs for crates # with multiple versions # * lowest-version - The path to the lowest versioned duplicate is highlighted # * simplest-path - The path to the version with the fewest edges is highlighted # * all - Both lowest-version and simplest-path are used highlight = "all" # The default lint level for `default` features for crates that are members of # the workspace that is being checked. This can be overridden by allowing/denying # `default` on a crate-by-crate basis if desired. workspace-default-features = "allow" # The default lint level for `default` features for external crates that are not # members of the workspace. This can be overridden by allowing/denying `default` # on a crate-by-crate basis if desired. external-default-features = "allow" # List of crates that are allowed. Use with care! allow = [ #"ansi_term@0.11.0", #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason it is allowed" }, ] # If true, workspace members are automatically allowed even when using deny-by-default # This is useful for organizations that want to deny all external dependencies by default # but allow their own workspace crates without having to explicitly list them allow-workspace = true # List of crates to deny deny = [ #"ansi_term@0.11.0", #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason it is banned" }, # Wrapper crates can optionally be specified to allow the crate when it # is a direct dependency of the otherwise banned crate #{ crate = "ansi_term@0.11.0", wrappers = ["this-crate-directly-depends-on-ansi_term"] }, ] # List of features to allow/deny # Each entry the name of a crate and a version range. If version is # not specified, all versions will be matched. #[[bans.features]] #crate = "reqwest" # Features to not allow #deny = ["json"] # Features to allow #allow = [ # "rustls", # "__rustls", # "__tls", # "hyper-rustls", # "rustls", # "rustls-pemfile", # "rustls-tls-webpki-roots", # "tokio-rustls", # "webpki-roots", #] # If true, the allowed features must exactly match the enabled feature set. If # this is set there is no point setting `deny` #exact = true # Certain crates/versions that will be skipped when doing duplicate detection. skip = [ #"ansi_term@0.11.0", #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason why it can't be updated/removed" }, ] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive # dependencies starting at the specified crate, up to a certain depth, which is # by default infinite. skip-tree = [ #"ansi_term@0.11.0", # will be skipped along with _all_ of its direct and transitive dependencies #{ crate = "ansi_term@0.11.0", depth = 20 }, ] # This section is considered when running `cargo deny check sources`. # More documentation about the 'sources' section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html [sources] # Lint level for what to happen when a crate from a crate registry that is not # in the allow list is encountered unknown-registry = "warn" # Lint level for what to happen when a crate from a git repository that is not # in the allow list is encountered unknown-git = "warn" # List of URLs for allowed crate registries. Defaults to the crates.io index # if not specified. If it is specified but empty, no registries are allowed. allow-registry = ["https://github.com/rust-lang/crates.io-index"] # List of URLs for allowed Git repositories allow-git = [] [sources.allow-org] # github.com organizations to allow git sources for github = [] # gitlab.com organizations to allow git sources for gitlab = [] # bitbucket.org organizations to allow git sources for bitbucket = [] lace-0.1.0/lace-platform/000077500000000000000000000000001514263214500151455ustar00rootroot00000000000000lace-0.1.0/lace-platform/Cargo.toml000066400000000000000000000007511514263214500171000ustar00rootroot00000000000000[package] name = "lace-platform" version = "0.1.0" edition = "2024" license = "GPL-2.0-only OR GPL-3.0-only" [dependencies] bitflags = "2.10.0" lace-util = { version = "0.1.0", path = "../lace-util", default-features = false } lace-util-derive = { version = "0.1.0", path = "../lace-util-derive" } spin = "0.10.0" uefi = { version = "0.36.1", optional = true } uefi-raw = { version = "0.13.0", optional = true } [features] default = ["mock"] efi = ["dep:uefi", "dep:uefi-raw"] mock = [] lace-0.1.0/lace-platform/src/000077500000000000000000000000001514263214500157345ustar00rootroot00000000000000lace-0.1.0/lace-platform/src/efi/000077500000000000000000000000001514263214500164775ustar00rootroot00000000000000lace-0.1.0/lace-platform/src/efi/dtb.rs000066400000000000000000000063351514263214500176250ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Device tree related EFI functionality. use crate::efi::mem::{ MemoryType, PageAllocation, PageAllocationConstraint, PageAllocationIface, page_count, }; use crate::efi::open_protocol_exclusive; use crate::efi::proto::dt_fixup; use lace_util::fdt::Fdt; /// EFI configuration table pointing to a device tree. /// The DTB must be contained in memory of type EfiACPIReclaimMemory. /// Ref: 4.6.1.3. Devicetree Tables pub const DTB_TABLE_GUID: uefi::Guid = uefi::guid!("b1b621d5-f19c-41a5-830b-d9152c69aae0"); /// A receipt for an installed device tree configuration table. /// When dropped, the configuration table is removed from the EFI system table, /// and the memory holding the table is freed safely. struct DtbReceipt { guid: &'static uefi::Guid, _buf: PageAllocation, } impl Drop for DtbReceipt { fn drop(&mut self) { unsafe { // SAFETY: We are removing the configuration table that was installed // when this receipt was created. // After this the page allocation holding the table can be dropped safely. let _ = uefi::boot::install_configuration_table(self.guid, core::ptr::null()); } } } /// Install the given DTB as a configuration table into the EFI system table. /// The returned `DtbReceipt` will own the DTB, ensuring the configuration table /// is removed if and only if the receipt is dropped. /// # Safety /// This function can be used to invalidate an existing DTB configuration table, /// which other code might have references to. The caller must ensure that /// no such references exist. pub unsafe fn install_dtb(dtb: &[u8]) -> Result { let buf: PageAllocation = match open_protocol_exclusive::() { Ok(mut proto) => proto.fixup_owned(dtb)?, Err(_) => PageAllocation::new_init_prefix( PageAllocationConstraint::AnyAddress, Some(MemoryType::ACPI_RECLAIM), page_count(dtb.len()), None, dtb, )?, }; unsafe { // SAFETY: table_ptr is valid for the lifetime of the returned DtbReceipt. // When DtbReceipt is dropped, the DTB entry is removed from the system table, // and only then is the memory freed. uefi::boot::install_configuration_table( &DTB_TABLE_GUID, buf.as_ptr() as *const core::ffi::c_void, )? }; Ok(DtbReceipt { guid: &DTB_TABLE_GUID, _buf: buf, }) } /// Find the installed DTB from the EFI system table. /// Returns `None` if no DTB configuration table is installed (or if the DTB is invalid). /// # Safety /// The returned `Fdt` is valid as long as the DTB configuration table remains installed /// in the EFI system table. The caller must ensure this is the case. pub unsafe fn find_dtb() -> Option> { let ptr: *const u8 = super::find_config_table(DTB_TABLE_GUID)?; unsafe { // SAFETY: The pointer from the configuration table is valid as long as the table is installed, // which is guaranteed by the caller. Fdt::from_ptr(ptr).ok() } } lace-0.1.0/lace-platform/src/efi/image.rs000066400000000000000000000222621514263214500201330ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! EFI image loading. use super::mem::{ MemoryType, PageAllocation, PageAllocationConstraint, PageAllocationIface, page_count, }; use core::{ffi::c_void, fmt::Display}; use lace_util::{align_up, peimage}; /// Represents a loaded EFI image. pub struct LaceLoadedImage { pages: PageAllocation, image_size: usize, entry_point: usize, } /// Errors that can occur while loading an EFI image. #[derive(Debug)] pub enum LaceLoadImageError { PeError(peimage::PeError), NxPolicyViolation, MemoryAllocationError(uefi::Error), MemoryAttributeError(uefi::Error), } impl Display for LaceLoadImageError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { LaceLoadImageError::PeError(e) => write!(f, "PE parsing error: {}", e), LaceLoadImageError::MemoryAllocationError(e) => { write!(f, "memory allocation error: {}", e) } LaceLoadImageError::NxPolicyViolation => { write!(f, "NX compatibility policy violation") } LaceLoadImageError::MemoryAttributeError(e) => { write!(f, "failed to change memory attributes: {}", e) } } } } /// Raw representation of the UEFI Loaded Image Protocol. /// This is needed so that we can locate it using uefi-rs but still modify its fields directly. #[repr(transparent)] struct RawLoadedImage(uefi_raw::protocol::loaded_image::LoadedImageProtocol); unsafe impl uefi::Identify for RawLoadedImage { const GUID: uefi::Guid = uefi_raw::protocol::loaded_image::LoadedImageProtocol::GUID; } impl uefi::proto::Protocol for RawLoadedImage {} impl LaceLoadedImage { /// Loads an EFI image from the given byte slice. pub fn load(image: &[u8]) -> Result { let pe = peimage::parse_pe(image).map_err(LaceLoadImageError::PeError)?; let nx_compat = pe.nt_hdrs.optional_header.dll_characteristics & peimage::DLLCHARACTERISTICS_NX_COMPAT != 0; if super::mem::nx_required() && !nx_compat { // NX is required but the image is not NX compatible. return Err(LaceLoadImageError::NxPolicyViolation); } // NX compatibility requires page-aligned image size. if nx_compat && ((pe.nt_hdrs.optional_header.section_alignment as usize) < super::mem::PAGE_SIZE || !(pe.nt_hdrs.optional_header.section_alignment as usize) .is_multiple_of(super::mem::PAGE_SIZE)) { return Err(LaceLoadImageError::NxPolicyViolation); } let mut pages = PageAllocation::new_zeroed( PageAllocationConstraint::AnyAddress, Some(MemoryType::LOADER_CODE), page_count(pe.nt_hdrs.optional_header.size_of_image as usize), None, ) .map_err(LaceLoadImageError::MemoryAllocationError)?; let image_base = pages.as_ptr() as u64; let alloc_size = pages.pages() * super::mem::PAGE_SIZE; // If the image is NX compatible set the base policy as EXECUTE_PROTECT, otherwise no protection. let base_attrs = if nx_compat { super::mem::MemAttributes::EXECUTE_PROTECT } else { super::mem::MemAttributes::empty() }; crate::debugln!("Setting base memory attributes: {:?}", base_attrs); super::mem::change_mem_attrs(image_base..(image_base + alloc_size as u64), base_attrs) .map_err(LaceLoadImageError::MemoryAttributeError)?; // Relocate the image into the allocated pages. pe.relocate_into(pages.as_u8_slice_mut()) .map_err(LaceLoadImageError::PeError)?; if nx_compat { // Set PE header as read-only. let pe_header_size = align_up!( pe.nt_hdrs.optional_header.size_of_headers as u64, super::mem::PAGE_SIZE as u64 ); crate::debugln!("Setting PE header memory attributes: WRITE_PROTECT | EXECUTE_PROTECT"); super::mem::change_mem_attrs( image_base..(image_base + pe_header_size), super::mem::MemAttributes::WRITE_PROTECT | super::mem::MemAttributes::EXECUTE_PROTECT, ) .map_err(LaceLoadImageError::MemoryAttributeError)?; // Set section-wise memory attributes. // We call raw_sections() here because `pe` is still in raw format, because // it does not point to the relocated image. This is fine because we only // need the section headers. for section in pe.raw_sections() { let (shdr, _) = section.map_err(LaceLoadImageError::PeError)?; let sec_start = image_base + shdr.virtual_address as u64; let sec_end = sec_start + align_up!(shdr.virtual_size as u64, super::mem::PAGE_SIZE as u64); // NX requires section start to be page-aligned. if sec_start != align_up!(sec_start, super::mem::PAGE_SIZE as u64) { return Err(LaceLoadImageError::NxPolicyViolation); } // NX requires no W&X sections. if shdr.characteristics & peimage::SCN_MEM_WRITE != 0 && shdr.characteristics & peimage::SCN_MEM_EXECUTE != 0 { return Err(LaceLoadImageError::NxPolicyViolation); } // Set section attributes let mut attrs = super::mem::MemAttributes::empty(); if shdr.characteristics & peimage::SCN_MEM_READ == 0 { // Not readable attrs |= super::mem::MemAttributes::READ_PROTECT; } if shdr.characteristics & peimage::SCN_MEM_WRITE == 0 { // Not writable attrs |= super::mem::MemAttributes::WRITE_PROTECT; } if shdr.characteristics & peimage::SCN_MEM_EXECUTE == 0 { // Not executable attrs |= super::mem::MemAttributes::EXECUTE_PROTECT; } crate::debugln!( "Setting section memory attributes for section at {:#x}-{:#x}: {:?}", sec_start, sec_end, attrs ); super::mem::change_mem_attrs(sec_start..sec_end, attrs) .map_err(LaceLoadImageError::MemoryAttributeError)?; } } crate::debugln!( "Loaded EFI image at {:p}, size {:#x}", pages.as_ptr(), pe.nt_hdrs.optional_header.size_of_image ); Ok(LaceLoadedImage { pages, image_size: pe.nt_hdrs.optional_header.size_of_image as usize, entry_point: pe.nt_hdrs.optional_header.address_of_entry_point as usize, }) } /// Starts execution of the loaded EFI image. pub fn start(self, cmdline_utf16: Option<&[u16]>) -> ! { // Re-use parent loaded image and modify it to point to the new image base and size. let handle = uefi::boot::image_handle(); let mut li = unsafe { uefi::boot::open_protocol::( uefi::boot::OpenProtocolParams { handle, agent: handle, controller: None, }, uefi::boot::OpenProtocolAttributes::GetProtocol, ) // Let this panic here, this is not a condition that can happen on any // non completely broken UEFI implementation. .expect("cannot find our own loaded image") }; // NOTE: from here on we modify the loaded image in-place, and shouldn't return. // If we wanted to be able to return, we would need to save and restore // the original values, but all fallible operations have already been done. li.0.device_handle = core::ptr::null_mut(); li.0.file_path = core::ptr::null(); li.0.image_base = self.pages.as_ptr() as *const c_void; li.0.image_size = self.image_size as u64; if let Some(cmdline_utf16) = cmdline_utf16 { // SAFETY: cmdline_utf16 lives through the rest of this function, // and at this point we can no longer return. li.0.load_options = cmdline_utf16.as_ptr() as *const c_void; li.0.load_options_size = core::mem::size_of_val(cmdline_utf16) as u32; } // Start the kernel image unsafe { // SAFETY: entry point is valid as we have relocated the image correctly. type EntryFn = extern "efiapi" fn( uefi_raw::Handle, *mut uefi_raw::table::system::SystemTable, ) -> uefi_raw::Status; let entry: EntryFn = core::mem::transmute(self.pages.as_ptr().add(self.entry_point)); let _ = entry( handle.as_ptr(), uefi::table::system_table_raw().unwrap().as_mut(), ); } panic!("fatal: kernel returned"); } } lace-0.1.0/lace-platform/src/efi/linux.rs000066400000000000000000000135371514263214500202150ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Linux bootloader support. use super::image::{LaceLoadImageError, LaceLoadedImage}; use alloc::boxed::Box; use alloc::vec::Vec; use core::{ffi::c_void, fmt::Display}; #[derive(Debug)] pub enum BootLinuxError { LoadKernelError(LaceLoadImageError), LoadInitrdError(uefi::Error), } impl Display for BootLinuxError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { BootLinuxError::LoadKernelError(e) => write!(f, "failed to load kernel image: {}", e), BootLinuxError::LoadInitrdError(e) => write!(f, "failed to load initrd image: {}", e), } } } /// Boots a Linux kernel given in PE format, with optional initrd and command line. /// Note that this function does not perform any signature verification of the kernel or initrd, /// the caller is responsible for ensuring their authenticity. pub fn boot_linux( kernel: &[u8], initrd: Option<&[u8]>, cmdline: Option<&str>, ) -> Result<(), BootLinuxError> { // Load initrd (this will create a handle with a special device path the kernel searches for) let _initrd_loader = if let Some(initrd) = initrd { Some(InitrdLoader::load(initrd).map_err(BootLinuxError::LoadInitrdError)?) } else { None }; // Convert command line to UTF-16 let cmdline_utf16 = if let Some(cmdline) = cmdline { let mut cmdline_utf16: Vec = Vec::new(); cmdline_utf16.extend(cmdline.encode_utf16()); cmdline_utf16.push(0); Some(cmdline_utf16) } else { None }; // Load kernel let lace_image = LaceLoadedImage::load(kernel).map_err(BootLinuxError::LoadKernelError)?; // Start the kernel lace_image.start(cmdline_utf16.as_deref()); } struct InitrdLoader<'initrd> { handle: uefi::Handle, lf2: Box>, dp: Box, } impl<'initrd> InitrdLoader<'initrd> { fn load(initrd: &'initrd [u8]) -> Result { let lf2 = InitrdLf2::new(initrd); let dp = InitrdMediaDp::new(); let handle = unsafe { let handle = uefi::boot::install_protocol_interface( None, &uefi_raw::protocol::media::LoadFile2Protocol::GUID, &*lf2 as *const InitrdLf2 as *const c_void, )?; uefi::boot::install_protocol_interface( Some(handle), &uefi_raw::protocol::device_path::DevicePathProtocol::GUID, &*dp as *const InitrdMediaDp as *const c_void, )?; handle }; Ok(Self { handle, lf2, dp }) } } impl<'initrd> Drop for InitrdLoader<'initrd> { fn drop(&mut self) { unsafe { let _ = uefi::boot::uninstall_protocol_interface( self.handle, &uefi_raw::protocol::media::LoadFile2Protocol::GUID, &*self.lf2 as *const InitrdLf2 as *const c_void, ); let _ = uefi::boot::uninstall_protocol_interface( self.handle, &uefi_raw::protocol::device_path::DevicePathProtocol::GUID, &*self.dp as *const InitrdMediaDp as *const c_void, ); } } } #[repr(C)] struct InitrdLf2<'initrd> { lf2: uefi_raw::protocol::media::LoadFile2Protocol, initrd: &'initrd [u8], } impl<'initrd> InitrdLf2<'initrd> { fn new(initrd: &'initrd [u8]) -> Box { Self { lf2: uefi_raw::protocol::media::LoadFile2Protocol { load_file: Self::efi_load_file, }, initrd, } .into() } extern "efiapi" fn efi_load_file( this: *mut uefi_raw::protocol::media::LoadFile2Protocol, _file_path: *const uefi_raw::protocol::device_path::DevicePathProtocol, _boot_policy: uefi_raw::Boolean, buffer_size: *mut usize, buffer: *mut c_void, ) -> uefi_raw::Status { unsafe { let this = &mut *(this as *mut InitrdLf2); let initrd_len = this.initrd.len(); if *buffer_size < initrd_len { *buffer_size = initrd_len; return uefi_raw::Status::BUFFER_TOO_SMALL; } core::slice::from_raw_parts_mut(buffer as *mut u8, initrd_len) .copy_from_slice(this.initrd); uefi_raw::Status::SUCCESS } } } #[repr(C, packed)] struct InitrdMediaDp { /// Vendor media node ven: InitrdMediaVendorDp, /// End node end: uefi_raw::protocol::device_path::DevicePathProtocol, } #[repr(C, packed)] struct InitrdMediaVendorDp { /// Node header hdr: uefi_raw::protocol::device_path::DevicePathProtocol, /// LINUX_EFI_INITRD_MEDIA_GUID guid: uefi_raw::Guid, } const LINUX_EFI_INITRD_MEDIA_GUID: uefi_raw::Guid = uefi_raw::guid!("5568e427-68fc-4f3d-ac74-ca555231cc68"); impl InitrdMediaDp { fn new() -> Box { Self { ven: InitrdMediaVendorDp { hdr: uefi_raw::protocol::device_path::DevicePathProtocol { major_type: uefi::proto::device_path::DeviceType::MEDIA, sub_type: uefi::proto::device_path::DeviceSubType::MEDIA_VENDOR, length: [size_of::() as u8, 0], }, guid: LINUX_EFI_INITRD_MEDIA_GUID, }, end: uefi_raw::protocol::device_path::DevicePathProtocol { major_type: uefi::proto::device_path::DeviceType::END, sub_type: uefi::proto::device_path::DeviceSubType::END_ENTIRE, length: [ size_of::() as u8, 0, ], }, } .into() } } lace-0.1.0/lace-platform/src/efi/mem.rs000066400000000000000000000205461514263214500176320ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! UEFI memory management utilities. use lace_util::peimage; use uefi::boot::ScopedProtocol; pub use crate::iface::mem::{MemAttributes, PageAllocationConstraint, PageAllocationIface}; use core::ptr::NonNull; /// Type alias for UEFI physical addresses. pub type Address = u64; /// Page size used by the UEFI boot services page allocator. pub const PAGE_SIZE: usize = uefi::boot::PAGE_SIZE; /// Computes the number of pages required to hold a given size in bytes, /// rounding up to the nearest page. pub const fn page_count(size: usize) -> usize { size.div_ceil(PAGE_SIZE) } /// Type alias for UEFI boot services page allocation types. pub type AllocateType = uefi::boot::AllocateType; /// Type alias for UEFI boot services memory types. pub type MemoryType = uefi::boot::MemoryType; /// Conversion from UEFI boot services page allocation types to generic page allocation constraints. impl From> for uefi::boot::AllocateType { fn from(value: PageAllocationConstraint
) -> Self { match value { PageAllocationConstraint::AnyAddress => uefi::boot::AllocateType::AnyPages, PageAllocationConstraint::MaxAddress(addr) => { uefi::boot::AllocateType::MaxAddress(addr) } PageAllocationConstraint::FixedAddress(addr) => uefi::boot::AllocateType::Address(addr), } } } /// Resource holder for an allocation from the UEFI boot services page allocator. pub struct PageAllocation { ptr: NonNull, pages: usize, } impl PageAllocationIface
for PageAllocation { const PAGE_SIZE: usize = PAGE_SIZE; type MemoryType = MemoryType; type Error = uefi::Error; unsafe fn new_uninit( constraint: PageAllocationConstraint
, memory_type: Option, pages: usize, alignment: Option, ) -> Result { // UEFI boot services only guarantee page-aligned memory. // Reject requests for larger alignment. if let Some(align) = alignment && align > PAGE_SIZE { return Err(uefi::Error::new(uefi::Status::UNSUPPORTED, ())); } let memory_type = memory_type.unwrap_or(MemoryType::LOADER_DATA); let ptr = uefi::boot::allocate_pages(constraint.into(), memory_type, pages)?; Ok(PageAllocation { ptr, pages }) } fn pages(&self) -> usize { self.pages } unsafe fn from_raw(ptr: NonNull, pages: usize) -> Self { PageAllocation { ptr, pages } } fn into_raw(self) -> (NonNull, usize) { let (ptr, pages) = (self.ptr, self.pages); core::mem::forget(self); (ptr, pages) } fn as_ptr(&self) -> *mut u8 { self.ptr.as_ptr() } fn as_u8_slice(&self) -> &[u8] { unsafe { // SAFETY: `ptr` was allocated with `boot::allocate_pages` and is valid for `pages` pages. // The resulting slice will have a lifetime tied to &self, so it cannot outlive the allocation. // The memory might be uninitialized, but any value of a byte is valid for u8. core::slice::from_raw_parts(self.ptr.as_ptr(), self.pages * PAGE_SIZE) } } fn as_u8_slice_mut(&mut self) -> &mut [u8] { unsafe { // SAFETY: `ptr` was allocated with `boot::allocate_pages` and is valid for `pages` pages. // The resulting slice will have a lifetime tied to &mut self, so it cannot outlive the allocation. // The memory might be uninitialized, but any value of a byte is valid for u8. core::slice::from_raw_parts_mut(self.ptr.as_ptr(), self.pages * PAGE_SIZE) } } } impl Drop for PageAllocation { fn drop(&mut self) { // Set memory as RWX before freeing. This is a workaround for an EDK2 bug // where freeing memory with certain attributes set can cause a crash. // See: https://github.com/rhboot/shim/blob/c4665d282072df2ed8ab6ae1d5fa0de41e5db02f/loader-proto.c#L194 crate::debugln!("WORKAROUND: Clearing memory attributes before freeing pages"); let _ = change_mem_attrs( self.as_ptr() as u64..(self.as_ptr() as u64 + (self.pages * PAGE_SIZE) as u64), MemAttributes::empty(), ); unsafe { // SAFETY: `ptr` was allocated with `uefi::boot::allocate_pages` and is valid for `pages` pages let _ = uefi::boot::free_pages(self.ptr, self.pages); } } } /// Change memory attributes for the given address range. /// Note that this is best-effort, if the Memory Protection Protocol is not available, /// this function will simply return without making any changes. pub fn change_mem_attrs( addr_range: core::ops::Range, attrs: MemAttributes, ) -> Result<(), uefi::Error> { let Ok(mem_prot) = super::open_protocol_exclusive::() else { crate::debugln!( "EFI Memory Protection Protocol not available, cannot change memory attributes" ); return Ok(()); }; let (set, clear) = lace_mem_attrs_to_uefi(&attrs); if !set.is_empty() { crate::debugln!( "Setting EFI memory attributes for range {:x}-{:x} to {:?}", addr_range.start, addr_range.end, set ); mem_prot.set_memory_attributes(addr_range.clone(), set)?; } if !clear.is_empty() { crate::debugln!( "Clearing EFI memory attributes for range {:x}-{:x} to {:?}", addr_range.start, addr_range.end, clear ); mem_prot.clear_memory_attributes(addr_range, clear)?; } Ok(()) } /// Converts Lace MemAttributes to UEFI MemoryAttribute sets for setting and clearing. fn lace_mem_attrs_to_uefi( attrs: &MemAttributes, ) -> (uefi::boot::MemoryAttribute, uefi::boot::MemoryAttribute) { let mut set_attrs = uefi::boot::MemoryAttribute::empty(); let mut clear_attrs = uefi::boot::MemoryAttribute::empty(); if attrs.contains(MemAttributes::READ_PROTECT) { set_attrs |= uefi::boot::MemoryAttribute::READ_PROTECT; } else { clear_attrs |= uefi::boot::MemoryAttribute::READ_PROTECT; } if attrs.contains(MemAttributes::WRITE_PROTECT) { set_attrs |= uefi::boot::MemoryAttribute::READ_ONLY; } else { clear_attrs |= uefi::boot::MemoryAttribute::READ_ONLY; } if attrs.contains(MemAttributes::EXECUTE_PROTECT) { set_attrs |= uefi::boot::MemoryAttribute::EXECUTE_PROTECT; } else { clear_attrs |= uefi::boot::MemoryAttribute::EXECUTE_PROTECT; } (set_attrs, clear_attrs) } /// Flag indicating whether NX is required by the firmware. static NX_REQUIRED: spin::Once = spin::Once::new(); /// Returns whether NX is required by platform policy. pub fn nx_required() -> bool { *NX_REQUIRED.get().unwrap() } /// Initialize UEFI memory management utilities. pub(super) fn efi_mem_init() { // Determine if NX is required by the firmware. // We use the NX_COMPAT flag in the currently running image as a proxy. // 1. If an NX_COMPAT image is already running the firmware _might_ enforce NX thus we should too. // Relaxing this to check if we are running on non-NX firmware could be useful, // so that an NX image can chainload non-NX in that limited scenario, but // that is not implemented currently. (And not required for the stubble use case.) // 2. If we are not currently running an NX_COMPAT image, then NX is obviously not required. let own_li: ScopedProtocol = uefi::boot::open_protocol_exclusive(uefi::boot::image_handle()) .expect("own loaded image protocol missing"); let own_pe = peimage::parse_pe(unsafe { // SAFETY: this is valid in this function, because we exclusively hold the loaded image. let (base, len) = own_li.info(); core::slice::from_raw_parts(base as *const u8, len as usize) }) .expect("own PE image malformed"); let nx_required = own_pe.nt_hdrs.optional_header.dll_characteristics & peimage::DLLCHARACTERISTICS_NX_COMPAT != 0; crate::debugln!("EFI memory: NX required = {}", nx_required); NX_REQUIRED.call_once(|| nx_required); } lace-0.1.0/lace-platform/src/efi/mod.rs000066400000000000000000000070761514263214500176360ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! UEFI platform abstractions. use core::fmt::{self, Write}; use core::ops::Deref; use lace_util::smbios::{Smbios3EntryPoint, SmbiosEntryPoint}; pub mod dtb; pub mod image; pub mod linux; pub mod mem; pub mod proto; use proto::edid_discovered::EdidDiscoveredProtocol; /// Platform specific error type pub use uefi::Error; /// Platform specific text output pub fn print_impl(args: fmt::Arguments<'_>) { uefi::system::with_stdout(|stdout| { let _ = write!(stdout, "{}", args); }); } /// Platform specific text output with newline pub fn println_impl(args: fmt::Arguments<'_>) { uefi::system::with_stdout(|stdout| { let _ = writeln!(stdout, "{}", args); }); } /// Opens the first instance of the given protocol in exclusive mode. pub fn open_protocol_exclusive() -> Result, uefi::Error> { let handle_buf = uefi::boot::locate_handle_buffer(uefi::boot::SearchType::ByProtocol(&T::GUID))?; // SAFETY: locate_handle_buffer() returns EFI_NOT_FOUND if no handles are found. uefi::boot::open_protocol_exclusive::(handle_buf[0]) } /// Finds a configuration table by its GUID. pub fn find_config_table(guid: uefi::Guid) -> Option<*const T> { uefi::system::with_config_table(|tables| { for table in tables.iter() { if table.guid.eq(&guid) && !table.address.is_null() { return Some(table.address as *const T); } } None }) } /// Opaque reference to EDID data obtained from the EDID Discovered Protocol. struct EdidRef(uefi::boot::ScopedProtocol); impl Deref for EdidRef { type Target = [u8]; fn deref(&self) -> &Self::Target { self.0.edid_data() } } /// Finds the first EDID Discovered Protocol instance and returns the EDID data attached to it. pub fn find_edid() -> Option> { open_protocol_exclusive::() .ok() .map(EdidRef) } /// Finds SMBIOS tables in the UEFI configuration tables. pub fn find_smbios_tables() -> Option<(&'static [u8], &'static [u8])> { unsafe { if let Some(ptr) = find_config_table::(uefi::table::cfg::ConfigTableEntry::SMBIOS3_GUID) && (*ptr).anchor_string.eq(b"_SM3_") { return Some(( core::slice::from_raw_parts(ptr as *const u8, size_of::()), core::slice::from_raw_parts( (*ptr).table_address as *const u8, (*ptr).table_maximum_size as _, ), )); } if let Some(ptr) = find_config_table::(uefi::table::cfg::ConfigTableEntry::SMBIOS_GUID) && (*ptr).anchor_string.eq(b"_SM_") { return Some(( core::slice::from_raw_parts(ptr as *const u8, size_of::()), core::slice::from_raw_parts((*ptr).table_address as _, (*ptr).table_length as _), )); } } None } /// EFI main function, initializes global state and calls the application entry point. #[uefi::entry] fn efi_main() -> uefi::Status { uefi::helpers::init().unwrap(); mem::efi_mem_init(); unsafe extern "Rust" { fn main() -> Result<(), Error>; } match unsafe { main() } { Ok(()) => uefi::Status::SUCCESS, Err(e) => e.status(), } } lace-0.1.0/lace-platform/src/efi/proto/000077500000000000000000000000001514263214500176425ustar00rootroot00000000000000lace-0.1.0/lace-platform/src/efi/proto/dt_fixup.rs000066400000000000000000000065571514263214500220470ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! EFI device-tree fix-up protocol. use crate::efi::mem::{ MemoryType, PageAllocation, PageAllocationConstraint, PageAllocationIface, page_count, }; /// The EFI device-tree fix-up protocol provides a function to let the firmware apply fix-ups. /// Ref: https://github.com/U-Boot-EFI/EFI_DT_FIXUP_PROTOCOL pub struct DtFixupProtocol { pub revision: u64, pub fixup: unsafe extern "efiapi" fn( *mut DtFixupProtocol, fdt: *mut core::ffi::c_void, buffer_size: *mut usize, flags: u32, ) -> uefi::Status, } /// Add nodes and update properties const DT_APPLY_FIXUPS: u32 = 0x00000001; /// Reserve memory according to the /reserved-memory node and the memory reservation block const EFI_DT_RESERVE_MEMORY: u32 = 0x00000002; unsafe impl uefi::Identify for DtFixupProtocol { const GUID: uefi::Guid = uefi::guid!("e617d64c-fe08-46da-f4dc-bbd5870c7300"); } impl uefi::proto::Protocol for DtFixupProtocol {} impl DtFixupProtocol { /// Apply fix-ups directly into the provided DTB buffer. /// On success, returns Ok(()). If the buffer is too small, returns Err with the required size. pub fn fixup(&mut self, dtb_buffer: &mut [u8]) -> uefi::Result<(), usize> { let mut buffer_size = dtb_buffer.len(); let status = unsafe { // SAFETY: buffer.as_mut_ptr() is valid for buffer_size bytes (self.fixup)( self, dtb_buffer.as_mut_ptr() as *mut core::ffi::c_void, &mut buffer_size, DT_APPLY_FIXUPS | EFI_DT_RESERVE_MEMORY, ) }; match status { uefi::Status::SUCCESS => Ok(()), uefi::Status::BUFFER_TOO_SMALL => Err(uefi::Error::new(status, buffer_size)), _ => Err(uefi::Error::new(status, 0)), } } /// Apply fix-ups into a newly allocated buffer, returning ownership of the buffer. pub fn fixup_owned(&mut self, dtb: &[u8]) -> uefi::Result { // Create buffer holding a copy of the dtb let mut buf = PageAllocation::new_init_prefix( PageAllocationConstraint::AnyAddress, Some(MemoryType::ACPI_RECLAIM), page_count(dtb.len()), None, dtb, )?; // Try to apply fixups, but we might get BUFFER_TOO_SMALL on // the first attempt match self.fixup(buf.as_u8_slice_mut()) { Ok(()) => { // Successfully applied fix-ups Ok(buf) } Err(e) if e.status() == uefi::Status::BUFFER_TOO_SMALL => { // Reallocate with correct size buf = PageAllocation::new_init_prefix( PageAllocationConstraint::AnyAddress, Some(MemoryType::ACPI_RECLAIM), page_count(*e.data()), None, dtb, )?; // We will not get BUFFER_TOO_SMALL this time self.fixup(buf.as_u8_slice_mut()) .map(|_| buf) .map_err(|e| e.to_err_without_payload()) } Err(e) => { // Any other error Err(e.to_err_without_payload()) } } } } lace-0.1.0/lace-platform/src/efi/proto/edid_discovered.rs000066400000000000000000000021531514263214500233250ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! UEFI EDID Discovered Protocol. /// This protocol contains the EDID information retrieved from a video output device. /// Ref: UEFI specification, 12.9.2.4. EFI_EDID_DISCOVERED_PROTOCOL #[repr(C)] pub struct EdidDiscoveredProtocol { pub size_of_edid: u32, pub edid: *const u8, } unsafe impl uefi::Identify for EdidDiscoveredProtocol { const GUID: uefi::Guid = uefi::guid!("1c0c34f6-d380-41fa-a049-8ad06c1a66aa"); } impl uefi::proto::Protocol for EdidDiscoveredProtocol {} impl EdidDiscoveredProtocol { /// Get the EDID data as a byte slice, if available. pub fn edid_data(&self) -> &[u8] { if self.size_of_edid == 0 || self.edid.is_null() { &[] } else { unsafe { // SAFETY: edid is a valid pointer to size_of_edid bytes. // The slice will have the same lifetime as &self. core::slice::from_raw_parts(self.edid, self.size_of_edid as usize) } } } } lace-0.1.0/lace-platform/src/efi/proto/mod.rs000066400000000000000000000003561514263214500207730ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Extra EFI protocol wrappers defined by Lace. pub mod dt_fixup; pub mod edid_discovered; lace-0.1.0/lace-platform/src/iface/000077500000000000000000000000001514263214500170035ustar00rootroot00000000000000lace-0.1.0/lace-platform/src/iface/mem.rs000066400000000000000000000125321514263214500201320ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Memory management interfaces. use core::{mem::MaybeUninit, ptr::NonNull}; /// Constraints for page allocations. /// Platforms need to provide support for at least `AnyAddress`. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PageAllocationConstraint
{ AnyAddress, MaxAddress(Address), FixedAddress(Address), } /// Interface trait for page allocations. /// Note that implementers are expected to also implement `Drop` to free the allocated pages. /// We cannot enforce this as a safety requirement because leaking memory is not unsafe, /// but it is still required for correct operation. pub trait PageAllocationIface
: Sized { /// Selectable memory type for the allocation. /// Platforms not supporting multiple memory types can use `()`. type MemoryType; /// Error type for allocation failures. type Error; /// Smallest allocatable unit size in bytes. const PAGE_SIZE: usize; /// Allocates `pages` pages of memory using the platform page allocator. /// The memory is uninitialized. /// /// # Parameters /// - `memory_type`: Optional memory type. If `None`, uses the platform's default. /// - `alignment`: Optional alignment in bytes (must be a power of two). /// If `None`, uses the platform's default alignment. /// /// # Safety /// The caller must ensure that the allocated memory is properly initialized before use. unsafe fn new_uninit( constraint: PageAllocationConstraint
, memory_type: Option, pages: usize, alignment: Option, ) -> Result; /// Allocates `pages` pages of memory using the platform page allocator. /// The memory is zero-initialized. fn new_zeroed( constraint: PageAllocationConstraint
, memory_type: Option, pages: usize, alignment: Option, ) -> Result { unsafe { // SAFETY: We immediately initialize the memory after allocation, before safe code can access it. let allocation = Self::new_uninit(constraint, memory_type, pages, alignment)?; let s: &mut [MaybeUninit] = core::slice::from_raw_parts_mut( allocation.as_ptr().cast(), pages * Self::PAGE_SIZE, ); s.fill(MaybeUninit::new(0)); Ok(allocation) } } /// Allocates `pages` pages of memory using the platform page allocator. /// The first init.len() bytes are initialized from the `init` slice, the rest is zero-initialized. fn new_init_prefix( constraint: PageAllocationConstraint
, memory_type: Option, pages: usize, alignment: Option, init: &[u8], ) -> Result { assert!(pages * Self::PAGE_SIZE >= init.len()); unsafe { // SAFETY: We immediately initialize the memory after allocation, before safe code can access it. let allocation = Self::new_uninit(constraint, memory_type, pages, alignment)?; let s: &mut [MaybeUninit] = core::slice::from_raw_parts_mut( allocation.as_ptr().cast(), pages * Self::PAGE_SIZE, ); let (dinit, dzero) = s.split_at_mut(init.len()); core::ptr::copy_nonoverlapping(init.as_ptr(), dinit.as_mut_ptr().cast(), init.len()); dzero.fill(MaybeUninit::new(0)); Ok(allocation) } } /// Returns the number of pages allocated. fn pages(&self) -> usize; /// Create a PageAllocation from a raw pointer and page count. /// Dropping the PageAllocation will free the pages. /// # Safety /// The caller must ensure that the pointer was allocated with /// `Self::new_*` and is valid for `pages` pages. /// Additionally the caller needs to ensure that the memory /// is properly initialized before use. unsafe fn from_raw(ptr: NonNull, pages: usize) -> Self; /// Consumes the PageAllocation and returns the raw pointer and page count. /// The caller is responsible for freeing the pages. fn into_raw(self) -> (NonNull, usize); /// Returns the raw pointer to the allocated memory. fn as_ptr(&self) -> *mut u8; /// Returns a slice to the allocated memory. fn as_u8_slice(&self) -> &[u8]; /// Returns a mutable slice to the allocated memory. fn as_u8_slice_mut(&mut self) -> &mut [u8]; } bitflags::bitflags! { /// Memory attributes for memory protection. /// /// Platforms should provide the following functions in their mem module: /// /// ```ignore /// pub fn change_mem_attrs(addr_range: core::ops::Range, attrs: MemAttributes) -> Result<(), Error> { ... } /// ``` /// /// ```ignore /// pub fn nx_required() -> bool { ... } /// ``` /// /// Not implementing memory attributes is allowed, in which case `change_mem_attrs` can be a no-op, /// and `nx_required` can return false. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct MemAttributes: u32 { const READ_PROTECT = 0x1; const WRITE_PROTECT = 0x2; const EXECUTE_PROTECT = 0x4; } } lace-0.1.0/lace-platform/src/iface/mod.rs000066400000000000000000000002661514263214500201340ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Interfaces module. pub mod mem; lace-0.1.0/lace-platform/src/lib.rs000066400000000000000000000076661514263214500170670ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Platform abstractions for Lace. #![no_std] extern crate alloc; use alloc::vec::Vec; use lace_util::fdt::node::FdtNode; // Interfaces for platform implementations. // These are not strictly necessary as the active platform is chosen at compile time, // but they help to clarify the expected API surface for each platform. pub mod iface; // Platform implementations #[cfg(feature = "efi")] pub mod efi; #[cfg(feature = "mock")] pub mod mock; #[cfg(feature = "efi")] use efi as p; #[cfg(feature = "mock")] use mock as p; // Re-export portable APIs from the active platform at the top-level namespace. // The list of APIs exported here constitutes the portable Lace platform API. pub use p::Error; /// The macros below are implemented using these. pub use p::{print_impl, println_impl}; // Macros for text output that should always be available #[macro_export] macro_rules! print { ($($arg:tt)*) => { $crate::print_impl(format_args!($($arg)*)) }; } #[macro_export] macro_rules! println { ($($arg:tt)*) => { $crate::println_impl(format_args!($($arg)*)) }; } // Macros for debug text output that is only active in debug builds #[macro_export] #[cfg(debug_assertions)] macro_rules! debug { ($($arg:tt)*) => { $crate::print_impl(format_args!($($arg)*)) }; } #[macro_export] #[cfg(not(debug_assertions))] macro_rules! debug { ($($arg:tt)*) => {}; } #[macro_export] #[cfg(debug_assertions)] macro_rules! debugln { ($($arg:tt)*) => { $crate::println_impl(format_args!($($arg)*)) }; } #[macro_export] #[cfg(not(debug_assertions))] macro_rules! debugln { ($($arg:tt)*) => {}; } // Re-export derive macros pub use lace_util_derive::entry; pub use p::find_edid; pub use p::find_smbios_tables; pub mod dtb { pub use super::p::dtb::{find_dtb, install_dtb}; } pub mod linux { pub use super::p::linux::{BootLinuxError, boot_linux}; } /// Determine platform compatibility using firmware-provided device tree. /// # Safety /// This function is unsafe because the compatible string references the firmware DTB, /// which may be invalidated by other code replacing it. pub unsafe fn platform_compatible_using_firmware_dtb() -> Option<&'static str> { let dtb = unsafe { dtb::find_dtb() }?; dtb.find_node("/") .and_then(FdtNode::compatible) .and_then(|compatible| compatible.all().next()) } /// Determine platform compatibility using CHID mappings and sources. pub fn platform_compatible_using_hwids(hwids: &[u8]) -> Option<&str> { // Parse CHID mappings from hwids section let mappings: Vec = lace_util::chid_mapping::ChidMappingIterator::from(hwids) .collect::>() .ok()?; debugln!("Parsed {} CHID mappings", mappings.len()); // Get CHID sources let sources = chid_sources()?; for (idx, src) in sources.iter().enumerate() { debugln!("CHID Source {}: {:?}", idx, src); } // Compute CHIDs for (idx, chid_type) in lace_util::chid::CHID_TYPES.iter().enumerate() { debugln!( "CHID type {}: {:?}", idx, lace_util::chid::compute_chid(&sources, *chid_type) ); } // Match mappings for mapping in lace_util::chid_matcher::ChidMatcher::new(&mappings, &sources) { if let lace_util::chid_mapping::ChidMapping::DeviceTree { compatible: Some(compatible), .. } = &mapping { return Some(compatible); } } None } /// Get CHID sources from SMBIOS and EDID tables provided by the platform. pub fn chid_sources() -> Option { let (ep, table) = find_smbios_tables()?; let edid = find_edid(); lace_util::chid::chid_sources_from_smbios_and_edid(Some(ep), table, edid.as_deref()).ok() } lace-0.1.0/lace-platform/src/mock/000077500000000000000000000000001514263214500166655ustar00rootroot00000000000000lace-0.1.0/lace-platform/src/mock/mem.rs000066400000000000000000000243231514263214500200150ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Memory related sandbox platform abstractions. use spin::Mutex; use crate::iface::mem::{MemAttributes, PageAllocationConstraint, PageAllocationIface}; use core::ptr::NonNull; /// Address type for the sandbox platform. pub type Address = usize; /// Page size for the sandbox platform. (This is an arbitrary choice.) pub const PAGE_SIZE: usize = 4096; /// Computes the number of pages required to hold a given size in bytes, /// rounding up to the nearest page. pub const fn page_count(size: usize) -> usize { size.div_ceil(PAGE_SIZE) } /// Default alignment when none is specified (page-aligned). const DEFAULT_ALIGNMENT: usize = PAGE_SIZE; /// Maximum supported alignment (4 MiB). const MAX_ALIGNMENT: usize = 4 * 1024 * 1024; /// Error type for page allocation failures in the mock platform. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum PageAllocationFailure { OutOfMemory, UnsupportedConstraint, /// The requested alignment is not a power of two. InvalidAlignment, /// The requested alignment exceeds the maximum (4 MiB). AlignmentTooLarge, } impl core::fmt::Display for PageAllocationFailure { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::OutOfMemory => write!(f, "Out of memory"), Self::UnsupportedConstraint => { write!(f, "Unsupported page allocation constraint") } Self::InvalidAlignment => { write!(f, "Alignment must be a power of two") } Self::AlignmentTooLarge => { write!(f, "Alignment exceeds maximum of 4 MiB") } } } } /// Memory pool for the mock page allocator. struct MockPagePool { memory: NonNull, size: usize, watermark: usize, } /// Safety: The memory pool is mutex protected, and overlapping allocations are not possible. /// The initializer still has to ensure the underling memory is physically accessible from all threads, /// but this is guaranteed on basically all hardware. unsafe impl Send for MockPagePool {} /// Global instance of the mock page pool. static MOCK_PAGE_POOL: Mutex> = Mutex::new(None); /// Initializes the mock page pool with the given memory region. /// # Safety /// The caller must ensure that the provided memory region is valid for the lifetime of the program /// and it will not be aliased anywhere else. pub unsafe fn init_mock_page_pool(memory: NonNull, size: usize) { let mut guard = MOCK_PAGE_POOL.lock(); if guard.is_some() { panic!("Mock page pool is already initialized"); } *guard = Some(MockPagePool { memory, size, watermark: 0, }); } /// Resource holder for an allocation from the mock page allocator. pub struct PageAllocation { ptr: NonNull, pages: usize, } impl PageAllocationIface
for PageAllocation { const PAGE_SIZE: usize = PAGE_SIZE; // No actual memory types in the mock platform. type MemoryType = (); type Error = PageAllocationFailure; unsafe fn new_uninit( constraint: PageAllocationConstraint
, _memory_type: Option, pages: usize, alignment: Option, ) -> Result { match constraint { PageAllocationConstraint::AnyAddress => (), _ => return Err(PageAllocationFailure::UnsupportedConstraint), } // Default to page-aligned; validate alignment let alignment = alignment.unwrap_or(DEFAULT_ALIGNMENT); if !alignment.is_power_of_two() { return Err(PageAllocationFailure::InvalidAlignment); } if alignment > MAX_ALIGNMENT { return Err(PageAllocationFailure::AlignmentTooLarge); } let mut guard = MOCK_PAGE_POOL.lock(); let pool = guard.as_mut().expect("Mock page pool not initialized"); // Calculate aligned address let base_addr = pool.memory.as_ptr() as usize + pool.watermark; let aligned_addr = base_addr.next_multiple_of(alignment); let alignment_padding = aligned_addr - base_addr; // Calculate total size needed let alloc_size = pages .checked_mul(PAGE_SIZE) .ok_or(PageAllocationFailure::OutOfMemory)?; let total_size = alloc_size .checked_add(alignment_padding) .ok_or(PageAllocationFailure::OutOfMemory)?; let end = pool .watermark .checked_add(total_size) .ok_or(PageAllocationFailure::OutOfMemory)?; if end > pool.size { return Err(PageAllocationFailure::OutOfMemory); } pool.watermark = end; Ok(PageAllocation { ptr: NonNull::new(aligned_addr as *mut u8).unwrap(), pages, }) } fn pages(&self) -> usize { self.pages } unsafe fn from_raw(ptr: NonNull, pages: usize) -> Self { PageAllocation { ptr, pages } } fn into_raw(self) -> (NonNull, usize) { let (ptr, pages) = (self.ptr, self.pages); core::mem::forget(self); (ptr, pages) } fn as_ptr(&self) -> *mut u8 { self.ptr.as_ptr() } fn as_u8_slice(&self) -> &[u8] { unsafe { // SAFETY: `ptr` was allocated with `boot::allocate_pages` and is valid for `pages` pages. // The resulting slice will have a lifetime tied to &self, so it cannot outlive the allocation. // The memory might be uninitialized, but any value of a byte is valid for u8. core::slice::from_raw_parts(self.ptr.as_ptr(), self.pages * PAGE_SIZE) } } fn as_u8_slice_mut(&mut self) -> &mut [u8] { unsafe { // SAFETY: `ptr` was allocated with `boot::allocate_pages` and is valid for `pages` pages. // The resulting slice will have a lifetime tied to &mut self, so it cannot outlive the allocation. // The memory might be uninitialized, but any value of a byte is valid for u8. core::slice::from_raw_parts_mut(self.ptr.as_ptr(), self.pages * PAGE_SIZE) } } } impl Drop for PageAllocation { fn drop(&mut self) { // In a real implementation, this would free the allocated pages. // Mock uses a bump allocator for now, so nothing to do here. } } pub fn change_mem_attrs( _addr_range: core::ops::Range, _attrs: MemAttributes, ) -> Result<(), crate::Error> { // No-op in the mock platform. Ok(()) } pub fn nx_required() -> bool { false } #[cfg(test)] mod tests { use super::*; // Tests share the global pool and must run serially (--test-threads=1). /// Initialize a fresh pool for testing. fn init_test_pool(pool: &mut [u8]) { let ptr = NonNull::new(pool.as_mut_ptr()).unwrap(); *MOCK_PAGE_POOL.lock() = Some(MockPagePool { memory: ptr, size: pool.len(), watermark: 0, }); } #[test] fn test_basic_allocation() { let mut pool = [0u8; 16 * PAGE_SIZE]; init_test_pool(&mut pool); let alloc = unsafe { PageAllocation::new_uninit(PageAllocationConstraint::AnyAddress, None, 1, None) }; assert!(alloc.is_ok()); let alloc = alloc.unwrap(); assert_eq!(alloc.pages(), 1); } #[test] fn test_zeroed_allocation() { let mut pool = [0xffu8; 16 * PAGE_SIZE]; init_test_pool(&mut pool); let alloc = PageAllocation::new_zeroed(PageAllocationConstraint::AnyAddress, None, 1, None); assert!(alloc.is_ok()); let alloc = alloc.unwrap(); // Verify all bytes are zero assert!(alloc.as_u8_slice().iter().all(|&b| b == 0)); } #[test] fn test_alignment() { let mut pool = [0u8; 64 * PAGE_SIZE]; init_test_pool(&mut pool); // First allocation to move watermark let _ = unsafe { PageAllocation::new_uninit(PageAllocationConstraint::AnyAddress, None, 1, None) }; // Request 64K alignment (16 pages) let alloc = unsafe { PageAllocation::new_uninit( PageAllocationConstraint::AnyAddress, None, 1, Some(64 * 1024), ) }; assert!(alloc.is_ok()); let alloc = alloc.unwrap(); // Verify alignment let addr = alloc.as_ptr() as usize; assert_eq!(addr % (64 * 1024), 0, "allocation should be 64K aligned"); } #[test] fn test_out_of_memory() { let mut pool = [0u8; PAGE_SIZE]; init_test_pool(&mut pool); // Try to allocate more than the pool size let alloc = unsafe { PageAllocation::new_uninit(PageAllocationConstraint::AnyAddress, None, 2, None) }; assert_eq!(alloc.err(), Some(PageAllocationFailure::OutOfMemory)); } #[test] fn test_invalid_alignment() { let mut pool = [0u8; 16 * PAGE_SIZE]; init_test_pool(&mut pool); // Alignment must be power of two let alloc = unsafe { PageAllocation::new_uninit(PageAllocationConstraint::AnyAddress, None, 1, Some(3)) }; assert_eq!(alloc.err(), Some(PageAllocationFailure::InvalidAlignment)); } #[test] fn test_alignment_too_large() { let mut pool = [0u8; 16 * PAGE_SIZE]; init_test_pool(&mut pool); // Alignment exceeds 4 MiB limit let alloc = unsafe { PageAllocation::new_uninit( PageAllocationConstraint::AnyAddress, None, 1, Some(8 * 1024 * 1024), ) }; assert_eq!(alloc.err(), Some(PageAllocationFailure::AlignmentTooLarge)); } #[test] fn test_unsupported_constraint() { let mut pool = [0u8; 16 * PAGE_SIZE]; init_test_pool(&mut pool); let alloc = unsafe { PageAllocation::new_uninit(PageAllocationConstraint::MaxAddress(0x1000), None, 1, None) }; assert_eq!( alloc.err(), Some(PageAllocationFailure::UnsupportedConstraint) ); } } lace-0.1.0/lace-platform/src/mock/mod.rs000066400000000000000000000026011514263214500200110ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Sandbox platform abstractions. extern crate std; use core::{fmt, ops::Deref}; pub mod mem; #[derive(Debug)] pub struct Error; pub fn print_impl(args: fmt::Arguments<'_>) { std::print!("{}", args); } pub fn println_impl(args: fmt::Arguments<'_>) { std::println!("{}", args); } struct EdidRef; impl Deref for EdidRef { type Target = [u8]; fn deref(&self) -> &Self::Target { todo!() } } pub fn find_edid() -> Option> { Option::::None } pub fn find_smbios_tables() -> Option<(&'static [u8], &'static [u8])> { todo!() } pub mod dtb { use lace_util::fdt::Fdt; /// Finds an installed DTB in the system. /// # Safety /// This is not implemented for now. pub unsafe fn find_dtb() -> Option> { todo!() } /// Installs a DTB in the system. /// # Safety /// This is not implemented for now. pub unsafe fn install_dtb(_dtb: &[u8]) -> Result<(), super::Error> { todo!() } } pub mod linux { #[derive(Debug)] pub struct BootLinuxError; pub fn boot_linux( _kernel: &[u8], _initrd: Option<&[u8]>, _cmdline: Option<&str>, ) -> Result<(), BootLinuxError> { todo!() } } lace-0.1.0/lace-stubble/000077500000000000000000000000001514263214500147615ustar00rootroot00000000000000lace-0.1.0/lace-stubble/Cargo.toml000066400000000000000000000010461514263214500167120ustar00rootroot00000000000000[package] name = "lace-stubble" version = "0.1.0" edition = "2024" license = "GPL-2.0-only OR GPL-3.0-only" [dependencies] lace-util = { version = "0.1.0", path = "../lace-util", default-features = false } lace-platform = { version = "0.1.0", path = "../lace-platform", default-features = false, features = ["efi"] } [target."cfg(target_os = \"uefi\")".dependencies] uefi = { version = "0.36.0", features = ["global_allocator", "panic_handler"] } [target."cfg(not(target_os = \"uefi\"))".dependencies] uefi = { version = "0.36.0", features = [] } lace-0.1.0/lace-stubble/README.md000066400000000000000000000061061514263214500162430ustar00rootroot00000000000000# lace-stubble `lace-stubble` is a small, (mostly) memory-safe stub bootloader for running the Linux kernel on UEFI, implemented using the libraries provided by Project Lace. It is a Rust implementation of the earlier [stubble](https://github.com/ubuntu/stubble) project, which in turn is a minimal derivative of systemd-stub with fewer features. ## Overview `lace-stubble` is a "stub" EFI binary that can be specialized into a bootable image by embedding resources (kernel, initrd, etc.) into PE sections. ## Features - Loading of Linux kernel, initramfs, command line, and device trees from a single executable. - Automatic Device Tree Selection: - Determines the platform's compatible string by inspecting the firmware-provided DTB or by matching Computer Hardware IDs (CHIDs) against an embedded `.hwids` database. - Selects and installs the correct Device Tree Blob (DTB) from embedded `.dtbauto` sections based on the platform compatible string. - Command Line Handling: Supports embedded command lines via the `.cmdline` section, with fallback to UEFI Load Options. - Memory Safety: Written in Rust, leveraging the `uefi` crate and `lace-util` for safe parsing and execution. ## PE Sections `lace-stubble` looks for the following sections in its own PE image: | Section Name | Description | Requirement | |--------------|-------------|-------------| | `.linux` | The Linux kernel image. | **Mandatory** | | `.initrd` | The initial RAM disk (initramfs). | Optional** | | `.cmdline` | Kernel command line arguments. | Optional* | | `.hwids` | JSON/Binary mapping of CHIDs to compatible strings. | Optional | | `.dtbauto` | Device Tree Blob (DTB). Multiple sections allowed. | Optional | \* If `.cmdline` is missing, `lace-stubble` will attempt to use the UEFI Load Options (arguments passed to the EFI binary). \** If `.initrd` is missing, an external initrd will be used if available (via UEFI Load File2 Protocol). ## Build `lace-stubble` is part of the Lace workspace. To build it: ```none cargo build -p lace-stubble --target MY_TARGET [--release] ``` Note that `lace-stubble` targets `x86_64-unknown-uefi` or `aarch64-unknown-uefi`. Ensure you have the appropriate target installed: ```none rustup target add x86_64-unknown-uefi # or rustup target add aarch64-unknown-uefi ``` ## Usage To create a bootable `lace-stubble` image, you use the `pewrap` tool (part of Project Lace) to inject the necessary sections into the base `stubble.efi` binary. ### Example with `pewrap` ```none # Wrap resources into the stub cargo run -p pewrap -- \ --stub target/x86_64-unknown-uefi/release/lace-stubble.efi \ --output bootable.efi \ --linux /boot/vmlinuz-linux \ --initrd /boot/initramfs-linux.img \ --cmdline "console=ttyS0 console=tty0 root=UUID=... rw" \ --hwids data/hwids/json \ --dtbauto path/to/board1.dtb \ --dtbauto path/to/board2.dtb ``` This command creates `bootable.efi`, which contains the kernel, initrd, command line, and DTBs. When executed on a UEFI system, `lace-stubble` will automatically select the correct DTB for the hardware and boot the kernel. lace-0.1.0/lace-stubble/src/000077500000000000000000000000001514263214500155505ustar00rootroot00000000000000lace-0.1.0/lace-stubble/src/lib.rs000066400000000000000000000215461514263214500166740ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Lace Stubble library #![no_std] extern crate alloc; use alloc::vec::Vec; use core::fmt::Display; use lace_platform::debugln; use lace_platform::dtb::install_dtb; use lace_platform::linux::boot_linux; use lace_util::peimage::{PeError, SectionHeader, parse_pe}; /// Errors that can occur when booting a Stubble image. #[derive(Clone, Copy, Debug)] pub enum BootStubbleError { PeError(PeError), DuplicateSection(&'static str), NotAStubbleImage, InvalidCommandLine, } impl Display for BootStubbleError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { BootStubbleError::PeError(e) => write!(f, "PE parsing error: {}", e), BootStubbleError::DuplicateSection(name) => { write!(f, "Duplicate section in Stubble image: {}", name) } BootStubbleError::NotAStubbleImage => write!(f, "Not a Stubble image"), BootStubbleError::InvalidCommandLine => write!(f, "Invalid command line encoding"), } } } /// A stubble image can be handled either already loaded or in raw form pub enum StubbleImage<'a> { Loaded(&'a [u8]), Raw(&'a [u8]), } /// Boots a Stubble image with an optional initrd and command line. /// The external_initrd and external_cmdline will only be used if the Stubble image does not /// contain corresponding sections (.initrd and .cmdline). pub fn boot_stubble_image<'image>( stubble_image: StubbleImage<'image>, external_initrd: Option<&[u8]>, external_cmdline: Option<&str>, ) -> Result<(), BootStubbleError> { // Parse image let (data, raw) = match stubble_image { StubbleImage::Loaded(s) => (s, false), StubbleImage::Raw(s) => (s, true), }; let pe = parse_pe(data).map_err(BootStubbleError::PeError)?; // Parsed sections/data let mut kernel = None; let mut initrd = None; let mut cmdline = None; let mut hwids = None; let mut dtbauto: Vec<&[u8]> = Vec::new(); // Closure to process each section let section_filter = |result: Result<(SectionHeader, &'image [u8]), PeError>| -> Result<(), BootStubbleError> { let (sect, data) = result.map_err(BootStubbleError::PeError)?; debugln!( " {:<8} {:08x} {:08x}", str::from_utf8(sect.name()).unwrap(), sect.virtual_address, sect.virtual_size ); match sect.name() { b".linux" => kernel .insert_once_or_error(data, BootStubbleError::DuplicateSection(".linux"))?, b".initrd" => initrd .insert_once_or_error(data, BootStubbleError::DuplicateSection(".initrd"))?, b".cmdline" => { let cmdline_str = core::str::from_utf8(data) .map_err(|_| BootStubbleError::InvalidCommandLine)?; cmdline.insert_once_or_error( cmdline_str, BootStubbleError::DuplicateSection(".cmdline"), )? } b".hwids" => hwids .insert_once_or_error(data, BootStubbleError::DuplicateSection(".hwids"))?, b".dtbauto" => dtbauto.push(data), _ => {} } Ok(()) }; debugln!("PE sections"); if raw { pe.raw_sections().try_for_each(section_filter)?; } else { pe.virtual_sections().try_for_each(section_filter)?; } // Use external initrd and/or cmdline if not present in image if let (Some(external_cmdline), true) = (external_cmdline, cmdline.is_none()) { cmdline = Some(external_cmdline); } if let (Some(external_initrd), true) = (external_initrd, initrd.is_none()) { initrd = Some(external_initrd); } // Ensure kernel is present let kernel = kernel.ok_or(BootStubbleError::NotAStubbleImage)?; // First try to get platform compatible from firmware DTB // If that fails, try using CHID matching against .hwids section let compatible = unsafe { lace_platform::platform_compatible_using_firmware_dtb() }.or_else(|| { hwids .map(|hwids| lace_platform::platform_compatible_using_hwids(hwids)) .unwrap_or(None) }); debugln!( "Determined platform compatible: {}", compatible.unwrap_or("") ); // Find suitable DTB from .dtbauto sections // Keep installed dtb receipt here so it is in scope for the kernel boot let mut installed_dtb = None; if let Some(compatible) = compatible { for dtb_data in dtbauto { let dtb_fdt = match lace_util::fdt::Fdt::new(dtb_data) { Ok(fdt) => fdt, Err(e) => { debugln!("Skipping invalid .dtbauto section: {}", e); continue; } }; let Some(dtb_compatible) = dtb_fdt .find_node("/") .and_then(|n| n.compatible()) .and_then(|compatible| compatible.all().next()) else { debugln!("Skipping .dtbauto section with no compatible property"); continue; }; if dtb_compatible == compatible { debugln!("Installing DTB for compatible {}", compatible); installed_dtb = unsafe { Some(install_dtb(dtb_data).expect("failed to install DTB")) }; break; } } if installed_dtb.is_none() { debugln!( "No matching DTB found for compatible {}, skipping DTB installation", compatible ); } } else { debugln!("No platform compatible determined, skipping DTB installation"); } // Measure command line to TPM 2.0 - PCR 12 use uefi::proto::tcg; if let Ok(mut tcg2) = lace_platform::efi::open_protocol_exclusive::() { let cmdline = cmdline.unwrap_or_default(); // Prepare buffer for event // Unfortunately the exact size of PcrEventInputs header is not exposed, // so we allocate a bit more than needed. let mut event_buf = alloc::vec![0u8; 64 + cmdline.len()]; let _ = tcg::v2::PcrEventInputs::new_in_buffer( &mut event_buf, // Kernel command line is measured into PCR 12, // see https://uapi-group.org/specifications/specs/linux_tpm_pcr_registry tcg::PcrIndex(12), tcg::EventType::IPL, cmdline.as_bytes(), ) .map_err(|err| err.to_err_without_payload()) .and_then(|event| { tcg2.hash_log_extend_event( tcg::v2::HashLogExtendEventFlags::empty(), cmdline.as_bytes(), event, ) }) .inspect_err(|err| { debugln!("Failed to measure kernel command line: {}", err); }); } else { debugln!("TPM 2.0 TCG protocol not available, skipping command line measurement"); } // Boot the kernel boot_linux(kernel, initrd, cmdline).expect("failed to start linux"); unreachable!() } /// Extension trait to insert a value into an Option only if it is None, /// otherwise return an error. trait InsertOnce { /// Inserts the value if the Option is None, otherwise returns the provided error. fn insert_once_or_error(&mut self, value: T, err: E) -> Result<(), E>; } impl InsertOnce for Option { fn insert_once_or_error(&mut self, value: T, err: E) -> Result<(), E> { if self.is_some() { Err(err) } else { *self = Some(value); Ok(()) } } } #[cfg(test)] mod test { use super::*; #[test] fn test_insert_once_success() { let mut opt: Option = None; let result = opt.insert_once_or_error(42, "error"); assert_eq!(result, Ok(())); assert_eq!(opt, Some(42)); } #[test] fn test_insert_once_duplicate_error() { let mut opt: Option = Some(10); let result = opt.insert_once_or_error(42, "duplicate"); assert_eq!(result, Err("duplicate")); assert_eq!(opt, Some(10)); // Original value should be preserved } #[test] fn test_insert_once_with_string() { let mut opt: Option<&str> = None; let result = opt.insert_once_or_error("hello", "error"); assert_eq!(result, Ok(())); assert_eq!(opt, Some("hello")); } #[test] fn test_insert_once_with_slice() { let mut opt: Option<&[u8]> = None; let data: &[u8] = &[1, 2, 3]; let result = opt.insert_once_or_error(data, "error"); assert_eq!(result, Ok(())); assert_eq!(opt, Some(data)); } } lace-0.1.0/lace-stubble/src/main.rs000066400000000000000000000033721514263214500170470ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri // UEFI main application #![cfg_attr(target_os = "uefi", no_main)] #![cfg_attr(target_os = "uefi", no_std)] extern crate alloc; use alloc::string::String; use lace_platform::{Error, debugln}; #[cfg_attr(target_os = "uefi", lace_platform::entry)] fn main() -> Result<(), Error> { // Parse own loaded image let li = uefi::boot::open_protocol_exclusive::( uefi::boot::image_handle(), ) .expect("cannot get own loaded image"); // Convert loaded image data to slice let li_slice = unsafe { // SAFETY: This is valid unless the firmware is seriously broken let (ptr, len) = li.info(); core::slice::from_raw_parts(ptr as *const u8, len as usize) }; // Get external cmdline if any let external_cmdline: Option = match li.load_options_as_bytes() { Some(bytes) => { let s: String = core::char::decode_utf16( bytes .chunks(2) .map(|chunk| u16::from_ne_bytes([chunk[0], chunk[1]])), ) .map(|r| { r.unwrap_or_else(|err| { debugln!("WARNING: command line contains invalid character: {}", err); core::char::REPLACEMENT_CHARACTER }) }) .collect(); Some(s) } None => None, }; // Boot the stubble image lace_stubble::boot_stubble_image( lace_stubble::StubbleImage::Loaded(li_slice), None, external_cmdline.as_deref(), ) .expect("Failed to boot"); unreachable!() } lace-0.1.0/lace-util-derive/000077500000000000000000000000001514263214500155525ustar00rootroot00000000000000lace-0.1.0/lace-util-derive/Cargo.toml000066400000000000000000000003721514263214500175040ustar00rootroot00000000000000[package] name = "lace-util-derive" version = "0.1.0" edition = "2021" license = "GPL-2.0-only OR GPL-3.0-only" [lib] proc-macro = true [dependencies] syn = { version = "2.0", features = ["full", "extra-traits"] } quote = "1.0" proc-macro2 = "1.0" lace-0.1.0/lace-util-derive/src/000077500000000000000000000000001514263214500163415ustar00rootroot00000000000000lace-0.1.0/lace-util-derive/src/lib.rs000066400000000000000000000342541514263214500174650ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only //! Procedural macros for deriving enum utilities. //! //! This crate provides two derive macros for enums: //! //! - [`NumEnum`]: Generates bidirectional conversions between enums and integer //! types //! - [`NamedEnum`]: Generates methods for accessing variant names //! //! # Examples //! //! ``` //! use lace_util_derive::{NumEnum, NamedEnum}; //! //! #[derive(NumEnum, NamedEnum, Debug, PartialEq)] //! #[repr(u8)] //! enum Status { //! #[name(short = "ok", long = "Success")] //! Ok = 1, //! #[name(short = "fail", long = "Failure")] //! Fail = 2, //! } //! //! // NumEnum provides integer conversions //! assert_eq!(Status::try_from(1u8), std::result::Result::Ok(Status::Ok)); //! assert_eq!(u8::from(Status::Fail), 2); //! //! // NamedEnum provides name accessors //! assert_eq!(Status::Ok.short_name(), "ok"); //! assert_eq!(Status::Ok.long_name(), "Success"); //! assert_eq!(Status::try_from_short_name("fail"), Some(Status::Fail)); //! ``` use proc_macro::TokenStream; use proc_macro2::Span; use quote::quote; use syn::{parse_macro_input, Data, DeriveInput, Fields, ItemFn}; /// Derive macro for generating bidirectional conversions between enums and /// integer types. /// /// This macro generates implementations of `TryFrom` and `From` for /// enums with a `#[repr(type)]` attribute, where variants are assigned /// sequential integer values starting from 0. /// /// # Requirements /// /// - The enum must have a `#[repr(type)]` attribute specifying an integer type /// (e.g., `u8`, `i32`) /// - All enum variants must be unit variants (no fields) /// /// # Generated Implementations /// /// - `impl TryFrom for Enum`: Converts an integer to an enum variant. /// Returns `Err(())` if the integer doesn't correspond to a valid variant. /// Generated for: u8, u16, u32, u64, usize, i8, i16, i32, i64, isize. /// - `impl From for Int`: Converts an enum variant to its corresponding /// integer value (for the repr type only). /// /// # Examples /// /// ## Basic usage with u8 /// /// ``` /// use lace_util_derive::NumEnum; /// /// #[derive(NumEnum, Debug, PartialEq)] /// #[repr(u8)] /// enum Color { /// Red = 0, /// Green = 1, /// Blue = 2, /// } /// /// // Convert from integer to enum /// assert_eq!(Color::try_from(0u8), Ok(Color::Red)); /// assert_eq!(Color::try_from(1u8), Ok(Color::Green)); /// assert_eq!(Color::try_from(2u8), Ok(Color::Blue)); /// assert_eq!(Color::try_from(3u8), Err(())); /// /// // Convert from enum to integer /// assert_eq!(u8::from(Color::Red), 0); /// assert_eq!(u8::from(Color::Green), 1); /// assert_eq!(u8::from(Color::Blue), 2); /// ``` /// /// ## Using different integer types /// /// ``` /// use lace_util_derive::NumEnum; /// /// #[derive(NumEnum, Debug, PartialEq)] /// #[repr(u16)] /// enum Level { /// Low = 1, /// Medium = 5, /// High = 1024, /// } /// /// assert_eq!(Level::try_from(1u16), Ok(Level::Low)); /// assert_eq!(u16::from(Level::Medium), 5); /// assert_eq!(u16::from(Level::High), 1024); /// ``` /// /// ## Converting from arbitrary integer types /// /// ``` /// use lace_util_derive::NumEnum; /// /// #[derive(NumEnum, Debug, PartialEq)] /// #[repr(u8)] /// enum Color { /// Red = 0, /// Green = 1, /// Blue = 2, /// } /// /// // TryFrom is implemented for all integer types /// assert_eq!(Color::try_from(0u32), Ok(Color::Red)); /// assert_eq!(Color::try_from(1i64), Ok(Color::Green)); /// assert_eq!(Color::try_from(2usize), Ok(Color::Blue)); /// assert_eq!(Color::try_from(256u32), Err(())); // Out of u8 range /// assert_eq!(Color::try_from(-1i32), Err(())); // Negative value /// ``` /// /// # Panics /// /// This macro will panic at compile time if: /// - The enum doesn't have a `#[repr(type)]` attribute /// - Any variant has fields (e.g., `Foo(u32)` or `Bar { x: i32 }`) #[proc_macro_derive(NumEnum)] pub fn derive_num_enum(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); let name = &input.ident; // Find the underlying integer type from #[repr(type)] let repr_type = input .attrs .iter() .find(|attr| attr.path().is_ident("repr")) .map(|attr| { attr.parse_args::().expect( "Expected #[repr(integer_type)] attribute with a valid \ integer type (e.g., u8, i32)", ) }) .expect("Expected #[repr(type)] attribute on enum"); // Parse enum variants let variants = match &input.data { Data::Enum(data) => &data.variants, _ => panic!("NumEnum can only be derived for enums"), }; // Validate all variants are unit variants for variant in variants { if !matches!(variant.fields, Fields::Unit) { panic!("NumEnum only supports unit variants"); } } // Collect variant names and discriminants let variant_discriminants: Vec<_> = variants .iter() .map(|variant| { let variant_name = &variant.ident; let Some(discriminant) = variant.discriminant.as_ref().map(|(_, expr)| expr) else { panic!( "Variant `{}` must have an explicit discriminant for NumEnum", variant_name ) }; (variant_name, discriminant) }) .collect(); // Generate match arms for TryFrom, e.g. `0 => Ok(Color::Red),` let try_from_arms = variant_discriminants .iter() .map(|(variant_name, discriminant)| { quote! { #discriminant => Ok(#name::#variant_name), } }); // Generate impl TryFrom for Enum with direct match let try_from_repr_impl = quote! { impl TryFrom<#repr_type> for #name { type Error = (); fn try_from(value: #repr_type) -> Result { match value { #(#try_from_arms)* _ => Err(()), } } } }; // Generate TryFrom for other integer types that delegate to the repr impl let repr_str = repr_type.to_string(); let other_int_types: Vec = [ "u8", "u16", "u32", "u64", "usize", "i8", "i16", "i32", "i64", "isize", ] .iter() .filter(|t| **t != repr_str) .map(|t| syn::Ident::new(t, Span::call_site())) .collect(); let other_try_from_impls = other_int_types.iter().map(|int_type| { quote! { impl TryFrom<#int_type> for #name { type Error = (); fn try_from(value: #int_type) -> Result { let repr_val = #repr_type::try_from(value).map_err(|_| ())?; Self::try_from(repr_val) } } } }); // Generate From for Int implementation let from_arms = variant_discriminants .iter() .map(|(variant_name, discriminant)| { quote! { #name::#variant_name => #discriminant, } }); // Generate impl From for u8 { fn from(...) { match ... } } let from_impl = quote! { impl From<#name> for #repr_type { fn from(value: #name) -> Self { match value { #(#from_arms)* } } } }; // Combine implementations let expanded = quote! { #try_from_repr_impl #(#other_try_from_impls)* #from_impl }; TokenStream::from(expanded) } /// Derive macro for generating name accessor methods for enum variants /// /// This macro generates methods for accessing short and long names of enum /// variants, as well as a method for looking up variants by their short name. /// /// # Attributes /// /// Variants can be annotated with the `#[name(short = "...", long = "...")]` /// attribute to specify custom names. If not provided, the variant's identifier /// is used as both the short and long name. /// /// # Generated Methods /// /// - `pub fn short_name(&self) -> &'static str`: Returns the short name of the /// variant /// - `pub fn long_name(&self) -> &'static str`: Returns the long name of the /// variant /// - `pub fn try_from_short_name(name: &str) -> Option`: Looks up a /// variant by its short name /// /// # Requirements /// /// - All enum variants must be unit variants (no fields) /// /// # Examples /// /// ## With custom names /// /// ``` /// use lace_util_derive::NamedEnum; /// /// #[derive(NamedEnum, Debug, PartialEq)] /// enum Priority { /// #[name(short = "low", long = "Low Priority")] /// Low, /// #[name(short = "med", long = "Medium Priority")] /// Medium, /// #[name(short = "high", long = "High Priority")] /// High, /// } /// /// // Access short names /// assert_eq!(Priority::Low.short_name(), "low"); /// assert_eq!(Priority::Medium.short_name(), "med"); /// assert_eq!(Priority::High.short_name(), "high"); /// /// // Access long names /// assert_eq!(Priority::Low.long_name(), "Low Priority"); /// assert_eq!(Priority::Medium.long_name(), "Medium Priority"); /// assert_eq!(Priority::High.long_name(), "High Priority"); /// /// // Lookup by short name /// assert_eq!(Priority::try_from_short_name("low"), Some(Priority::Low)); /// assert_eq!(Priority::try_from_short_name("med"), Some(Priority::Medium)); /// assert_eq!(Priority::try_from_short_name("high"), Some(Priority::High)); /// assert_eq!(Priority::try_from_short_name("invalid"), None); /// // long name doesn't match /// assert_eq!(Priority::try_from_short_name("Low Priority"), None); /// ``` /// /// ## Without custom names (using defaults) /// /// ``` /// use lace_util_derive::NamedEnum; /// /// #[derive(NamedEnum, Debug, PartialEq)] /// enum Animal { /// Cat, /// Dog, /// Bird, /// } /// /// // Without #[name] attributes, variant identifiers are used /// assert_eq!(Animal::Cat.short_name(), "Cat"); /// assert_eq!(Animal::Cat.long_name(), "Cat"); /// assert_eq!(Animal::Dog.short_name(), "Dog"); /// assert_eq!(Animal::try_from_short_name("Cat"), Some(Animal::Cat)); /// assert_eq!(Animal::try_from_short_name("Dog"), Some(Animal::Dog)); /// assert_eq!(Animal::try_from_short_name("Bird"), Some(Animal::Bird)); /// assert_eq!(Animal::try_from_short_name("cat"), None); // case sensitive /// ``` /// /// # Panics /// /// This macro will panic at compile time if: /// - Any variant has fields (e.g., `Foo(u32)` or `Bar { x: i32 }`) /// - The `#[name]` attribute has invalid syntax #[proc_macro_derive(NamedEnum, attributes(name))] pub fn derive_named_enum(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); let name = &input.ident; // Parse enum variants let variants = match &input.data { Data::Enum(data) => &data.variants, _ => panic!("NamedEnum can only be derived for enums"), }; let mut variant_data = Vec::new(); for variant in variants { if !matches!(variant.fields, Fields::Unit) { panic!("NamedEnum only supports unit variants"); } let variant_name = &variant.ident; let mut short_name = None; let mut long_name = None; // Parse #[name(short = "...", long = "...")] attribute for attr in &variant.attrs { if attr.path().is_ident("name") { attr.parse_nested_meta(|meta| { if meta.path.is_ident("short") { let value = meta.value()?; let s: syn::LitStr = value.parse()?; short_name = Some(s.value()); } else if meta.path.is_ident("long") { let value = meta.value()?; let s: syn::LitStr = value.parse()?; long_name = Some(s.value()); } Ok(()) }) .expect( "Failed to parse name attribute: expected format #[name(short = \"...\", long = \"...\")]", ); } } let short = short_name.unwrap_or(variant_name.to_string()); let long = long_name.unwrap_or(variant_name.to_string()); variant_data.push((variant_name, short, long)); } // Generate short_name method arms let short_name_arms = variant_data.iter().map(|(variant_name, short, _)| { quote! { #name::#variant_name => #short, } }); // Generate long_name method arms let long_name_arms = variant_data.iter().map(|(variant_name, _, long)| { quote! { #name::#variant_name => #long, } }); // Generate try_from_short_name method arms let try_from_short_name_arms = variant_data.iter().map(|(variant_name, short, _)| { quote! { #short => Some(#name::#variant_name), } }); // Generate a single impl block with all three methods let expanded = quote! { impl #name { pub fn short_name(&self) -> &'static str { match self { #(#short_name_arms)* } } pub fn long_name(&self) -> &'static str { match self { #(#long_name_arms)* } } pub fn try_from_short_name(name: &str) -> Option { match name { #(#try_from_short_name_arms)* _ => None, } } } }; TokenStream::from(expanded) } /// Attribute macro to mark the application entry point function. /// /// This macro transforms the annotated function into the application entry /// point by applying the `#[unsafe(export_name = "main")]` attribute. /// # Usage /// ```ignore /// use lace_util_derive::entry; /// #[entry] /// fn main() { /// // Application code here /// } /// ``` /// # Panics /// This macro will panic at compile time if any arguments are /// provided to the attribute. #[proc_macro_attribute] pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream { if !args.is_empty() { panic!("#[entry] does not accept any arguments"); } let func = parse_macro_input!(input as ItemFn); quote! { #[unsafe(export_name = "main")] #func } .into() } lace-0.1.0/lace-util/000077500000000000000000000000001514263214500142765ustar00rootroot00000000000000lace-0.1.0/lace-util/Cargo.toml000066400000000000000000000004171514263214500162300ustar00rootroot00000000000000[package] name = "lace-util" version = "0.1.0" edition = "2024" license = "GPL-2.0-only OR GPL-3.0-only" [dependencies] fdt = { version = "0.1.5", default-features = false } zerocopy = { version = "0.8.39", features = ["derive"] } [features] default = ["std"] std = [] lace-0.1.0/lace-util/src/000077500000000000000000000000001514263214500150655ustar00rootroot00000000000000lace-0.1.0/lace-util/src/chid.rs000066400000000000000000000553751514263214500163610ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! Computer Hardware ID (CHID) computation. //! //! CHIDs are GUIDs derived from system information (SMBIOS data, EDID panel //! info, etc.) that uniquely identify a hardware configuration. They have two //! primary uses: //! //! 1. **Firmware updates**: fwupd and the Linux Vendor Firmware Service (LVFS) //! use CHIDs to match firmware updates to specific devices. //! //! 2. **Device tree selection**: On machines that boot Linux with device tree, //! CHIDs are used to select the correct compatible string, which in turn //! determines which device tree to use from a list of available options. //! //! The algorithm follows Microsoft's CHID specification and RFC 9562 for UUID //! generation: //! 1. Concatenate selected hardware identifiers (separated by '&' in UCS-2 //! encoding) //! 2. Hash with SHA-1 using a defined namespace GUID //! 3. Format the result as a version 5 (SHA-1 based) UUID per RFC 9562 //! //! Different "CHID types" use different combinations of hardware sources, //! allowing matching at varying levels of specificity (from exact BIOS version //! down to just the manufacturer). use crate::edid::*; use crate::sha1::*; use crate::smbios::*; use crate::*; use alloc::format; use alloc::string::String; use alloc::vec::Vec; use core::mem::size_of; use zerocopy::{FromBytes, IntoBytes}; /// CHID namespace GUID used as the seed for SHA-1 hashing per RFC 9562 pub const CHID_NAMESPACE_GUID: crate::Guid = crate::guid_str("70ffd812-4c7f-4c7d-0000-000000000000"); /// Indices into the ChidSources array for each possible hardware information /// source. These correspond to SMBIOS table fields and EDID data used to /// compute CHIDs. /// /// From SMBIOS Type 1 (System Information): pub const CHID_SMBIOS_MANUFACTURER: usize = 0; pub const CHID_SMBIOS_FAMILY: usize = 1; pub const CHID_SMBIOS_PRODUCT_NAME: usize = 2; pub const CHID_SMBIOS_PRODUCT_SKU: usize = 3; /// From SMBIOS Type 2 (Baseboard Information): pub const CHID_SMBIOS_BASEBOARD_MANUFACTURER: usize = 4; pub const CHID_SMBIOS_BASEBOARD_PRODUCT: usize = 5; /// From SMBIOS Type 0 (BIOS Information): pub const CHID_SMBIOS_BIOS_VENDOR: usize = 6; pub const CHID_SMBIOS_BIOS_VERSION: usize = 7; pub const CHID_SMBIOS_BIOS_MAJOR: usize = 8; pub const CHID_SMBIOS_BIOS_MINOR: usize = 9; /// From SMBIOS Type 3 (System Enclosure): pub const CHID_SMBIOS_ENCLOSURE_TYPE: usize = 10; /// From EDID (display panel identifier): pub const CHID_EDID_PANEL: usize = 11; /// Total number of possible CHID sources pub const CHID_SOURCE_MAX: usize = 12; /// CHID types and the sources of information they are generated from. /// /// Each entry is a bitmask indicating which hardware sources are combined to /// produce that CHID type. Types 0-14 are standard Microsoft CHID types, /// ordered from most specific (type 0: exact BIOS version match) to least /// specific (type 14: manufacturer only). Types 15-17 are non-standard /// extensions that include EDID panel information for display-specific /// firmware matching. /// /// Firmware vendors typically publish updates targeting multiple CHID types, /// allowing updates to match devices at the appropriate specificity level. pub const CHID_TYPES: [usize; 18] = [ // Type 0: Most specific - includes full BIOS version info // Manufacturer + Family + ProductName + SKU + BiosVendor + BiosVersion + // BiosMajor + BiosMinor 1 << CHID_SMBIOS_MANUFACTURER | 1 << CHID_SMBIOS_FAMILY | 1 << CHID_SMBIOS_PRODUCT_NAME | 1 << CHID_SMBIOS_PRODUCT_SKU | 1 << CHID_SMBIOS_BIOS_VENDOR | 1 << CHID_SMBIOS_BIOS_VERSION | 1 << CHID_SMBIOS_BIOS_MAJOR | 1 << CHID_SMBIOS_BIOS_MINOR, // Type 1: Like type 0 but without SKU 1 << CHID_SMBIOS_MANUFACTURER | 1 << CHID_SMBIOS_FAMILY | 1 << CHID_SMBIOS_PRODUCT_NAME | 1 << CHID_SMBIOS_BIOS_VENDOR | 1 << CHID_SMBIOS_BIOS_VERSION | 1 << CHID_SMBIOS_BIOS_MAJOR | 1 << CHID_SMBIOS_BIOS_MINOR, // Type 2: Like type 1 but without Family (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_PRODUCT_NAME) | (1 << CHID_SMBIOS_BIOS_VENDOR) | (1 << CHID_SMBIOS_BIOS_VERSION) | (1 << CHID_SMBIOS_BIOS_MAJOR) | (1 << CHID_SMBIOS_BIOS_MINOR), // Type 3: System + baseboard info (no BIOS version) (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_FAMILY) | (1 << CHID_SMBIOS_PRODUCT_NAME) | (1 << CHID_SMBIOS_PRODUCT_SKU) | (1 << CHID_SMBIOS_BASEBOARD_MANUFACTURER) | (1 << CHID_SMBIOS_BASEBOARD_PRODUCT), // Type 4: System info only (Manufacturer + Family + ProductName + SKU) (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_FAMILY) | (1 << CHID_SMBIOS_PRODUCT_NAME) | (1 << CHID_SMBIOS_PRODUCT_SKU), // Type 5: Manufacturer + Family + ProductName (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_FAMILY) | (1 << CHID_SMBIOS_PRODUCT_NAME), // Type 6: Manufacturer + SKU + baseboard info (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_PRODUCT_SKU) | (1 << CHID_SMBIOS_BASEBOARD_MANUFACTURER) | (1 << CHID_SMBIOS_BASEBOARD_PRODUCT), // Type 7: Manufacturer + SKU only (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_PRODUCT_SKU), // Type 8: Manufacturer + ProductName + baseboard info (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_PRODUCT_NAME) | (1 << CHID_SMBIOS_BASEBOARD_MANUFACTURER) | (1 << CHID_SMBIOS_BASEBOARD_PRODUCT), // Type 9: Manufacturer + ProductName only (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_PRODUCT_NAME), // Type 10: Manufacturer + Family + baseboard info (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_FAMILY) | (1 << CHID_SMBIOS_BASEBOARD_MANUFACTURER) | (1 << CHID_SMBIOS_BASEBOARD_PRODUCT), // Type 11: Manufacturer + Family only (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_FAMILY), // Type 12: Manufacturer + enclosure type (e.g., laptop vs desktop) (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_ENCLOSURE_TYPE), // Type 13: Manufacturer + baseboard info only (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_BASEBOARD_MANUFACTURER) | (1 << CHID_SMBIOS_BASEBOARD_PRODUCT), // Type 14: Manufacturer only - least specific standard type (1 << CHID_SMBIOS_MANUFACTURER), // Type 15 (non-standard): System info + EDID panel for display-specific fw (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_FAMILY) | (1 << CHID_SMBIOS_PRODUCT_NAME) | (1 << CHID_EDID_PANEL), // Type 16 (non-standard): Manufacturer + Family + EDID panel (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_FAMILY) | (1 << CHID_EDID_PANEL), // Type 17 (non-standard): Manufacturer + SKU + EDID panel (1 << CHID_SMBIOS_MANUFACTURER) | (1 << CHID_SMBIOS_PRODUCT_SKU) | (1 << CHID_EDID_PANEL), ]; /// Array of hardware source strings used to compute CHIDs. Each index /// corresponds to a CHID_SMBIOS_* or CHID_EDID_* constant. `None` indicates /// the source is not available on this system. pub type ChidSources = [Option; CHID_SOURCE_MAX]; #[derive(Clone, Copy, Debug)] pub enum ChidSourcesError { SmbiosError(SmbiosParseError), EdidError(EdidParseError), } impl Display for ChidSourcesError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { ChidSourcesError::SmbiosError(e) => Display::fmt(e, f), ChidSourcesError::EdidError(e) => Display::fmt(e, f), } } } impl From for ChidSourcesError { fn from(e: SmbiosParseError) -> Self { ChidSourcesError::SmbiosError(e) } } impl From for ChidSourcesError { fn from(e: EdidParseError) -> Self { ChidSourcesError::EdidError(e) } } pub fn chid_sources_from_smbios_and_edid( smbios_ep: Option<&[u8]>, smbios: &[u8], edid: Option<&[u8]>, ) -> Result { fn str_from_maybe_u8(s: Option<&[u8]>) -> Option { s.and_then(|s| str::from_utf8(s).ok()).map(String::from) } let mut chid_sources = ChidSources::default(); if let Some(type1) = find_smbios_table_by_type::(smbios, 1)? { let table = type1.table(); chid_sources[CHID_SMBIOS_MANUFACTURER] = str_from_maybe_u8(type1.get_string(table.manufacturer as usize)); chid_sources[CHID_SMBIOS_FAMILY] = str_from_maybe_u8(type1.get_string(table.family as usize)); chid_sources[CHID_SMBIOS_PRODUCT_NAME] = str_from_maybe_u8(type1.get_string(table.product_name as usize)); chid_sources[CHID_SMBIOS_PRODUCT_SKU] = str_from_maybe_u8(type1.get_string(table.sku_number as usize)); } if let Some(type2) = find_smbios_table_by_type::(smbios, 2)? { let table = type2.table(); chid_sources[CHID_SMBIOS_BASEBOARD_MANUFACTURER] = str_from_maybe_u8(type2.get_string(table.manufacturer as usize)); chid_sources[CHID_SMBIOS_BASEBOARD_PRODUCT] = str_from_maybe_u8(type2.get_string(table.product_name as usize)); } let is_smbios_atleast_24 = smbios_ep .map(|ep| { let (maj, min) = if ep.starts_with(b"_SM3_") { let Ok((sm3_ep, _)) = Smbios3EntryPoint::read_from_prefix(ep) else { return false; }; (sm3_ep.major_version, sm3_ep.minor_version) } else if ep.starts_with(b"_SM_") { let Ok((sm_ep, _)) = SmbiosEntryPoint::read_from_prefix(ep) else { return false; }; (sm_ep.major_version, sm_ep.minor_version) } else { return false; }; cmp_maj_min(maj, min, 2, 4).is_ge() }) .unwrap_or_else(|| false); if is_smbios_atleast_24 { if let Some(type0) = find_smbios_table_by_type::(smbios, 0)? { let table = type0.table(); chid_sources[CHID_SMBIOS_BIOS_VENDOR] = str_from_maybe_u8(type0.get_string(table.vendor as usize)); chid_sources[CHID_SMBIOS_BIOS_VERSION] = str_from_maybe_u8(type0.get_string(table.bios_version as usize)); // These are defined to be in lower-case hex with 2-digit zero padding chid_sources[CHID_SMBIOS_BIOS_MAJOR] = Some(format!("{:02x}", table.bios_major_release)); chid_sources[CHID_SMBIOS_BIOS_MINOR] = Some(format!("{:02x}", table.bios_minor_release)); } } else if let Some(type0) = find_smbios_table_by_type::(smbios, 0)? { let table = type0.table(); chid_sources[CHID_SMBIOS_BIOS_VENDOR] = str_from_maybe_u8(type0.get_string(table.vendor as usize)); chid_sources[CHID_SMBIOS_BIOS_VERSION] = str_from_maybe_u8(type0.get_string(table.bios_version as usize)); } if let Some(type3) = find_smbios_table_by_type::(smbios, 3)? { // This is defined to be in lower-case hex with no padding chid_sources[CHID_SMBIOS_ENCLOSURE_TYPE] = Some(format!("{:x}", type3.table().type_)); } if let Some(edid) = edid { let parsed_edid = ParsedEdid::parse(edid)?; chid_sources[CHID_EDID_PANEL] = Some(parsed_edid.panel_id()?); } Ok(chid_sources) } /// Computes a CHID GUID from hardware source strings and a CHID type bitmask. /// The `chid_type` selects which sources to include (use values from /// [`CHID_TYPES`]). Returns `None` if any required source is missing. /// /// The computation hashes the namespace GUID followed by the selected sources /// (as UCS-2 strings separated by '&'), then formats the first 16 bytes of the /// SHA-1 digest as a version 5 UUID per RFC 9562. /// /// # Examples /// /// ``` /// use lace_util::chid::*; /// /// // Type 14 only requires manufacturer /// let mut srcs: ChidSources = Default::default(); /// srcs[CHID_SMBIOS_MANUFACTURER] = Some("LENOVO".into()); /// /// let chid = compute_chid(&srcs, CHID_TYPES[14]).unwrap(); /// assert_eq!(chid, lace_util::guid_str("6de5d951-d755-576b-bd09-c5cf66b27234")); /// ``` pub fn compute_chid(srcs: &ChidSources, chid_type: usize) -> Option { let mut ctx = Sha1Ctx::new(); // Hash CHID namespace GUID in big-endian format (RFC 9562 requires big- // endian for the multi-byte fields when hashing) let mut ns_be = CHID_NAMESPACE_GUID; ns_be.data1 = ns_be.data1.to_be(); ns_be.data2 = ns_be.data2.to_be(); ns_be.data3 = ns_be.data3.to_be(); ctx.update(ns_be.as_bytes()); // Hash all selected sources as UCS-2 (UTF-16) strings, separated by '&' let mut first = true; for (i, src) in srcs.iter().enumerate() { if (chid_type & (1 << i)) != 0 { if !first { // UCS-2 encoded '&' separator between fields ctx.update(&[b'&', 0]); } else { first = false; } if let Some(src) = src { // Convert source string to UCS-2 (UTF-16) for hashing let ucs2: Vec = src.encode_utf16().collect(); ctx.update(ucs2.as_bytes()); } else { return None; } } } // Extract the GUID from first 16 bytes of SHA-1 digest (big-endian format) let digest = ctx.digest(); let (mut chid, _) = unsafe { // SAFETY: SHA1 digest is 20 bytes, GUID is 16 bytes debug_assert!(SHA1_DIGEST_SIZE >= size_of::()); crate::Guid::read_from_prefix(&digest).unwrap_unchecked() }; // Convert from big-endian (hash output) to native-endian for GUID chid.data1 = u32::from_be(chid.data1); chid.data2 = u16::from_be(chid.data2); chid.data3 = u16::from_be(chid.data3); // Apply RFC 9562 version 5 (SHA-1 name-based) UUID formatting: // - Set version field (bits 12-15 of data3) to 5 // - Set variant field (the two most significant bits (7-6) of data4[0]) to // binary 0b10 (i.e., pattern 10xxxxxx) per RFC 9562 chid.data3 = (chid.data3 & 0x0fff) | (5 << 12); chid.data4[0] = (chid.data4[0] & 0x3f) | 0x80; Some(chid) } #[cfg(test)] mod test { use super::*; fn assert_eq_all_chids(srcs: &ChidSources, expected_chids: &[Option]) { for (i, &chid_type) in CHID_TYPES.iter().enumerate() { if let Some(chid) = compute_chid(srcs, chid_type) { println!("CHID type {}: {}", i, chid); } else { println!("CHID type {}: ", i); } } for (i, &chid_type) in CHID_TYPES.iter().enumerate() { let computed_chid = compute_chid(srcs, chid_type); assert_eq!(computed_chid, expected_chids[i], "CHID type {} mismatch", i); } } // These test cases are based on real data from real devices, // and corresponding known-good CHIDs generated by fwupd or systemd-analyze. #[test] fn test_lenovo_miix_630() { let srcs: ChidSources = [ Some("LENOVO".into()), // CHID_SMBIOS_MANUFACTURER Some("Miix 630".into()), // CHID_SMBIOS_FAMILY Some("81F1".into()), // CHID_SMBIOS_PRODUCT_NAME Some("LENOVO_MT_81F1_BU_idea_FM_Miix 630".into()), // CHID_SMBIOS_PRODUCT_SKU Some("LENOVO".into()), // CHID_SMBIOS_BASEBOARD_MANUFACTURER Some("LNVNB161216".into()), // CHID_SMBIOS_BASEBOARD_PRODUCT Some("LENOVO".into()), // CHID_SMBIOS_BIOS_VENDOR Some("8WCN25WW".into()), // CHID_SMBIOS_BIOS_VERSION None, // CHID_SMBIOS_BIOS_MAJOR None, // CHID_SMBIOS_BIOS_MINOR Some("32".into()), // CHID_SMBIOS_ENCLOSURE_TYPE None, // CHID_EDID_PANEL ]; let expected_chids = [ None, None, None, Some(crate::guid_str("16a55446-eba9-5f97-80e3-5e39d8209bc3")), Some(crate::guid_str("c4c9a6be-5383-5de7-af35-c2de505edec8")), Some(crate::guid_str("14f581d2-d059-5cb2-9f8b-56d8be7932c9")), Some(crate::guid_str("a51054fb-5eef-594a-a5a0-cd87632d0aea")), Some(crate::guid_str("307ab358-ed84-57fe-bf05-e9195a28198d")), Some(crate::guid_str("7e613574-5445-5797-9567-2d0ed86e6ffa")), Some(crate::guid_str("b0f4463c-f851-5ec3-b031-2ccb873a609a")), Some(crate::guid_str("08b75d1f-6643-52a1-9bdd-071052860b33")), Some(crate::guid_str("dacf4a59-8e87-55c5-8b93-6912ded6bf7f")), Some(crate::guid_str("d0a8deb1-4cb5-50cd-bdda-595cfc13230c")), Some(crate::guid_str("71d86d4d-02f8-5566-a7a1-529cef184b7e")), Some(crate::guid_str("6de5d951-d755-576b-bd09-c5cf66b27234")), None, None, None, ]; assert_eq_all_chids(&srcs, &expected_chids); } #[test] fn test_acer_aspire_a114_61() { let srcs: ChidSources = [ Some("Acer".into()), Some("Aspire 1".into()), Some("Aspire A114-61".into()), Some("".into()), Some("S7C".into()), Some("Daisy_7C".into()), Some("Phoenix".into()), Some("V1.13".into()), Some("01".into()), Some("0d".into()), Some("a".into()), None, ]; let expected_chids = [ Some(crate::guid_str("45d37dbe-40fb-57bd-a257-55f422d4dc0a")), Some(crate::guid_str("373bfde5-ffaa-504c-84f3-f8f5357dfc29")), Some(crate::guid_str("e12521bf-0ed8-5406-af87-adad812c57c5")), Some(crate::guid_str("faa12ed4-bd49-5471-8f74-75c2267c3b46")), Some(crate::guid_str("965e3681-de3b-5e39-bb62-7d4917d7e36f")), Some(crate::guid_str("82fe1869-361c-56b2-b853-631747e64aa7")), Some(crate::guid_str("7e15f49e-04b4-5d56-a567-e7a15ba2aca1")), Some(crate::guid_str("7c107a7f-2d77-51aa-aef8-8d777e26ffbc")), Some(crate::guid_str("68b38fff-aadc-512c-937b-99d9c13eb484")), Some(crate::guid_str("260192d4-06d4-5124-ab46-ba210f4c14d7")), Some(crate::guid_str("175f000b-3d05-5c01-aedd-817b1a141f93")), Some(crate::guid_str("24277a94-7064-500f-9854-5264f20cfa99")), Some(crate::guid_str("92dcc94d-48f7-5ee8-b9ec-a6393fb7a484")), Some(crate::guid_str("d234a917-df0b-5453-a3d9-f27c06307395")), Some(crate::guid_str("1e301734-5d49-5df4-9ed2-aa1c0a9dddda")), None, None, None, ]; assert_eq_all_chids(&srcs, &expected_chids); } #[test] fn test_lenovo_yoga_5g_14q8cx05() { let srcs: ChidSources = [ Some("LENOVO".into()), Some("Yoga 5G 14Q8CX05".into()), Some("81XE".into()), Some("LENOVO_MT_81XE_BU_idea_FM_Yoga 5G 14Q8CX05".into()), Some("LENOVO".into()), Some("LNVNB161216".into()), Some("LENOVO".into()), Some("EACN41WW(V1.13)".into()), Some("01".into()), Some("29".into()), Some("1f".into()), None, ]; let expected_chids = [ Some(crate::guid_str("ea646c11-3da1-5c8d-9346-8ff156746650")), Some(crate::guid_str("5100eeed-c5e2-5b74-9c24-a22ca0644826")), Some(crate::guid_str("ddb3bcda-db7b-579d-9dd9-bcc4f5b052b8")), Some(crate::guid_str("fb364c09-efc0-5d16-ac97-0a3e6235b16c")), Some(crate::guid_str("7e7007ac-603c-55ef-bb77-3548784b9578")), Some(crate::guid_str("566b9ae8-a7fd-5c44-94d6-bac3e4cf38a7")), Some(crate::guid_str("6f3bdfb7-f832-5c5f-9777-9e3db35e22a6")), Some(crate::guid_str("c4ea686c-c56c-5e8e-a91e-89056683d417")), Some(crate::guid_str("a1a13249-2689-5c6d-a43f-98af040284c4")), Some(crate::guid_str("01439aea-e75c-5fbb-8842-18dcd1a7b8b3")), Some(crate::guid_str("65ab9f32-bbc8-52d3-87f9-b618fda7c07e")), Some(crate::guid_str("41ba2569-88df-57d4-b5e3-350ff985434a")), Some(crate::guid_str("32b7e294-a252-5a72-b3c6-6197f08c64f1")), Some(crate::guid_str("71d86d4d-02f8-5566-a7a1-529cef184b7e")), Some(crate::guid_str("6de5d951-d755-576b-bd09-c5cf66b27234")), None, None, None, ]; assert_eq_all_chids(&srcs, &expected_chids); } #[test] fn test_lenovo_thinkpad_t14s_gen6() { let srcs: ChidSources = [ Some("LENOVO".into()), Some("ThinkPad T14s Gen 6".into()), Some("21N2ZC5QUS".into()), Some("LENOVO_MT_21N2_BU_Think_FM_ThinkPad T14s Gen 6".into()), Some("LENOVO".into()), Some("21N2ZC5QUS".into()), Some("LENOVO".into()), Some("N42ET92W (2.22 )".into()), Some("02".into()), Some("16".into()), Some("a".into()), Some("BOE0b66".into()), ]; let expected_chids = [ Some(crate::guid_str("36bf13ab-c1b4-5e16-a9c9-96a8d6fd03b0")), Some(crate::guid_str("c8a30ee5-0482-5676-b108-676449dcf8aa")), Some(crate::guid_str("8e0c26cf-cccb-5a1c-bdd3-c1179224d5f4")), Some(crate::guid_str("f6cd4a9f-9632-516e-b748-65952f7380c5")), Some(crate::guid_str("a5a4e3c1-5922-5ed6-b78e-9f0ea873a988")), Some(crate::guid_str("a20ae3ec-49a1-5cb5-acb8-5d31c77b105a")), Some(crate::guid_str("8cfd85bb-0d77-59df-8546-264239be475e")), Some(crate::guid_str("513976f8-3f51-5b42-9ae0-931ce23c5f38")), Some(crate::guid_str("86a0d770-3ca1-57fa-ac05-413481c00a24")), Some(crate::guid_str("5c20e964-d530-5dd7-9efd-4aed9e73c3cb")), Some(crate::guid_str("d93b21c0-5ed9-5955-911a-5b15f114d786")), Some(crate::guid_str("431ff9e9-cd92-51c1-8917-46b0a0ef147c")), Some(crate::guid_str("e093d715-70f7-51f4-b6c8-b4a7e31def85")), Some(crate::guid_str("62631c9b-2642-5d4f-b7e2-1b917809d08d")), Some(crate::guid_str("6de5d951-d755-576b-bd09-c5cf66b27234")), Some(crate::guid_str("a8852b56-45ea-5377-ba2d-1910a5c897bb")), Some(crate::guid_str("1538c7fb-26b6-5144-b16f-2500b5a0a503")), Some(crate::guid_str("1480f3ca-b01a-5d7c-bbc9-7a17d7b4b58d")), ]; assert_eq_all_chids(&srcs, &expected_chids); } } lace-0.1.0/lace-util/src/chid_mapping.rs000066400000000000000000002723231514263214500200660ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! CHID mapping parser //! This is same format used in systemd UEFI ".hwids" section. //! It is a list of length prefixed entries, terminated by an entry with zero type and length. //! The entries are followed by a table of NUL-terminated strings, which are referenced by the //! entries by absolute offset. use crate::Guid; use core::{fmt::Display, mem::size_of}; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; // (Private) definitions for the binary serialization format #[derive(Default, FromBytes, IntoBytes, Immutable, KnownLayout)] #[repr(C)] struct ChidMappingHeader { descriptor: u32, // Upper 4 bits: type, lower 28 bits: length chid: Guid, } const CHID_MAPPING_DESCRIPTOR_DEVICE_TREE: u32 = 0x1; const CHID_MAPPING_DESCRIPTOR_UEFI_FW: u32 = 0x2; #[derive(FromBytes, IntoBytes, Immutable, KnownLayout)] #[repr(C)] struct ChidMappingDeviceTree { name_offset: u32, compatible_offset: u32, } #[derive(FromBytes, IntoBytes, Immutable, KnownLayout)] #[repr(C)] struct ChidMappingUefiFw { name_offset: u32, fwid_offset: u32, } /// Parsed CHID mapping entry #[derive(Clone, Debug, PartialEq, Eq)] pub enum ChidMapping<'s> { DeviceTree { chid: Guid, name: Option<&'s str>, compatible: Option<&'s str>, }, UefiFw { chid: Guid, name: Option<&'s str>, fwid: Option<&'s str>, }, Unknown { kind: u32, chid: Guid, body: &'s [u8], }, } /// Error indicating malformed CHID mappings data #[derive(Clone, Copy, Default, Debug)] pub struct MalformedChidMappings; impl Display for MalformedChidMappings { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "malformed CHID mappings data") } } pub struct ChidMappingIterator<'s> { data: &'s [u8], remaining: &'s [u8], } impl<'s> From<&'s [u8]> for ChidMappingIterator<'s> { /// Create an iterator over CHID mappings from the given data slice fn from(data: &'s [u8]) -> Self { Self { data, remaining: data, } } } impl<'s> Iterator for ChidMappingIterator<'s> { type Item = Result, MalformedChidMappings>; fn next(&mut self) -> Option { self.next_chid_mapping().transpose() } } impl<'s> ChidMappingIterator<'s> { /// Parse the next CHID mapping entry from remaining data fn next_chid_mapping(&mut self) -> Result>, MalformedChidMappings> { let (header, body) = ChidMappingHeader::read_from_prefix(self.remaining) .map_err(|_| MalformedChidMappings)?; // Terminator always needs to be present if header.descriptor == 0 { // End marker entry return Ok(None); } let entry_length: usize = (header.descriptor & 0x0fff_ffff) as usize; let body = entry_length .checked_sub(size_of::()) .and_then(|body_len| body.get(..body_len)) .ok_or(MalformedChidMappings)?; // Entry truncated let mapping = match header.descriptor >> 28 { CHID_MAPPING_DESCRIPTOR_DEVICE_TREE => { let (body, _) = ChidMappingDeviceTree::read_from_prefix(body) .map_err(|_| MalformedChidMappings)?; // Entry truncated ChidMapping::DeviceTree { chid: header.chid, name: self.extract_string(body.name_offset as usize)?, compatible: self.extract_string(body.compatible_offset as usize)?, } } CHID_MAPPING_DESCRIPTOR_UEFI_FW => { let (body, _) = ChidMappingUefiFw::read_from_prefix(body).map_err(|_| MalformedChidMappings)?; // Entry truncated ChidMapping::UefiFw { chid: header.chid, name: self.extract_string(body.name_offset as usize)?, fwid: self.extract_string(body.fwid_offset as usize)?, } } _ => ChidMapping::Unknown { kind: header.descriptor >> 28, chid: header.chid, body, }, }; self.remaining = &self.remaining[entry_length..]; // Advance to next entry Ok(Some(mapping)) } /// Extract a NUL-terminated string from data at the given offset (or None if offset is 0) fn extract_string(&self, offset: usize) -> Result, MalformedChidMappings> { if offset == 0 { return Ok(None); } let slice = self.data.get(offset..).ok_or(MalformedChidMappings)?; let nul_pos = slice .iter() .position(|&b| b == 0) .ok_or(MalformedChidMappings)?; str::from_utf8(&slice[..nul_pos]) .map_err(|_| MalformedChidMappings) .map(Some) } } impl ChidMapping<'_> { /// Returns the CHID of the mapping pub fn chid(&self) -> &Guid { match self { ChidMapping::DeviceTree { chid, .. } => chid, ChidMapping::UefiFw { chid, .. } => chid, ChidMapping::Unknown { chid, .. } => chid, } } /// Provides the kind/type of the mapping when serialized #[cfg(feature = "std")] fn serialized_kind(&self) -> u32 { match self { ChidMapping::DeviceTree { .. } => CHID_MAPPING_DESCRIPTOR_DEVICE_TREE, ChidMapping::UefiFw { .. } => CHID_MAPPING_DESCRIPTOR_UEFI_FW, ChidMapping::Unknown { kind, .. } => *kind, } } /// Calculates the size of the mapping when serialized #[cfg(feature = "std")] fn serialized_size(&self) -> usize { size_of::() + match self { ChidMapping::DeviceTree { .. } => size_of::(), ChidMapping::UefiFw { .. } => size_of::(), ChidMapping::Unknown { body, .. } => body.len(), } } } /// Serialize a set of CHID mappings to the given writer /// Serializing Unknown mappings is supported, but their body is written as-is /// which means that any string offsets inside them will likely be invalid. #[cfg(feature = "std")] pub fn serialize_chid_mappings<'s, W: std::io::Write>( mut w: W, mappings: &[ChidMapping<'s>], ) -> std::io::Result<()> { // Figure out the size of formatted data to know where string data starts let formatted_size: usize = mappings.iter().map(ChidMapping::serialized_size).sum(); let formatted_size = formatted_size + size_of::() + 8; // Terminator entry + its body // Buffer to store the strings until we write them let mut string_data: Vec = Vec::new(); // De-duplication map for strings let mut string_dedup = std::collections::HashMap::<&'s str, u32>::new(); // Write a serialized string to string_data and return its offset let mut serialize_string = |s: Option<&'s str>| { if let Some(s) = s { if let Some(&offset) = string_dedup.get(s) { return offset; } let offset = formatted_size + string_data.len(); string_data.extend_from_slice(s.as_bytes()); string_data.push(0); // NUL terminator string_dedup.insert(s, offset as u32); offset as u32 } else { 0 } }; for mapping in mappings.iter() { w.write_all( ChidMappingHeader { descriptor: (mapping.serialized_kind() << 28) | mapping.serialized_size() as u32, chid: *mapping.chid(), } .as_bytes(), )?; match mapping { ChidMapping::DeviceTree { name, compatible, .. } => { w.write_all( ChidMappingDeviceTree { name_offset: serialize_string(*name), compatible_offset: serialize_string(*compatible), } .as_bytes(), )?; } ChidMapping::UefiFw { name, fwid, .. } => { w.write_all( ChidMappingUefiFw { name_offset: serialize_string(*name), fwid_offset: serialize_string(*fwid), } .as_bytes(), )?; } ChidMapping::Unknown { kind: _, chid: _, body, } => { w.write_all(body)?; } } } // Write the terminator entry // NOTE: systemd-ukify writes a full sized entry with 2 x u32s as body here, so // we do the same to make the outputs compatible with possibly broken parsers. w.write_all(ChidMappingHeader::default().as_bytes())?; w.write_all(&[0u8; 8])?; // Write string data w.write_all(&string_data)?; Ok(()) } #[cfg(test)] mod tests { use super::*; use crate::guid_str; fn push_mapping(data: &mut Vec, header: ChidMappingHeader, body: &[u8]) { data.extend_from_slice(header.as_bytes()); data.extend_from_slice(body); } fn push_strings(data: &mut Vec, strings: &[&str]) { for s in strings.iter() { data.extend_from_slice(s.as_bytes()); data.push(0); // NUL terminator } } fn parse_chid_mappings<'s>( data: &'s [u8], ) -> Result>, MalformedChidMappings> { ChidMappingIterator::from(data).collect::, _>>() } // Error cases #[test] fn test_empty_no_terminator() { assert!(parse_chid_mappings(&[]).is_err()); } #[test] fn test_entry_length_does_not_cover_header() { let mut data = Vec::new(); push_mapping( &mut data, ChidMappingHeader { descriptor: 0x5000_0004, chid: Guid::default(), }, &[], ); // type 5, length 4 (too small for header) push_mapping(&mut data, ChidMappingHeader::default(), &[]); // terminator assert!(parse_chid_mappings(&data).is_err()); } #[test] fn test_entry_length_exceeds_data() { let mut data = Vec::new(); push_mapping( &mut data, ChidMappingHeader { descriptor: 0x6000_0040, chid: Guid::default(), }, &[], ); // type 6, length 64 (larger than data) push_mapping(&mut data, ChidMappingHeader::default(), &[]); // terminator assert!(parse_chid_mappings(&data).is_err()); } #[test] fn test_entry_length_does_not_cover_body() { let mut data = Vec::new(); push_mapping( &mut data, ChidMappingHeader { descriptor: 0x1000_0014, chid: Guid::default(), }, ChidMappingDeviceTree { name_offset: 0, compatible_offset: 0, } .as_bytes(), ); // type 1, length 20 (too small for body) push_mapping(&mut data, ChidMappingHeader::default(), &[]); // terminator assert!(parse_chid_mappings(&data).is_err()); } #[test] fn test_string_offset_outside_data() { let mut data = Vec::new(); push_mapping( &mut data, ChidMappingHeader { descriptor: 0x1000_001c, chid: Guid::default(), }, ChidMappingDeviceTree { name_offset: 0x0fff_ffff, // invalid offset compatible_offset: 0, } .as_bytes(), ); // type 1, length 28 push_mapping(&mut data, ChidMappingHeader::default(), &[]); // terminator assert!(parse_chid_mappings(&data).is_err()); } // Happy cases #[test] fn test_empty_terminator() { let mut data = Vec::new(); push_mapping(&mut data, ChidMappingHeader::default(), &[]); // terminator let r = parse_chid_mappings(&data).expect("failed to parse CHID mappings"); assert!(r.is_empty()); } #[test] fn test_single_device_tree_mapping() { let mut data = Vec::new(); push_mapping( &mut data, ChidMappingHeader { descriptor: 0x1000_001c, chid: Guid::default(), }, ChidMappingDeviceTree { name_offset: 48, compatible_offset: 57, } .as_bytes(), ); // type 1, length 28 push_mapping(&mut data, ChidMappingHeader::default(), &[]); // terminator push_strings(&mut data, &["MyDevice", "my,compatible"]); let r = parse_chid_mappings(&data).expect("failed to parse CHID mappings"); assert_eq!( r, vec![ChidMapping::DeviceTree { chid: Guid::default(), name: Some("MyDevice"), compatible: Some("my,compatible"), }] ); } #[test] fn test_multiple_mappings() { let mut data = Vec::new(); push_mapping( &mut data, ChidMappingHeader { descriptor: 0x1000_001c, chid: Guid::default(), }, ChidMappingDeviceTree { name_offset: 276, compatible_offset: 285, } .as_bytes(), ); // type 1, length 28 push_mapping( &mut data, ChidMappingHeader { descriptor: 0x5000_00c8, chid: Guid::default(), }, &[0x42u8; 180], ); // unknown type 5, length 200, skipped push_mapping( &mut data, ChidMappingHeader { descriptor: 0x2000_001c, chid: Guid::read_from_bytes(&[1u8; 16]).unwrap(), }, ChidMappingUefiFw { name_offset: 299, fwid_offset: 310, } .as_bytes(), ); // type 2, length 28 push_mapping(&mut data, ChidMappingHeader::default(), &[]); // terminator push_strings( &mut data, &["MyDevice", "my,compatible", "MyFirmware", "FWID1234"], ); let r = parse_chid_mappings(&data).expect("failed to parse CHID mappings"); assert_eq!( r, vec![ ChidMapping::DeviceTree { chid: Guid::default(), name: Some("MyDevice"), compatible: Some("my,compatible"), }, ChidMapping::Unknown { kind: 5, chid: Guid::default(), body: &[0x42u8; 180], }, ChidMapping::UefiFw { chid: Guid::read_from_bytes(&[1u8; 16]).unwrap(), name: Some("MyFirmware"), fwid: Some("FWID1234"), }, ] ); } #[test] fn test_real_mappings_from_ubuntu_kernel() { use ChidMapping::*; let bytes = include_bytes!("../testdata/linux_signed_6.17.0-6.6_arm64_hwids.bin"); let r = parse_chid_mappings(bytes).expect("failed to parse CHID mappings"); let e = [ DeviceTree { chid: guid_str("08b75d1f-6643-52a1-9bdd-071052860b33"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("14f581d2-d059-5cb2-9f8b-56d8be7932c9"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("16a55446-eba9-5f97-80e3-5e39d8209bc3"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("307ab358-ed84-57fe-bf05-e9195a28198d"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("34df58d6-b605-50aa-9313-9b34f5c4b6fc"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("7e613574-5445-5797-9567-2d0ed86e6ffa"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("a51054fb-5eef-594a-a5a0-cd87632d0aea"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("b0f4463c-f851-5ec3-b031-2ccb873a609a"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("c4c9a6be-5383-5de7-af35-c2de505edec8"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("e0a96696-f0a6-5466-a6db-207fbe8bae3c"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, DeviceTree { chid: guid_str("175f000b-3d05-5c01-aedd-817b1a141f93"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("260192d4-06d4-5124-ab46-ba210f4c14d7"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("373bfde5-ffaa-504c-84f3-f8f5357dfc29"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("45d37dbe-40fb-57bd-a257-55f422d4dc0a"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("68b38fff-aadc-512c-937b-99d9c13eb484"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("7c107a7f-2d77-51aa-aef8-8d777e26ffbc"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("7e15f49e-04b4-5d56-a567-e7a15ba2aca1"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("82fe1869-361c-56b2-b853-631747e64aa7"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("965e3681-de3b-5e39-bb62-7d4917d7e36f"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("e12521bf-0ed8-5406-af87-adad812c57c5"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("faa12ed4-bd49-5471-8f74-75c2267c3b46"), name: Some("Acer Aspire 1"), compatible: Some("acer,aspire1"), }, DeviceTree { chid: guid_str("01439aea-e75c-5fbb-8842-18dcd1a7b8b3"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("5100eeed-c5e2-5b74-9c24-a22ca0644826"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("566b9ae8-a7fd-5c44-94d6-bac3e4cf38a7"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("65ab9f32-bbc8-52d3-87f9-b618fda7c07e"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("6f3bdfb7-f832-5c5f-9777-9e3db35e22a6"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("7e7007ac-603c-55ef-bb77-3548784b9578"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("a1a13249-2689-5c6d-a43f-98af040284c4"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("c4ea686c-c56c-5e8e-a91e-89056683d417"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("ddb3bcda-db7b-579d-9dd9-bcc4f5b052b8"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("ea646c11-3da1-5c8d-9346-8ff156746650"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("fb364c09-efc0-5d16-ac97-0a3e6235b16c"), name: Some("LENOVO Yoga 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("06675172-9a6e-5276-a505-d205688a87f0"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("12c0e5b0-8886-5444-b42b-93692fa736df"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("16551bd5-37b0-571d-a94c-da61a9cfccf5"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("23dcfb84-d132-5f60-878e-64fe0b9417d6"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("39fca706-c9a2-54d4-8c7c-d5e292d0a725"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("997c1c76-5595-5300-9f58-94d2c6ffc586"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("ad47f2e9-2f8c-5cd1-a44e-82f35a43e44e"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("b9bf941f-3a32-57da-b609-5fff7fb382cd"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("df3ecc56-b61b-5f8e-896f-801a42b536d6"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("ea658d2b-f644-555d-9b72-e1642401a795"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("fb5c3077-39d5-5a44-97ce-2d3be5f6bfec"), name: Some("LENOVO Flex 5G 14Q8CX05"), compatible: Some("lenovo,flex-5g"), }, DeviceTree { chid: guid_str("0c78ef16-4fe0-5e33-908e-b038949ee608"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("13311789-793f-5d95-942c-3b6414a8ad1a"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("1c2effc1-1038-584d-ae8b-7c912c8e9504"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("3eb6683b-0153-5365-81c6-cc599783e9c7"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("4f04f31f-17f0-583f-802f-82c3a0b34128"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("6eb75906-3a4e-5de4-94c5-374d8f9723e5"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("7ea8b73b-2cbb-562b-aecc-7f0f64c42630"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("80c86c24-c7a7-5714-abf2-4c48f348cecc"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("b866fc5c-261b-56d8-99e8-03ea0646af8f"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("d8846172-f0a0-55ba-bf41-55641f588ea7"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("e1b94e53-0f20-5d01-abfc-cfb348544a31"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("e5a0ed2b-7fed-5e2d-94ed-43dbaf0b9ccc"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("e98c95a8-b50e-5d8b-b2db-c679a39163df"), name: Some("HUAWEI MateBook E"), compatible: Some("huawei,gaokun3"), }, DeviceTree { chid: guid_str("0909a1c3-3a02-59a0-b1ea-04f1449c104f"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("3486eccc-d0ac-534a-9e2f-a1c18bc310c6"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("3ad863ab-0181-5a2f-9cc1-70eedc446da9"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("3f9d2d91-73b2-5316-8c72-a0ecb3f0dae5"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("4b189129-8eb2-585c-a1bb-a4cfc979433a"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("4df470e6-7878-5b0f-b2e0-733d5d9fa228"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("64b71f12-4341-5e5c-b7cd-25b6503799e3"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("69acf6bf-ed33-5806-857f-c76971d7061e"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("69c47e1e-fde2-5062-b777-acbeab73784b"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("810e34c6-cc69-5e36-8675-2f6e354272d3"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("873455fb-b2c5-5c0c-9c2c-90e80d44da57"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("9f47e28f-e1ee-5cb5-b4ce-8f0605752b3d"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("a1dfe209-99e5-5ff2-9922-aa4c11491b49"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("abdbb2cb-ab52-5674-9d0a-2e2cb69bcbb4"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("b265d777-007e-56e5-b0e2-bd666ab867be"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("b41f58ed-7631-561f-9b0c-449a9c293afa"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("b470d002-ad8e-5d5c-a7bf-bb1333f2ce4b"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("c869f39e-f205-5ca0-be7b-d90f90ef5556"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("ddf28a3f-43fc-54a4-a6a7-4cba5ad46b3e"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("ddfbdaa2-7c46-5103-be64-84a9f88c485f"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("f22c935e-2dc8-5949-9486-09bbf10361b2"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("fbf92a11-bb6f-5adb-b5a7-8abf9acbd7d9"), name: Some("LENOVO ThinkPad X13s Gen 1"), compatible: Some("lenovo,thinkpad-x13s"), }, DeviceTree { chid: guid_str("046fefee-341b-5c40-b0a3-1c647d31b500"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("08f06457-aa19-51c5-be4c-0087ce4fa2ed"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("11b80238-dbee-57bc-8b26-83c9e5b4057d"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("53b87f48-fc47-54e9-ade5-f1a95e885681"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("5bd24fc5-5edb-51f6-82e6-31a9ef954c5b"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("69ba0503-ca94-5fa3-b78c-5fa21a66c620"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("813677fa-6d11-5756-a44d-dde0f552d3f6"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("ad2ee931-a048-5253-b350-98c482670765"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("ce83144b-b123-59e5-8a9a-0c1a13643fc4"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("d67e799e-2ba7-555a-a874-a0523a8b3b11"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("f59639f4-4970-5706-9a75-519dd059f69e"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,blackrock"), }, DeviceTree { chid: guid_str("009d2337-4f76-514e-b2c1-b2816447b048"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("3a486e6f-3b0a-5603-a483-503381d3d8c3"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("5caa88bc-ea9b-5d73-a69a-89024bfff854"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("6309fbb9-68f4-54f9-bbc9-b3ca9685b48c"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("636b6071-7848-50d5-b0b5-6290c49e9306"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("94fb24a7-ff7a-5d70-9ac8-518a9e44ea64"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("9bac72c6-83f6-5e21-af8e-bc1f5c2b7cc8"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("9d70dcfd-f56b-58bf-b1bd-a1b8f2b0ec7e"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("a659ee2b-502d-50f7-9921-bdbd34734e0b"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("c0cf7078-c325-5cf6-966b-3bbbc155275b"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("e3d941fa-2bfa-5875-8efd-87ce997f8338"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,arcata"), }, DeviceTree { chid: guid_str("30b031c0-9de7-5d31-a61c-dee772871b7d"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("382926c0-ce35-53af-8ff9-ca9cc06cfc7b"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("43b71948-9c47-5372-a5cb-18db47bb873f"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("5ca3cf2b-d6e9-5b54-93f7-1cebd7b3704f"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("67a23be6-42a6-5900-8325-847a318ce252"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("81f308c0-db65-50c2-a660-52e06fc0ff9f"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("8f56cf17-7bdd-5414-832d-97cd26837114"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("94f73d29-3981-59a8-8f25-214f84d1522a"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("b323d38a-88c6-5cf6-af0d-0db3f3c2560d"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("b8c71349-3669-56f3-99ee-ae473a2edd96"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("d17c132e-f06e-5e38-8084-9cd642dd9b34"), name: Some("LENOVO YOGA C630-13Q50"), compatible: Some("lenovo,yoga-c630"), }, DeviceTree { chid: guid_str("4bb05d50-6c4f-525d-a9ec-8924afd6edea"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e001de-devkit"), }, DeviceTree { chid: guid_str("830bd4a2-2498-55cf-b561-48f7dc5f4820"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e001de-devkit"), }, DeviceTree { chid: guid_str("9cba20d0-17ad-559f-94cd-cfcbbf5f71f5"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e001de-devkit"), }, DeviceTree { chid: guid_str("baa7a649-12d8-56c7-93c5-a4e10f4852be"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e001de-devkit"), }, DeviceTree { chid: guid_str("c8e75ab8-555c-5952-a3e3-5b607bea031d"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e001de-devkit"), }, DeviceTree { chid: guid_str("f37dc44b-0be4-5a70-86bd-81f3dacff2e9"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e001de-devkit"), }, DeviceTree { chid: guid_str("1480f3ca-b01a-5d7c-bbc9-7a17d7b4b58d"), name: Some("LENOVO ThinkPad T14s Gen 6 (LCD)"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("1538c7fb-26b6-5144-b16f-2500b5a0a503"), name: Some("LENOVO ThinkPad T14s Gen 6 (LCD)"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("2b1b6e68-cee9-549b-b8ae-10c274b8c3a6"), name: Some("LENOVO ThinkPad T14s Gen 6 (LCD)"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("48a732b5-3989-5ac3-b661-516a46f00792"), name: Some("LENOVO ThinkPad T14s Gen 6 (LCD)"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("53b6927f-d6ca-5674-a0e8-a50a989d4ba0"), name: Some("LENOVO ThinkPad T14s Gen 6 (LCD)"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("83579fdf-8faf-57b4-b265-d2e817c7cf3f"), name: Some("LENOVO ThinkPad T14s Gen 6 (LCD)"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("a07b8e34-d6b6-58b2-9963-38216ec67159"), name: Some("LENOVO ThinkPad T14s Gen 6 (LCD)"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("a8852b56-45ea-5377-ba2d-1910a5c897bb"), name: Some("LENOVO ThinkPad T14s Gen 6 (LCD)"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("b0e14398-0a96-5736-840b-7349e5c0b85c"), name: Some("LENOVO ThinkPad T14s Gen 6 (LCD)"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("08ba7f5b-8136-5938-835a-fd99143d34a5"), name: Some("LENOVO ThinkPad T14s Gen 6 (OLED)"), compatible: Some("lenovo,thinkpad-t14s-oled"), }, DeviceTree { chid: guid_str("27378ce5-d999-5c3b-acde-0404805afd3b"), name: Some("LENOVO ThinkPad T14s Gen 6 (OLED)"), compatible: Some("lenovo,thinkpad-t14s-oled"), }, DeviceTree { chid: guid_str("77ffaabe-038a-550f-b6ea-485dc49d4b45"), name: Some("LENOVO ThinkPad T14s Gen 6 (OLED)"), compatible: Some("lenovo,thinkpad-t14s-oled"), }, DeviceTree { chid: guid_str("7c09107d-0ac3-5582-837f-c614d518cf62"), name: Some("LENOVO ThinkPad T14s Gen 6 (OLED)"), compatible: Some("lenovo,thinkpad-t14s-oled"), }, DeviceTree { chid: guid_str("c012b92d-a6a6-57fa-ba06-4f3062d891d4"), name: Some("LENOVO ThinkPad T14s Gen 6 (OLED)"), compatible: Some("lenovo,thinkpad-t14s-oled"), }, DeviceTree { chid: guid_str("e78c4e7a-68c3-5b29-b2a0-dbd2785e28cd"), name: Some("LENOVO ThinkPad T14s Gen 6 (OLED)"), compatible: Some("lenovo,thinkpad-t14s-oled"), }, DeviceTree { chid: guid_str("19b622ef-27fe-5c2e-bc53-13a79b862c65"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("1d9f3ebb-96de-5dd6-8c88-38308b0c1c44"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("34e7fadd-9c7d-5f91-ba7f-cedb04d59b9a"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("498d60ae-9b1d-5b67-8abd-af571babfa94"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("513976f8-3f51-5b42-9ae0-931ce23c5f38"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("5180bc01-5d18-5870-b955-969da38b2647"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("578dd7d5-5871-5bd5-92a9-be07f1067b92"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("5c20e964-d530-5dd7-9efd-4aed9e73c3cb"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("74593764-b6b9-58e9-bedc-93ebbb1eb057"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("76032e78-67a8-5dab-8512-157bfcfb8f75"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("791ecd9d-1547-58e6-b72a-5ce417b729dd"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("82fa4a02-8c3c-55f9-b0c9-e8feb669fd3a"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("86a0d770-3ca1-57fa-ac05-413481c00a24"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("8c602147-5363-5374-859e-8b7fe2d4d3ce"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("8cfd85bb-0d77-59df-8546-264239be475e"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("a20ae3ec-49a1-5cb5-acb8-5d31c77b105a"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("a5a4e3c1-5922-5ed6-b78e-9f0ea873a988"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("a9b59fea-e841-508a-a245-3a2d8d2802de"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("ac09e50f-9b3b-53c0-9752-377c3a0baaa0"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("acbac5af-aa6a-5690-88f3-e910f04a7ead"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("c81fee2f-cf41-5d5a-8c7b-afd6585b1d81"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("d93b21c0-5ed9-5955-911a-5b15f114d786"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("dd83478e-e01b-5631-ae74-92ae275a9b4e"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("e5d83424-0ecb-5632-b7b1-500f04e82725"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("ed647f93-3075-598b-9d89-d0f30ec11707"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("f6cd4a9f-9632-516e-b748-65952f7380c5"), name: Some("LENOVO ThinkPad T14s Gen 6"), compatible: Some("lenovo,thinkpad-t14s-lcd"), }, DeviceTree { chid: guid_str("137a5f94-8fcf-5581-8ac6-70d50fdba4a6"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("1b6a0689-3f70-57e0-8bf3-39a8a74213e8"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("3a3ef092-d5f1-5d4d-acea-70b38ef56e53"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("4262e277-58d3-5ac4-9858-c0751ad06f5c"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("6d634332-21fc-57c8-bc6b-e0f800f69f95"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("80430e03-90f0-5355-84b2-28fb17367203"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("807fe49f-cfd2-537d-b635-47bec9e36baf"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("a6debedb-f954-5aa1-8260-4dc3b567c95f"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("c71e903b-4255-56cb-b961-a8f87b452cbe"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("d0fce8d6-a709-5bf0-8be0-6ac6ab44b8e0"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("f3a6ca3e-4791-5bb0-915e-0b31856ec19c"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("f54cd4e6-3666-5b56-abd3-a5f2df50c534"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("fa342b0a-9e22-541f-8e95-93106778f97d"), name: Some("ASUSTeK COMPUTER INC. ASUS Vivobook S 15"), compatible: Some("asus,vivobook-s15"), }, DeviceTree { chid: guid_str("91971b38-ae5d-5e14-9f44-7c0316710593"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-oled"), }, DeviceTree { chid: guid_str("f84ba711-7075-5c1b-a03c-57d2521a1ac2"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-oled"), }, DeviceTree { chid: guid_str("0bfddfaf-e393-5dfe-a805-39b8b1098c81"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("0c3f5e9c-eddb-5ba2-88ee-06ae0221a53d"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("1f2f1045-a811-5e42-b31e-b433e384fc79"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("20b8b77d-e450-550b-b1ff-55d3317f59a6"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("24652d54-00f4-59ae-96fb-f7adbfa4a939"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("2d610a5e-ef69-5e60-b15e-7786d0ebd79e"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("3884ad58-4d63-589a-be98-b8ab1ddf3b93"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("5c9fc73f-f915-52bf-a82d-9c7fe2274ecc"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("6f892377-a51e-5f99-a363-b79f28fc55f9"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("b307ab54-c79d-58ca-a3b2-d1b1e325bfc3"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("c41d2cda-fda7-522c-b1a7-4a835c15c43d"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("cedbcc19-3a5a-5bae-9973-f8e158188de7"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("f0bb1cd4-995a-5c90-946b-9bb958f35f42"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407ra"), }, DeviceTree { chid: guid_str("2405af0b-d21d-5196-a228-4acffe7b3a10"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e80100-crd"), }, DeviceTree { chid: guid_str("339fc6d2-e0f4-5226-9dd9-62c4dc41881d"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e80100-crd"), }, DeviceTree { chid: guid_str("361b3d63-be90-52c2-8798-a05fbd68b773"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e80100-crd"), }, DeviceTree { chid: guid_str("4bb05d50-6c4f-525d-a9ec-8924afd6edea"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e80100-crd"), }, DeviceTree { chid: guid_str("7faef667-9eb2-53f4-9764-26fe0e92fbff"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e80100-crd"), }, DeviceTree { chid: guid_str("8fa88c58-23eb-5aea-9ea7-c4a98ded7352"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e80100-crd"), }, DeviceTree { chid: guid_str("b6d4eee8-30f3-564a-8246-e83935cf8dbb"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e80100-crd"), }, DeviceTree { chid: guid_str("d52e3fb6-202c-5cfa-a27c-e3ffe15339fb"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e80100-crd"), }, DeviceTree { chid: guid_str("e73870a5-90e8-528d-93fd-3da59f78df18"), name: Some("Qualcomm SCP_HAMOA"), compatible: Some("qcom,x1e80100-crd"), }, DeviceTree { chid: guid_str("07c6477a-7ef7-56c7-91d9-73d23295b0c0"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("07c6bbd9-caf8-5025-84d8-4efdb790f663"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("0d9ce3bc-620c-5209-9e82-7382cb6cffcd"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("4689ccaf-4f31-5146-887f-ca965da0f28a"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("8548ce7c-fdf3-55d0-95ba-606ca8db50da"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("90117b25-1646-515b-bfeb-286e74f2a1e8"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("a66b1244-0027-5451-a96a-dfcfc42ab892"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("bea2e67a-b660-5044-8acd-0d28e8c2e974"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("c1190be1-8ed5-50f1-9097-2a73ad9c4eb1"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("e4c9fe83-73ba-5160-bc18-57d4a98e960d"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("ef84110e-bd09-5f0f-a3dd-7995b4a3a706"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("efc06900-f603-5944-88e5-4de722816f91"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("ff394805-0b5f-52f6-9e1d-afb1d2bee411"), name: Some("Dell Inc. Inspiron"), compatible: Some("dell,inspiron-14-plus-7441"), }, DeviceTree { chid: guid_str("2b9277cd-85b1-51ee-9a38-d477632532da"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("4f73f73b-e639-5353-bbf7-d851e48f18fc"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("59e5c810-9e60-5a89-8665-db36c56b34d6"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("683e4579-8440-5bc1-89ac-dfcd7c25b307"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("68822228-a3e0-5b12-942d-9408751405d1"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("6e01222b-b2aa-531e-b95f-0e4b2a063364"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("903e3a6f-e14b-5643-9d55-244f917aadb6"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("93055898-8c85-50e7-adde-8115f194579a"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("b3e5b59d-84ae-597d-9222-8a4d48480bc3"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("fb7493ec-9634-5c5a-9f26-69cbf9b92460"), name: Some("Dell Inc. Latitude"), compatible: Some("dell,latitude-7455"), }, DeviceTree { chid: guid_str("1d1baf60-e2f3-5821-9d98-19a131bf8d93"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("1eb87d70-2f37-5f18-85de-30e46c17d540"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("36e8dd88-512d-5a74-86a4-039333f9e15a"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("3b9a1d76-f2e8-52e8-84de-14c5942b3d41"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("3c2649a7-2275-5130-a0c4-cc5f9809a2c1"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("7c7c2920-cb59-56ad-bc8a-939e803b0192"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("81972cb8-6fc7-5e08-b140-b0063ed4fefa"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("940c6349-f0a5-54ba-8deb-10e709e0b76c"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("bc685cec-e979-5cb9-bf02-e15586c7cb4b"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("e656b5f2-69c3-55da-bf22-4dd58d5f6d4f"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("eedeb5d9-1a0e-56e6-9137-eb6a723e58d1"), name: Some("Dell Inc. XPS"), compatible: Some("dell,xps13-9345"), }, DeviceTree { chid: guid_str("07be634a-0442-51fb-8a77-ecb370b5262b"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("25f49237-b3b4-58b2-9e58-6cc379781901"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("5275e89b-e839-589e-9e90-e1bd6854255b"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("5473ba61-2807-585b-b2ac-f0366d84bdc0"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("72a81f9e-c30b-5bf0-8449-948f8e593e92"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("7bfc4a0e-15c1-58b3-b27b-4e5f60d4397e"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("829d699c-f082-5835-967a-8e7022cb20b5"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("9145c311-f1b1-5f0f-902d-f6828baf8c46"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("a3c9ef57-67ab-5f75-a4cb-48cb7475b025"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("b7f376e9-f5f8-5718-b00e-6bd7c265aeab"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("ba2ddd3d-a06b-5b1f-9b2a-ce58f748486c"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("e4944bcc-a1c3-540e-b400-cd91953b7ba9"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("ec4cdb9c-e6ff-581c-ac22-d597b5e880a2"), name: Some("HP 103C_5336AN HP EliteBook Ultra"), compatible: Some("hp,elitebook-ultra-g1q"), }, DeviceTree { chid: guid_str("045dfd0f-068b-5e57-86bd-f41b4b906006"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("1a192aee-2cfd-5ab5-95f9-8093218a48ef"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("54500b82-f7ae-592d-ae68-8c8e362a1475"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("68d24be5-01b6-5d88-83fb-df2bcfa879aa"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("6a4511bc-0a3b-5b10-9c8b-dbcb834ecd83"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("811126e6-4aee-5f9e-827d-d0f12f6a6f00"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("848aeb1d-302b-5b6b-9109-0f4632535915"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("abb2ffec-2acd-5750-8dfd-c3845fd4bf2a"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("ca5dab4f-a301-53c6-b753-c2db56172e0a"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("eaab52c6-ed22-5e1b-b788-fc5a0531291d"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14"), }, DeviceTree { chid: guid_str("0700776d-0de7-5ea7-b9bf-77e0454d35e1"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("3fb1e5ba-05cd-5153-ad64-1d8bc6dc7a1b"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("63429d43-c970-570d-aaa7-54300924e0c5"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("6d53c38f-6adb-578b-a418-2abda4d8485d"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("8073dbed-501f-5f5e-a619-4cdd9c00e865"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("8477f828-512b-56cf-af55-c711a6831551"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("d27cf20e-e185-578e-bd46-f4cc3a718bb2"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("d99f6cb2-4a96-5e4a-8e29-19d52dfc2870"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("ee39b629-4187-5ff7-84c0-e354555562cd"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("f7f92b85-ff01-5e93-a453-c7f91029aa55"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("fdb12a4f-1e8b-524e-97b5-feef23a8a8da"), name: Some("LENOVO Yoga Slim 7 14Q8X9"), compatible: Some("lenovo,yoga-slim7x"), }, DeviceTree { chid: guid_str("01bf1e61-d2e0-518b-bb46-eb4d1f2b1af1"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("06128fee-87dc-50f6-8a3f-97cd9a6d8bf6"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("14b96570-4bc4-541a-9aef-1b7e2b61d7cd"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("16a47337-1f8b-5bd3-b3bd-8e50b31cb1c9"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("48b86a5e-1955-5799-9577-150f9e1a69e4"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("584a5084-15f2-5d20-917b-57f299e61f7e"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("5a384f15-464d-5da8-9311-a2c021759afc"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("66f9d954-5c66-5577-b3e4-e3f14f87d2ff"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("7cef06f5-e7e6-56d7-b123-a6d640a5d302"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("84b2e1d1-e695-5f41-8c41-cf1f059c616a"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("95971fb3-d478-591f-9ea3-eb0af0d1dfb5"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("aca467c0-5fc2-59ad-8ed5-1b7a0988d11c"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("c9c14db9-2b61-597a-a4ba-84397fe75f63"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,denali"), }, DeviceTree { chid: guid_str("11696377-327d-5ad1-b01d-02a7dbb9b99a"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("224ba2ff-14c1-5b33-ac10-079ccc217be2"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("3c329240-a447-5ec5-b79b-d1149420ac62"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("4ecd5e53-42ea-51a3-9602-aecdfee5c09d"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("53368ca9-12d5-5ee1-820b-ce979fa2cb0b"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("786c71b6-f60e-51c7-9ddc-f2999b75a3c5"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("892e90c9-31e3-5131-a217-a02632dba5e9"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("924900a0-9be2-53ca-90d7-b0e38827f5c5"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("95c06fde-19b0-55dc-9ca6-55403bae23f5"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("c735618b-d526-5f71-9651-8d149340d620"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("cb196e28-20bc-5e78-93f1-0ac41726bcf8"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("f0d12ad9-f530-5b56-96d8-897dd704059e"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("fdfca0f3-41b6-5872-a2ea-53539fd5160c"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus13"), }, DeviceTree { chid: guid_str("109cd8d8-6086-50b6-9c2d-d0aca0f418da"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("224ba2ff-14c1-5b33-ac10-079ccc217be2"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("27ec66e4-3f81-5c06-997e-e1ea0a98b8a1"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("3c329240-a447-5ec5-b79b-d1149420ac62"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("892e90c9-31e3-5131-a217-a02632dba5e9"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("90482ef5-831d-5069-8d40-92d339a75c77"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("924900a0-9be2-53ca-90d7-b0e38827f5c5"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("c735618b-d526-5f71-9651-8d149340d620"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("e1fbd53f-3738-5fa6-aa7b-5ae319663d6b"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("e4cef54f-d5b2-56b1-8aa0-07b48c3deedf"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("e56cd9fa-d992-5947-9f80-82345827e8e6"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("ebce3085-12c1-58f3-9456-ccdf741a1538"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("f91b1a95-926c-5fd7-9826-4a101e142f97"), name: Some("Microsoft Corporation Surface"), compatible: Some("microsoft,romulus15"), }, DeviceTree { chid: guid_str("00bc5418-646d-5bab-b772-4efb06f4e7f1"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("0b8b84da-462b-5620-bdb5-70272e0ddd94"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("14643426-35fa-5a20-bc31-3b6095d2b451"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("24652d54-00f4-59ae-96fb-f7adbfa4a939"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("3ca4e2d9-50df-51a5-a87f-4636d425e97d"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("59793319-4344-5755-9194-17f29f030d5d"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("7e6d3df4-bf5f-59ab-ad7b-e00677c0ae5a"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("85f50d27-f4cb-54df-9aae-f6f09700b132"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("8a72a2ea-3971-55e3-b982-cb6b82868f0e"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("a034eff6-2891-5de0-b0db-9c5ff350b968"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("a5b5becc-2a55-5017-b159-087f3846da26"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("a8425d85-573a-56f8-9d9d-98a196d712fa"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("c6d100b1-9de7-5636-a3cc-f28fa46fb926"), name: Some("ASUSTeK COMPUTER INC. ASUS Zenbook A14"), compatible: Some("asus,zenbook-a14-ux3407qa-lcd"), }, DeviceTree { chid: guid_str("1d8361a7-1b3a-5915-8a35-03a3c1cf9c2e"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("271cca67-bd9e-5dd6-8e5f-b5f6b969da97"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("29a43fda-41e4-5db5-b6d3-012d0674d84f"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("38e7030f-993f-5bda-9ce8-ae13a13d7b5a"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("3fdb269e-c359-5004-b4e3-8541ef3580c9"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("5120f011-8f7e-5ca5-9143-de545e288712"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("612e268b-1233-5af6-b478-5596d3573d35"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("6fe7a469-b01a-5530-9a34-2dd089e0e006"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("9c3e4a5b-8fa2-5045-9c4f-441307fa3b08"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("d4db0558-de1b-562b-bc23-3e0caadd4c94"), name: Some("HP 103C_5335M8 HP OmniBook X"), compatible: Some("hp,omnibook-x14-fe1"), }, DeviceTree { chid: guid_str("058c0739-1843-5a10-bab7-fae8aaf30add"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("100917f4-9c0a-5ac3-a297-794222da9bc9"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("20c2cf2f-231c-5d02-ae9b-c837ab5653ed"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("27d2dba8-e6f1-5c19-ba1c-c25a4744c161"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("331d7526-8b88-5923-bf98-450cf3ea82a4"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("3f49141c-d8fb-5a6f-8b4a-074a2397874d"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("676172cd-d185-53ed-aac6-245d0caa02c4"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("6a12c9bc-bcfa-5448-9f66-4159dbe8c326"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("7c107a7f-2d77-51aa-aef8-8d777e26ffbc"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("98ad068a-f812-5f13-920c-3ff3d34d263f"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("ee8fa049-e5f4-51e4-89d8-89a0140b8f38"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("f2ea7095-999d-5e5b-8f2a-4b636a1e399f"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, DeviceTree { chid: guid_str("f55122fb-303f-58bc-b342-6ef653956d1d"), name: Some("Acer Swift 14 AI"), compatible: Some("acer,swift-sf14-11"), }, ]; assert_eq!(r, e); } #[test] fn test_serialize_single() { let mut actual = Vec::new(); serialize_chid_mappings( &mut actual, &[ChidMapping::DeviceTree { chid: Guid::default(), name: Some("MyDevice"), compatible: Some("my,compatible"), }], ) .unwrap(); let mut expected = Vec::new(); push_mapping( &mut expected, ChidMappingHeader { descriptor: 0x1000_001c, chid: Guid::default(), }, ChidMappingDeviceTree { name_offset: 56, compatible_offset: 65, } .as_bytes(), ); // type 1, length 28 push_mapping(&mut expected, ChidMappingHeader::default(), &[0u8; 8]); // terminator (long, ukify compatible) push_strings(&mut expected, &["MyDevice", "my,compatible"]); assert_eq!(actual, expected); } #[test] fn test_serialize_multiple() { let mut actual = Vec::new(); serialize_chid_mappings( &mut actual, &[ ChidMapping::DeviceTree { chid: Guid::default(), name: Some("MyDevice"), compatible: Some("my,compatible"), }, ChidMapping::Unknown { kind: 5, chid: Guid::default(), body: &[0x42u8; 180], }, ChidMapping::UefiFw { chid: Guid::read_from_bytes(&[1u8; 16]).unwrap(), name: Some("MyFirmware"), fwid: Some("FWID1234"), }, ], ) .unwrap(); let mut expected = Vec::new(); push_mapping( &mut expected, ChidMappingHeader { descriptor: 0x1000_001c, chid: Guid::default(), }, ChidMappingDeviceTree { name_offset: 284, compatible_offset: 293, } .as_bytes(), ); // type 1, length 28 push_mapping( &mut expected, ChidMappingHeader { descriptor: 0x5000_00c8, chid: Guid::default(), }, &[0x42u8; 180], ); // unknown type 5, length 200, skipped push_mapping( &mut expected, ChidMappingHeader { descriptor: 0x2000_001c, chid: Guid::read_from_bytes(&[1u8; 16]).unwrap(), }, ChidMappingUefiFw { name_offset: 307, fwid_offset: 318, } .as_bytes(), ); // type 2, length 28 push_mapping(&mut expected, ChidMappingHeader::default(), &[0u8; 8]); // terminator (long, ukify compatible) push_strings( &mut expected, &["MyDevice", "my,compatible", "MyFirmware", "FWID1234"], ); assert_eq!(actual, expected); } } lace-0.1.0/lace-util/src/chid_matcher.rs000066400000000000000000000147321514263214500200540ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri //! CHID to mapping matcher use crate::Guid; use crate::chid::{CHID_TYPES, ChidSources, compute_chid}; use crate::chid_mapping::ChidMapping; /// CHID types used for matching mapping (most specific to least specific) const CHID_TYPE_MATCHING_PRIORITY: [usize; 11] = [17, 16, 15, 3, 6, 8, 10, 4, 5, 7, 9]; /// Iterator that matches CHID mappings against available CHID sources according to priority pub struct ChidMatcher<'mappings, 'mapping_str, 'srcs> { mappings: &'mappings [ChidMapping<'mapping_str>], srcs: &'srcs ChidSources, mappings_idx: usize, type_priority_idx: usize, current_chid: Option, } impl ChidMatcher<'_, '_, '_> { /// Create a new CHID mapping matcher pub fn new<'mappings, 'mapping_str, 'srcs>( mappings: &'mappings [ChidMapping<'mapping_str>], srcs: &'srcs ChidSources, ) -> ChidMatcher<'mappings, 'mapping_str, 'srcs> { ChidMatcher { mappings, srcs, mappings_idx: 0, type_priority_idx: 0, current_chid: None, } } } impl<'mappings, 'mapping_str, 'srcs> core::iter::Iterator for ChidMatcher<'mappings, 'mapping_str, 'srcs> { type Item = &'mappings ChidMapping<'mapping_str>; fn next(&mut self) -> Option { loop { let Some(current_chid) = &self.current_chid else { // No more types to try if self.type_priority_idx >= CHID_TYPE_MATCHING_PRIORITY.len() { return None; } // Compute CHID for the next type self.current_chid = compute_chid( self.srcs, CHID_TYPES[CHID_TYPE_MATCHING_PRIORITY[self.type_priority_idx]], ); self.type_priority_idx += 1; continue; }; while self.mappings_idx < self.mappings.len() { let mapping = &self.mappings[self.mappings_idx]; self.mappings_idx += 1; if mapping.chid() == current_chid { return Some(mapping); } } // Reset for next type self.mappings_idx = 0; self.current_chid = None; } } } #[cfg(test)] mod test { use super::*; use crate::guid_str; #[test] fn test_empty() { let mappings: [ChidMapping; 0] = []; let srcs = ChidSources::default(); let mut matcher = ChidMatcher::new(&mappings, &srcs); assert!(matcher.next().is_none()); } #[test] fn test_no_match() { let mappings = [ChidMapping::DeviceTree { chid: guid_str("00000000-0000-0000-0000-000000000000"), name: Some("Example Device"), compatible: Some("example,device"), }]; let srcs: ChidSources = [ Some("LENOVO".into()), // CHID_SMBIOS_MANUFACTURER Some("Miix 630".into()), // CHID_SMBIOS_FAMILY Some("81F1".into()), // CHID_SMBIOS_PRODUCT_NAME Some("LENOVO_MT_81F1_BU_idea_FM_Miix 630".into()), // CHID_SMBIOS_PRODUCT_SKU Some("LENOVO".into()), // CHID_SMBIOS_BASEBOARD_MANUFACTURER Some("LNVNB161216".into()), // CHID_SMBIOS_BASEBOARD_PRODUCT Some("LENOVO".into()), // CHID_SMBIOS_BIOS_VENDOR Some("8WCN25WW".into()), // CHID_SMBIOS_BIOS_VERSION None, // CHID_SMBIOS_BIOS_MAJOR None, // CHID_SMBIOS_BIOS_MINOR Some("32".into()), // CHID_SMBIOS_ENCLOSURE_TYPE None, // CHID_EDID_PANEL ]; let mut matcher = ChidMatcher::new(&mappings, &srcs); assert!(matcher.next().is_none()); } #[test] fn test_some_match() { let mappings = [ ChidMapping::DeviceTree { chid: guid_str("08b75d1f-6643-52a1-9bdd-071052860b33"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, ChidMapping::DeviceTree { chid: guid_str("00000000-0000-0000-0000-000000000000"), name: Some("Example Device"), compatible: Some("example,device"), }, ChidMapping::DeviceTree { chid: guid_str("14f581d2-d059-5cb2-9f8b-56d8be7932c9"), name: Some("LENOVO Miix 630"), compatible: Some("lenovo,miix-630"), }, ]; let srcs: ChidSources = [ Some("LENOVO".into()), // CHID_SMBIOS_MANUFACTURER Some("Miix 630".into()), // CHID_SMBIOS_FAMILY Some("81F1".into()), // CHID_SMBIOS_PRODUCT_NAME Some("LENOVO_MT_81F1_BU_idea_FM_Miix 630".into()), // CHID_SMBIOS_PRODUCT_SKU Some("LENOVO".into()), // CHID_SMBIOS_BASEBOARD_MANUFACTURER Some("LNVNB161216".into()), // CHID_SMBIOS_BASEBOARD_PRODUCT Some("LENOVO".into()), // CHID_SMBIOS_BIOS_VENDOR Some("8WCN25WW".into()), // CHID_SMBIOS_BIOS_VERSION None, // CHID_SMBIOS_BIOS_MAJOR None, // CHID_SMBIOS_BIOS_MINOR Some("32".into()), // CHID_SMBIOS_ENCLOSURE_TYPE None, // CHID_EDID_PANEL ]; let mut matcher = ChidMatcher::new(&mappings, &srcs); assert!(matches!( matcher.next(), Some(ChidMapping::DeviceTree { compatible: Some("lenovo,miix-630"), .. }) )); assert!(matches!( matcher.next(), Some(ChidMapping::DeviceTree { compatible: Some("lenovo,miix-630"), .. }) )); assert!(matcher.next().is_none()); } } lace-0.1.0/lace-util/src/edid.rs000066400000000000000000000112711514263214500163420ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri use alloc::string::String; use core::fmt::{self, Display, Formatter}; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; const EDID_PATTERN: [u8; 8] = [0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00]; const HEXCHARS_LOWER: &[u8; 16] = b"0123456789abcdef"; /// Header of an EDID #[repr(C)] #[derive(Clone, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] struct EdidHeader { pattern: [u8; 8], manufacturer_id: u16, // big-endian manufacturer_product_code: u16, // little-endian serial_number: u32, // little-endian week_of_manufacture: u8, year_of_manufacture: u8, edid_version: u8, edid_revision: u8, } /// Represents a parsed EDID structure #[derive(Debug, Clone)] pub struct ParsedEdid { header: EdidHeader, } #[derive(Debug, Clone, Copy)] pub enum EdidParseError { InvalidSize, InvalidHeader, InvalidPanelId, } impl Display for EdidParseError { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { EdidParseError::InvalidSize => write!(f, "EDID data is too small"), EdidParseError::InvalidHeader => write!(f, "EDID header is invalid"), EdidParseError::InvalidPanelId => write!(f, "Panel ID could not be found"), } } } impl ParsedEdid { pub fn parse(edid_data: &[u8]) -> Result { // Spec says this is the minimum size if edid_data.len() < 128 { return Err(EdidParseError::InvalidSize); } // Parse header and validate magic pattern let Ok((mut header, _)) = EdidHeader::read_from_prefix(edid_data) else { return Err(EdidParseError::InvalidSize); }; if header.pattern != EDID_PATTERN { return Err(EdidParseError::InvalidHeader); } // Convert fields to host endianness header.manufacturer_id = u16::from_be(header.manufacturer_id); header.manufacturer_product_code = u16::from_le(header.manufacturer_product_code); header.serial_number = u32::from_le(header.serial_number); // Return parsed EDID Ok(ParsedEdid { header }) } pub fn panel_id(&self) -> Result { fn mfr_letter(val: u16) -> Result { if (1..=26).contains(&val) { Ok(b'A' + (val as u8 - 1)) } else { Err(EdidParseError::InvalidPanelId) } } let mut s = String::new(); s.push(mfr_letter((self.header.manufacturer_id >> 10) & 0x1F)? as char); s.push(mfr_letter((self.header.manufacturer_id >> 5) & 0x1F)? as char); s.push(mfr_letter(self.header.manufacturer_id & 0x1F)? as char); s.push( HEXCHARS_LOWER[((self.header.manufacturer_product_code >> 12) & 0xF) as usize] as char, ); s.push( HEXCHARS_LOWER[((self.header.manufacturer_product_code >> 8) & 0xF) as usize] as char, ); s.push( HEXCHARS_LOWER[((self.header.manufacturer_product_code >> 4) & 0xF) as usize] as char, ); s.push(HEXCHARS_LOWER[(self.header.manufacturer_product_code & 0xF) as usize] as char); Ok(s) } } #[cfg(test)] mod test { use super::*; #[test] fn test_parse_valid_edid() { let mut edid_data: [u8; 128] = [0; 128]; edid_data[0..20].copy_from_slice(&[ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, // pattern 0x30, 0x64, // mfr id 0xab, 0x89, // product code 0x78, 0x56, 0x34, 0x12, // serial number 0x1a, 0x1b, // week and year 0x01, 0x03, // version ]); let parsed = ParsedEdid::parse(&edid_data).expect("Failed to parse valid EDID"); let panel_id = parsed.panel_id().expect("Failed to get panel ID"); assert_eq!(panel_id, "LCD89ab"); assert_eq!(parsed.header.serial_number, 0x12345678); assert_eq!(parsed.header.week_of_manufacture, 0x1a); assert_eq!(parsed.header.year_of_manufacture, 0x1b); assert_eq!(parsed.header.edid_version, 0x01); assert_eq!(parsed.header.edid_revision, 0x03); } #[test] fn test_parse_invalid_size() { let edid_data: [u8; 100] = [0; 100]; let result = ParsedEdid::parse(&edid_data); assert!(matches!(result, Err(EdidParseError::InvalidSize))); } #[test] fn test_parse_invalid_header() { let edid_data: [u8; 128] = [0; 128]; let result = ParsedEdid::parse(&edid_data); assert!(matches!(result, Err(EdidParseError::InvalidHeader))); } } lace-0.1.0/lace-util/src/lib.rs000066400000000000000000000142411514263214500162030ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri #![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; pub mod chid; pub mod chid_mapping; pub mod chid_matcher; pub mod edid; pub mod peimage; pub mod sha1; pub mod smbios; pub mod units; use core::cmp::Ordering; use core::fmt::{self, Debug, Display, Write}; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; pub use fdt; pub fn find_byte_sequence(s: &[u8], sub: &[u8]) -> Option { if s.len() < sub.len() { return None; } (0..s.len() - sub.len() + 1).find(|&i| &s[i..i + sub.len()] == sub) } pub fn hexdump(mut w: W, s: &[u8]) -> fmt::Result { for (i, b) in s.iter().enumerate() { if i % 16 == 0 { write!(w, "{:04x} ", i)?; } write!(w, "{:02x}", b)?; if (i + 1) % 16 == 0 || i + 1 == s.len() { writeln!(w)?; } else if (i + 1) % 8 == 0 { write!(w, " ")?; } else { write!(w, " ")?; } } Ok(()) } #[macro_export] macro_rules! align_up { ($val:expr, $bound:expr $(,)?) => {{ let _bound = $bound; $val.div_ceil(_bound) * _bound }}; } #[macro_export] macro_rules! align_down { ($val:expr, $bound:expr $(,)?) => {{ let _bound = $bound; $val / _bound * _bound }}; } #[macro_export] macro_rules! count_blocks_aligned_up { ($val:expr, $block_size:expr $(,)?) => { $val.div_ceil($block_size) }; } #[macro_export] macro_rules! count_blocks_aligned_down { ($val:expr, $block_size:expr $(,)?) => { $val / $block_size }; } #[repr(C)] #[derive( Clone, Copy, Default, PartialEq, Eq, Hash, FromBytes, IntoBytes, Immutable, KnownLayout, )] pub struct Guid { pub data1: u32, pub data2: u16, pub data3: u16, pub data4: [u8; 8], } #[derive(Debug, Clone, Copy, Default)] pub struct GuidParseError; impl Display for GuidParseError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "invalid GUID format") } } impl Guid { /// Parse a GUID string in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" /// Accepts both lowercase and uppercase hex digits. /// Returns `None` if the string is not a valid GUID. pub const fn try_from_str(s: &str) -> Result { let bytes = s.as_bytes(); if bytes.len() != 36 { return Err(GuidParseError); // String must be 36 characters long } if bytes[8] != b'-' || bytes[13] != b'-' || bytes[18] != b'-' || bytes[23] != b'-' { return Err(GuidParseError); // Dashes at the wrong positions } match ( hex_seq(bytes, 0, 8), hex_seq(bytes, 9, 13), hex_seq(bytes, 14, 18), hex_seq(bytes, 19, 21), hex_seq(bytes, 21, 23), hex_seq(bytes, 24, 26), hex_seq(bytes, 26, 28), hex_seq(bytes, 28, 30), hex_seq(bytes, 30, 32), hex_seq(bytes, 32, 34), hex_seq(bytes, 34, 36), ) { ( Some(data1), Some(data2), Some(data3), Some(d4_0), Some(d4_1), Some(d4_2), Some(d4_3), Some(d4_4), Some(d4_5), Some(d4_6), Some(d4_7), ) => Ok(Guid { data1: data1 as u32, data2: data2 as u16, data3: data3 as u16, data4: [ d4_0 as u8, d4_1 as u8, d4_2 as u8, d4_3 as u8, d4_4 as u8, d4_5 as u8, d4_6 as u8, d4_7 as u8, ], }), _ => Err(GuidParseError), } } } impl TryFrom<&str> for Guid { type Error = GuidParseError; fn try_from(s: &str) -> Result { Self::try_from_str(s) } } /// Parse a sequence of hexadecimal digits from `bytes[begin..end]` into a `u64`. /// Returns `None` if the range is invalid or contains non-hex characters. const fn hex_seq(bytes: &[u8], begin: usize, end: usize) -> Option { if begin >= end || end > bytes.len() { return None; } let mut value = 0u64; let mut i = begin; while i < end { let digit = match bytes[i] { b'0'..=b'9' => bytes[i] - b'0', b'a'..=b'f' => bytes[i] - b'a' + 10, b'A'..=b'F' => bytes[i] - b'A' + 10, _ => return None, }; value = (value << 4) | digit as u64; i += 1; } Some(value) } impl Debug for Guid { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "guid_str(\"{:08x}-{:04x}-{:04x}-{:02x}{:02x}-{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}\")", self.data1, self.data2, self.data3, self.data4[0], self.data4[1], self.data4[2], self.data4[3], self.data4[4], self.data4[5], self.data4[6], self.data4[7] )?; Ok(()) } } impl Display for Guid { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{:08x}-{:04x}-{:04x}-{:02x}{:02x}-{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}", self.data1, self.data2, self.data3, self.data4[0], self.data4[1], self.data4[2], self.data4[3], self.data4[4], self.data4[5], self.data4[6], self.data4[7] )?; Ok(()) } } /// Convert a GUID literal to a `Guid` at compile time. /// Panics if the string is not a valid GUID. pub const fn guid_str(s: &str) -> Guid { match Guid::try_from_str(s) { Ok(guid) => guid, Err(_) => panic!("invalid GUID literal"), } } /// Compare two version numbers in "major.minor" format. pub fn cmp_maj_min(maj_a: u8, min_a: u8, maj_b: u8, min_b: u8) -> Ordering { match maj_a.cmp(&maj_b) { Ordering::Equal => min_a.cmp(&min_b), ord => ord, } } lace-0.1.0/lace-util/src/peimage.rs000066400000000000000000000267731514263214500170610ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri use crate::align_up; use core::{fmt::Display, mem::offset_of}; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; pub const DOS_SIGNATURE: u16 = b'M' as u16 | (b'Z' as u16) << 8; pub const NT_SIGNATURE: u32 = b'P' as u32 | (b'E' as u32) << 8; #[repr(C)] #[derive(Clone, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct DosHeader { pub e_magic: u16, pub e_cblp: u16, pub e_cp: u16, pub e_crlc: u16, pub e_cparhdr: u16, pub e_minalloc: u16, pub e_maxalloc: u16, pub e_ss: u16, pub e_sp: u16, pub e_csum: u16, pub e_ip: u16, pub e_cs: u16, pub e_lfarlc: u16, pub e_ovno: u16, pub e_res: [u16; 4], pub e_oemid: u16, pub e_oeminfo: u16, pub e_res2: [u16; 10], pub e_lfanew: u32, } #[repr(C)] #[derive(Clone, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct FileHeader { pub machine: u16, pub number_of_sections: u16, pub time_date_stamp: u32, pub pointer_to_symbol_table: u32, pub number_of_symbols: u32, pub size_of_optional_header: u16, pub characteristics: u16, } #[repr(C)] #[derive(Clone, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct DataDirectory { pub virtual_address: u32, pub size: u32, } pub const DIRECTORY_ENTRY_EXPORT: usize = 0; pub const DIRECTORY_ENTRY_IMPORT: usize = 1; pub const DIRECTORY_ENTRY_RESOURCE: usize = 2; pub const DIRECTORY_ENTRY_EXCEPTION: usize = 3; pub const DIRECTORY_ENTRY_SECURITY: usize = 4; pub const DIRECTORY_ENTRY_BASERELOC: usize = 5; pub const DIRECTORY_ENTRY_DEBUG: usize = 6; pub const DIRECTORY_ENTRY_COPYRIGHT: usize = 7; pub const DIRECTORY_ENTRY_GLOBALPTR: usize = 8; pub const DIRECTORY_ENTRY_TLS: usize = 9; pub const DIRECTORY_ENTRY_LOAD_CONFIG: usize = 10; pub const NUMBER_OF_DIRECTORY_ENTRIES: usize = 16; pub const NT_OPTIONAL_HDR64_MAGIC: u16 = 0x20b; #[repr(C)] #[derive(Clone, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct OptionalHeader64 { pub magic: u16, pub major_linker_version: u8, pub minor_linker_version: u8, pub size_of_code: u32, pub size_of_initialized_data: u32, pub size_of_uninitialized_data: u32, pub address_of_entry_point: u32, pub base_of_code: u32, pub image_base: u64, pub section_alignment: u32, pub file_alignment: u32, pub major_operating_system_version: u16, pub minor_operating_system_version: u16, pub major_image_version: u16, pub minor_image_version: u16, pub major_subsystem_version: u16, pub minor_subsystem_version: u16, pub win32_version_value: u32, pub size_of_image: u32, pub size_of_headers: u32, pub check_sum: u32, pub subsystem: u16, pub dll_characteristics: u16, pub size_of_stack_reserve: u64, pub size_of_stack_commit: u64, pub size_of_heap_reserve: u64, pub size_of_heap_commit: u64, pub loader_flags: u32, pub number_of_rva_and_sizes: u32, // This struct in reality has a flexible length array here, // the length is given by 'number_of_rva_and_sizes'. // We are not using it for now, so we omit it. // pub data_directory: [DataDirectory; NUMBER_OF_DIRECTORY_ENTRIES], } /// DLL Characteristics flags pub const DLLCHARACTERISTICS_NX_COMPAT: u16 = 0x0100; #[repr(C)] #[derive(Clone, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct NtHeaders64 { pub signature: u32, pub file_header: FileHeader, pub optional_header: OptionalHeader64, } #[repr(C)] #[derive(Clone, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct SectionHeader { pub name: [u8; 8], pub virtual_size: u32, pub virtual_address: u32, pub size_of_raw_data: u32, pub pointer_to_raw_data: u32, pub pointer_to_relocations: u32, pub pointer_to_linenumbers: u32, pub number_of_relocations: u16, pub number_of_linenumbers: u16, pub characteristics: u32, } pub const SCN_CNT_CODE: u32 = 0x00000020; pub const SCN_CNT_INITIALIZED_DATA: u32 = 0x00000040; pub const SCN_CNT_UNINITIALIZED_DATA: u32 = 0x00000080; pub const SCN_MEM_DISCARDABLE: u32 = 0x02000000; pub const SCN_MEM_NOT_CACHED: u32 = 0x04000000; pub const SCN_MEM_NOT_PAGED: u32 = 0x08000000; pub const SCN_MEM_SHARED: u32 = 0x10000000; pub const SCN_MEM_EXECUTE: u32 = 0x20000000; pub const SCN_MEM_READ: u32 = 0x40000000; pub const SCN_MEM_WRITE: u32 = 0x80000000; impl SectionHeader { pub fn name(&self) -> &[u8] { let mut end_i = 0; while end_i < self.name.len() && self.name[end_i] != 0 { end_i += 1; } &self.name[..end_i] } } #[derive(Clone, Debug)] pub struct PeRef<'a> { pub data: &'a [u8], pub dos_hdr: DosHeader, pub dos_data: &'a [u8], pub nt_hdrs: NtHeaders64, pub nt_data: &'a [u8], pub sect_hdrs: &'a [u8], } pub struct RawSectionIterator<'a> { pe: PeRef<'a>, index: usize, } pub struct VirtualSectionIterator<'a> { pe: PeRef<'a>, index: usize, } #[derive(Clone, Copy, Debug)] pub enum PeError { Truncated, BadHeader, RelocationsNotYetSupported, } impl Display for PeError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::Truncated => write!(f, "image truncated"), Self::BadHeader => write!(f, "image has bad header"), Self::RelocationsNotYetSupported => { write!(f, "image has relocations, which are not yet supported") } } } } pub fn parse_pe<'a>(s: &'a [u8]) -> Result, PeError> { // Get and validate the DOS header let (dos_hdr, dos_data) = DosHeader::read_from_prefix(s).map_err(|_| PeError::Truncated)?; if dos_hdr.e_magic != DOS_SIGNATURE { return Err(PeError::BadHeader); } // Get and validate the 64-bit NT headers let (nt_hdrs, nt_data) = s .get(dos_hdr.e_lfanew as usize..) .and_then(|s| NtHeaders64::read_from_prefix(s).ok()) .ok_or(PeError::Truncated)?; if nt_hdrs.signature != NT_SIGNATURE { return Err(PeError::BadHeader); } if (nt_hdrs.file_header.size_of_optional_header as usize) < size_of::() { return Err(PeError::Truncated); } if nt_hdrs.optional_header.magic != NT_OPTIONAL_HDR64_MAGIC { return Err(PeError::BadHeader); } // Get the section headers as a slice let sect_hdrs_start = (dos_hdr.e_lfanew as usize) .checked_add(offset_of!(NtHeaders64, optional_header)) .and_then(|x| x.checked_add(nt_hdrs.file_header.size_of_optional_header as usize)) .ok_or(PeError::Truncated)?; let sect_hdrs_end = (nt_hdrs.file_header.number_of_sections as usize) .checked_mul(size_of::()) .and_then(|size| sect_hdrs_start.checked_add(size)) .ok_or(PeError::Truncated)?; let sect_hdrs = s .get(sect_hdrs_start..sect_hdrs_end) .ok_or(PeError::Truncated)?; let dos_data = &dos_data[..dos_hdr.e_lfanew as usize - size_of::()]; let nt_data = &nt_data [..nt_hdrs.file_header.size_of_optional_header as usize - size_of::()]; Ok(PeRef { data: s, dos_hdr, dos_data, nt_hdrs, nt_data, sect_hdrs, }) } impl<'a> PeRef<'a> { pub fn num_sections(&self) -> usize { self.nt_hdrs.file_header.number_of_sections as usize } pub fn nth_section(&self, n: usize) -> Option { if n >= self.num_sections() { return None; } // NOTE: 'unwrap()' cannot actually panic here because self.sect_hdrs has size // exactly of `self.num_sections() * size_of::()`, and 'n' is // guaranteed to be less than 'self.num_sections()', so there is always enough of // data left to read a SectionHeader. let (shdr, _) = SectionHeader::read_from_prefix(&self.sect_hdrs[n * size_of::()..]) .unwrap(); Some(shdr) } pub fn virtual_sections(&self) -> VirtualSectionIterator<'a> { VirtualSectionIterator { pe: self.clone(), index: 0, } } pub fn raw_sections(&self) -> RawSectionIterator<'a> { RawSectionIterator { pe: self.clone(), index: 0, } } /// Relocates the PE image into the provided memory slice. /// The slice must be at least as large as the image size specified /// in the optional header. pub fn relocate_into(&self, pages: &mut [u8]) -> Result<(), PeError> { let opt_hdr = &self.nt_hdrs.optional_header; // Copy headers to the allocated memory let hdrs_src = self .data .get(..opt_hdr.size_of_headers as usize) .ok_or(PeError::Truncated)?; pages .get_mut(..opt_hdr.size_of_headers as usize) .ok_or(PeError::Truncated)? .copy_from_slice(hdrs_src); // Copy sections to the allocated memory for result in self.raw_sections() { let (shdr, data) = result?; if shdr.pointer_to_relocations != 0 { return Err(PeError::RelocationsNotYetSupported); } // Virtual size must be aligned to section alignment, the linker is not required to align this for us. let virt_size = align_up!( shdr.virtual_size, self.nt_hdrs.optional_header.section_alignment ) as usize; if data.len() > virt_size { return Err(PeError::Truncated); } let virt_start = shdr.virtual_address as usize; let virt_end = virt_start .checked_add(virt_size) .ok_or(PeError::Truncated)?; // Copy initialized data pages .get_mut(virt_start..virt_start + data.len()) .ok_or(PeError::Truncated)? .copy_from_slice(data); // Zero uninitialized data if data.len() < virt_size { pages .get_mut((virt_start + data.len())..virt_end) .ok_or(PeError::Truncated)? .fill(0); } } Ok(()) } } impl<'a> Iterator for RawSectionIterator<'a> { type Item = Result<(SectionHeader, &'a [u8]), PeError>; fn next(&mut self) -> Option { let shdr = self.pe.nth_section(self.index)?; self.index += 1; (shdr.pointer_to_raw_data as usize) .checked_add(shdr.size_of_raw_data as usize) .and_then(|end_of_raw_data| { self.pe .data .get(shdr.pointer_to_raw_data as usize..end_of_raw_data) .map(|data| Ok((shdr, data))) .or(Some(Err(PeError::Truncated))) }) } } impl<'a> Iterator for VirtualSectionIterator<'a> { type Item = Result<(SectionHeader, &'a [u8]), PeError>; fn next(&mut self) -> Option { let shdr = self.pe.nth_section(self.index)?; self.index += 1; (shdr.virtual_address as usize) .checked_add(shdr.virtual_size as usize) .and_then(|end_of_virtual_section| { self.pe .data .get(shdr.virtual_address as usize..end_of_virtual_section) .map(|data| Ok((shdr, data))) .or(Some(Err(PeError::Truncated))) }) } } lace-0.1.0/lace-util/src/sha1.rs000066400000000000000000000135741514263214500163010ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri const SHA1_STATE_CNT: usize = 5; const SHA1_BLOCK_SIZE: usize = 64; const SHA1_ITERS: usize = 80; /// Size of SHA1 digest in bytes pub const SHA1_DIGEST_SIZE: usize = 20; /// One shot SHA1 hash computation, for non-security purposes only. pub fn sha1(data: &[u8]) -> [u8; SHA1_DIGEST_SIZE] { let mut ctx = Sha1Ctx::new(); ctx.update(data); ctx.digest() } /// This is a SHA1 implementation for non-security purposes only. pub struct Sha1Ctx { state: [u32; SHA1_STATE_CNT], buffer: [u8; SHA1_BLOCK_SIZE], buffer_size: usize, total_size: usize, } impl Default for Sha1Ctx { fn default() -> Self { Self::new() } } impl Sha1Ctx { pub fn new() -> Self { Self { state: [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0], buffer: [0u8; SHA1_BLOCK_SIZE], buffer_size: 0, total_size: 0, } } pub fn update(&mut self, mut data: &[u8]) { while (self.buffer_size + data.len()) >= SHA1_BLOCK_SIZE { self.buffer[self.buffer_size..] .copy_from_slice(&data[..SHA1_BLOCK_SIZE - self.buffer_size]); data = &data[SHA1_BLOCK_SIZE - self.buffer_size..]; sha1_transform(&mut self.state, &self.buffer); self.buffer_size = 0; self.total_size += SHA1_BLOCK_SIZE; } if !data.is_empty() { self.buffer[self.buffer_size..self.buffer_size + data.len()].copy_from_slice(data); self.buffer_size += data.len(); } } pub fn digest(mut self) -> [u8; SHA1_DIGEST_SIZE] { assert!(self.buffer_size < SHA1_BLOCK_SIZE); self.buffer[self.buffer_size..].fill(0); self.buffer[self.buffer_size] = 0x80; if self.buffer_size >= SHA1_BLOCK_SIZE - 8 { sha1_transform(&mut self.state, &self.buffer); self.buffer.fill(0); } self.total_size += self.buffer_size; let bit_count = self.total_size * 8; self.buffer[SHA1_BLOCK_SIZE - 8..SHA1_BLOCK_SIZE] .copy_from_slice(bit_count.to_be_bytes().as_ref()); sha1_transform(&mut self.state, &self.buffer); let mut digest = [0u8; SHA1_DIGEST_SIZE]; for (i, chunk) in digest.chunks_mut(4).enumerate() { chunk.copy_from_slice(&self.state[i].to_be_bytes()); } digest } } fn sha1_transform(state: &mut [u32; SHA1_STATE_CNT], block: &[u8; SHA1_BLOCK_SIZE]) { let mut a = state[0]; let mut b = state[1]; let mut c = state[2]; let mut d = state[3]; let mut e = state[4]; let mut w: [u32; SHA1_ITERS] = [0u32; SHA1_ITERS]; for i in 0..SHA1_ITERS { if i < 16 { w[i] = u32::from_be_bytes(block[i * 4..(i + 1) * 4].try_into().unwrap()); } else { w[i] = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]).rotate_left(1); } let (f, k) = if i < 20 { ((b & c) ^ ((!b) & d), 0x5a827999u32) } else if i < 40 { (b ^ c ^ d, 0x6ed9eba1u32) } else if i < 60 { ((b & c) ^ (b & d) ^ (c & d), 0x8f1bbcdcu32) } else { (b ^ c ^ d, 0xca62c1d6u32) }; let t = a .rotate_left(5) .wrapping_add(f) .wrapping_add(e) .wrapping_add(k) .wrapping_add(w[i]); e = d; d = c; c = b.rotate_left(30); b = a; a = t; } state[0] = state[0].wrapping_add(a); state[1] = state[1].wrapping_add(b); state[2] = state[2].wrapping_add(c); state[3] = state[3].wrapping_add(d); state[4] = state[4].wrapping_add(e); } #[cfg(test)] mod test { use super::*; #[test] fn test_sha1_empty() { let digest = sha1(b""); let expected = [ 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90, 0xaf, 0xd8, 0x07, 0x09, ]; assert_eq!(digest, expected); } #[test] fn test_sha1_abc() { let digest = sha1(b"abc"); let expected = [ 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d, ]; assert_eq!(digest, expected); } #[test] fn test_sha1_long_pattern() { let data = b"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; let digest = sha1(data); let expected = [ 0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e, 0xba, 0xae, 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5, 0xe5, 0x46, 0x70, 0xf1, ]; assert_eq!(digest, expected); } #[test] fn test_sha1_quick_cog() { let digest = sha1(b"The quick brown fox jumps over the lazy cog"); let expected = [ 0xde, 0x9f, 0x2c, 0x7f, 0xd2, 0x5e, 0x1b, 0x3a, 0xfa, 0xd3, 0xe8, 0x5a, 0x0b, 0xd1, 0x7d, 0x9b, 0x10, 0x0d, 0xb4, 0xb3, ]; assert_eq!(digest, expected); } #[test] fn test_sha1_one_million_a() { let data = vec![b'a'; 1_000_000]; let digest = sha1(&data); let expected = [ 0x34, 0xaa, 0x97, 0x3c, 0xd4, 0xc4, 0xda, 0xa4, 0xf6, 0x1e, 0xeb, 0x2b, 0xdb, 0xad, 0x27, 0x31, 0x65, 0x34, 0x01, 0x6f, ]; assert_eq!(digest, expected); } #[test] fn test_sha1_incremental_update() { let mut ctx = Sha1Ctx::new(); ctx.update(b"The quick brown "); ctx.update(b"fox jumps over "); ctx.update(b"the lazy dog"); let digest = ctx.digest(); let expected = [ 0x2f, 0xd4, 0xe1, 0xc6, 0x7a, 0x2d, 0x28, 0xfc, 0xed, 0x84, 0x9e, 0xe1, 0xbb, 0x76, 0xe7, 0x39, 0x1b, 0x93, 0xeb, 0x12, ]; assert_eq!(digest, expected); } } lace-0.1.0/lace-util/src/smbios.rs000066400000000000000000000215151514263214500167330ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri use core::fmt::Display; use core::marker::PhantomData; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; #[repr(C, packed)] #[derive(Clone, Copy, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct SmbiosEntryPoint { pub anchor_string: [u8; 4], pub entry_point_structure_checksum: u8, pub entry_point_length: u8, pub major_version: u8, pub minor_version: u8, pub max_structure_size: u16, pub entry_point_revision: u8, pub formatted_area: [u8; 5], pub intermediate_anchor_string: [u8; 5], pub intermediate_checksum: u8, pub table_length: u16, pub table_address: u32, pub number_of_smbios_structures: u16, pub smbios_bcd_revision: u8, } #[repr(C, packed)] #[derive(Clone, Copy, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct Smbios3EntryPoint { pub anchor_string: [u8; 5], pub entry_point_structure_checksum: u8, pub entry_point_length: u8, pub major_version: u8, pub minor_version: u8, pub docrev: u8, pub entry_point_revision: u8, pub reserved: u8, pub table_maximum_size: u32, pub table_address: u64, } #[repr(C, packed)] #[derive(Clone, Copy, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct SmbiosHeader { pub type_: u8, pub length: u8, pub handle: [u8; 2], } #[repr(C, packed)] #[derive(Clone, Copy, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct SmbiosTableType0 { pub header: SmbiosHeader, pub vendor: u8, pub bios_version: u8, pub bios_segment: u16, pub bios_release_date: u8, pub bios_size: u8, pub bios_characteristics: u64, // Versions 2.1 to 2.3 might have 1 or 2 extension bytes // here, but we don't care about those. } #[repr(C, packed)] #[derive(Clone, Copy, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct SmbiosTableType0_24 { pub header: SmbiosHeader, pub vendor: u8, pub bios_version: u8, pub bios_segment: u16, pub bios_release_date: u8, pub bios_size: u8, pub bios_characteristics: u64, // Version 2.4 is defined to have exactly 2 extension bytes // and the exact list of fields below. pub bios_characteristics_ext: [u8; 2], pub bios_major_release: u8, pub bios_minor_release: u8, pub ec_fw_major_release: u8, pub ec_fw_minor_release: u8, pub ext_bios_rom_size: u16, } #[repr(C, packed)] #[derive(Clone, Copy, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct SmbiosTableType1 { pub header: SmbiosHeader, pub manufacturer: u8, pub product_name: u8, pub version: u8, pub serial_number: u8, pub uuid: crate::Guid, pub wake_up_type: u8, pub sku_number: u8, pub family: u8, } #[repr(C, packed)] #[derive(Clone, Copy, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct SmbiosTableType2 { pub header: SmbiosHeader, pub manufacturer: u8, pub product_name: u8, pub version: u8, pub serial_number: u8, } #[repr(C, packed)] #[derive(Clone, Copy, Debug, FromBytes, IntoBytes, Immutable, KnownLayout)] pub struct SmbiosTableType3 { pub header: SmbiosHeader, pub manufacturer: u8, pub type_: u8, pub version: u8, pub serial_number: u8, pub asset_tag_number: u8, } #[derive(Clone, Copy, Debug, Default)] pub struct SmbiosParseError; impl Display for SmbiosParseError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "Invalid SMBIOS table") } } pub struct SmbiosTable<'s, T: FromBytes + KnownLayout + Immutable> { table_type: PhantomData, table: &'s [u8], strings: &'s [u8], } impl<'s, T: FromBytes + KnownLayout + Immutable> SmbiosTable<'s, T> { pub fn table(&self) -> T { let (t, _) = T::read_from_prefix(self.table).unwrap(); t } pub fn get_string(&self, i: usize) -> Option<&'s [u8]> { if i < 1 { // String index is 1 based return None; } self.strings.split(|b| *b == 0).nth(i - 1) } } pub fn find_smbios_table_by_type<'s, T: FromBytes + KnownLayout + Immutable>( mut s: &'s [u8], type_: u8, ) -> Result>, SmbiosParseError> { loop { // Get table header let Ok((header, _)) = SmbiosHeader::read_from_prefix(s) else { return Err(SmbiosParseError); }; // Check if the size in the header covers the header if (header.length as usize) < core::mem::size_of::() { return Err(SmbiosParseError); } // Check if we really have as much data as specified let Some((table, rest)) = s.split_at_checked(header.length as usize) else { return Err(SmbiosParseError); }; // Find the end of the strings section let Some(end_of_strings) = crate::find_byte_sequence(rest, b"\0\0") else { return Err(SmbiosParseError); }; match header.type_ { 127 => { // End-of-tables indicator return Ok(None); } t if t == type_ => { // Matching type // Check if the size in the header covers the table if (header.length as usize) < core::mem::size_of::() { return Err(SmbiosParseError); } return Ok(Some(SmbiosTable { table_type: PhantomData, table, strings: &rest[..end_of_strings], })); } _ => { // Move to next table s = &rest[end_of_strings + 2..]; } } } } #[cfg(test)] mod test { use super::*; use core::mem::size_of; // Helper to append a table with the given type and payload length (header is 4 bytes) fn push_table(buf: &mut Vec, t: u8, len: usize, strings: &[u8]) { buf.push(t); // type buf.push(len as u8); // length buf.extend_from_slice(&[0x34, 0x12]); // handle (arbitrary) buf.resize(buf.len() - 4 + len, 0); // payload zeroed buf.extend_from_slice(strings); // strings including terminating \0\0 } #[test] fn test_find_smbios_table_by_type() { // Build a small SMBIOS stream: Type 0 table, then Type 1 table, then End (127) let mut buf: Vec = Vec::new(); // Type 0 with two strings: "VENDOR", "VER" push_table( &mut buf, 0, size_of::(), b"VENDOR\0VER\0\0", ); // Type 1 with two strings: "MFG", "PROD" push_table(&mut buf, 1, size_of::(), b"MFG\0PROD\0\0"); // End-of-table 127 push_table(&mut buf, 127, size_of::(), b"\0\0"); // Should find Type 1 successfully let tbl = find_smbios_table_by_type::(&buf, 1) .unwrap() .unwrap(); // Header type should be 1 and length should match struct size assert_eq!(tbl.table().header.type_, 1); assert_eq!( tbl.table().header.length as usize, size_of::() ); // First string (index 2 in our accessor) should be "MFG" assert_eq!(tbl.get_string(1), Some(&b"MFG"[..])); // Second string should be "PROD" assert_eq!(tbl.get_string(2), Some(&b"PROD"[..])); } #[test] fn test_type_not_found_returns_table_not_found() { let mut buf: Vec = Vec::new(); // Only a Type 0 then End (127) push_table(&mut buf, 0, size_of::(), b"VENDOR\0\0"); // End-of-table 127 push_table(&mut buf, 127, size_of::(), b"\0\0"); // Should not find Type 1 assert!( find_smbios_table_by_type::(&buf, 1) .unwrap() .is_none() ); } #[test] fn test_invalid_when_header_length_exceeds_buffer() { // Malformed: claims big length but buffer ends let buf = vec![ 1, 64, // type 1, length 64 (too big for following data) 0x00, 0x00, // handle // no payload, no strings ]; let res = find_smbios_table_by_type::(&buf, 1); assert!(matches!(res, Err(SmbiosParseError))); } #[test] fn test_invalid_when_missing_double_zero_string_terminator() { // Well-sized header and payload but strings not properly terminated with \0\0 let mut buf: Vec = Vec::new(); push_table(&mut buf, 1, size_of::(), b"ONLYONE\0"); let res = find_smbios_table_by_type::(&buf, 1); assert!(matches!(res, Err(SmbiosParseError))); } } lace-0.1.0/lace-util/src/units.rs000066400000000000000000000137611514263214500166050ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only //! Unit types for formatted display of common values. use core::fmt::{self, Display}; /// A Unix timestamp (seconds since 1970-01-01 00:00:00 UTC) /// /// Formats as "YYYY-MM-DD HH:MM:SS UTC" (note the double space between /// date and time). /// /// # Example /// /// ``` /// use lace_util::units::Timestamp; /// /// let ts = Timestamp(1234567890); /// assert_eq!(format!("{}", ts), "2009-02-13 23:31:30 UTC"); /// ``` #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct Timestamp(pub i64); /// A size in bytes /// /// Formats as "N Bytes = X.Y UiB", showing the byte count followed by the /// most appropriate binary unit (KiB, MiB, GiB, etc.). /// /// # Example /// /// ``` /// use lace_util::units::Size; /// /// let size = Size(3891); /// assert_eq!(format!("{}", size), "3891 Bytes = 3.8 KiB"); /// ``` #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct Size(pub u64); impl Display for Timestamp { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let timestamp = self.0; let (days, remaining_secs) = { let days = timestamp / 86400; let remaining_secs = timestamp % 86400; // Handle negative timestamps (before 1970) if remaining_secs < 0 { (days - 1, remaining_secs + 86400) } else { (days, remaining_secs) } }; let hours = remaining_secs / 3600; let minutes = (remaining_secs % 3600) / 60; let seconds = remaining_secs % 60; // Calculate year, month, day from days since epoch let (year, month, day) = days_to_ymd(days); write!( f, "{:4}-{:02}-{:02} {:2}:{:02}:{:02} UTC", year, month, day, hours, minutes, seconds ) } } impl Display for Size { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { const UNITS: &[(u64, &str)] = &[ (1 << 60, "EiB"), (1 << 50, "PiB"), (1 << 40, "TiB"), (1 << 30, "GiB"), (1 << 20, "MiB"), (1 << 10, "KiB"), ]; let size = self.0; write!(f, "{} Bytes = ", size)?; for &(threshold, unit) in UNITS { if size >= threshold { let whole = size / threshold; let frac = ((size % threshold) * 10 + threshold / 2) / threshold; // Handle rounding overflow let (whole, frac) = if frac >= 10 { (whole + 1, frac - 10) } else { (whole, frac) }; if frac > 0 { return write!(f, "{}.{} {}", whole, frac, unit); } else { return write!(f, "{} {}", whole, unit); } } } // Less than 1 KiB, just show bytes again write!(f, "{} Bytes", size) } } /// Convert days since Unix epoch to (year, month, day) /// /// Uses the Howard Hinnant algorithm for civil calendar calculations. /// See: http://howardhinnant.github.io/date_algorithms.html fn days_to_ymd(days: i64) -> (i32, u32, u32) { // Days from year 0 to 1970-01-01 const DAYS_TO_1970: i64 = 719468; let days = days + DAYS_TO_1970; // Era (400-year period) let era = if days >= 0 { days / 146097 } else { (days - 146096) / 146097 }; let doe = (days - era * 146097) as u32; // Day of era [0, 146096] // Year of era [0, 399] let yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; let y = yoe as i64 + era * 400; let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); // Day of year [0, 365] let mp = (5 * doy + 2) / 153; // Month [0, 11] let d = doy - (153 * mp + 2) / 5 + 1; // Day [1, 31] let m = if mp < 10 { mp + 3 } else { mp - 9 }; // Month [1, 12] let y = if m <= 2 { y + 1 } else { y }; (y as i32, m, d) } #[cfg(test)] mod tests { use super::*; extern crate alloc; use alloc::format; #[test] fn test_timestamp_epoch() { assert_eq!(format!("{}", Timestamp(0)), "1970-01-01 0:00:00 UTC"); } #[test] fn test_timestamp_known_value() { // 1234567890 = 2009-02-13 23:31:30 UTC (a famous Unix timestamp) assert_eq!( format!("{}", Timestamp(1234567890)), "2009-02-13 23:31:30 UTC" ); } #[test] fn test_timestamp_y2k() { // 946684800 = 2000-01-01 00:00:00 UTC assert_eq!( format!("{}", Timestamp(946684800)), "2000-01-01 0:00:00 UTC" ); } #[test] fn test_timestamp_leap_year() { // 2020-02-29 12:00:00 UTC = 1582977600 assert_eq!( format!("{}", Timestamp(1582977600)), "2020-02-29 12:00:00 UTC" ); } #[test] fn test_timestamp_end_of_year() { // 2023-12-31 23:59:59 UTC = 1704067199 assert_eq!( format!("{}", Timestamp(1704067199)), "2023-12-31 23:59:59 UTC" ); } #[test] fn test_size_small() { assert_eq!(format!("{}", Size(327)), "327 Bytes = 327 Bytes"); } #[test] fn test_size_exactly_one_kib() { assert_eq!(format!("{}", Size(1024)), "1024 Bytes = 1 KiB"); } #[test] fn test_size_kib() { assert_eq!(format!("{}", Size(3891)), "3891 Bytes = 3.8 KiB"); } #[test] fn test_size_one_mib() { assert_eq!(format!("{}", Size(1 << 20)), "1048576 Bytes = 1 MiB"); } #[test] fn test_size_mib_with_frac() { // 1.5 MiB assert_eq!( format!("{}", Size((1 << 20) + (512 << 10))), "1572864 Bytes = 1.5 MiB" ); } #[test] fn test_size_zero() { assert_eq!(format!("{}", Size(0)), "0 Bytes = 0 Bytes"); } #[test] fn test_size_gib() { // 2.5 GiB assert_eq!( format!("{}", Size((2 << 30) + (512 << 20))), "2684354560 Bytes = 2.5 GiB" ); } } lace-0.1.0/lace-util/testdata/000077500000000000000000000000001514263214500161075ustar00rootroot00000000000000lace-0.1.0/lace-util/testdata/linux_signed_6.17.0-6.6_arm64_hwids.bin000066400000000000000000000245041514263214500246250ustar00rootroot00000000000000]CfRR 3 &C(ҁYв\Vؾy2 &C(FT_^9 &C(Xz0WZ( &C(X4P4Ķ &C(t5a~ETWg-no &C(T^JY͇c- &C(d%#'z|w-Qw~&d%#'~V]g[d%#'i6VScGJd%#'6^;9^b}Iod%#'!%T,Wd%#'.IqTtu&|;Fd%#'C\_Bѧ&4(Qt[$,dH&&4(kVD\ֺ8&4(2eȻR~&4(;o2_\w=^"&4(p~<`Uw5HxKx&4(I2&m\?&4(lhlŎ^f&4(ڼ{۝WټR&4(ld=\FVtfP&4( L6] >b5l&4(rQgnvRh&4(DT+i/6&4(U7WLa&4(#2`_d &4(9T|Ч%&4(v|USXņ&4(G/\NZCN&4(2:W _&4(V>_oB6&4(+eD]Urd$&4(w0\9DZ-;&4(x O3^8%%(1?y],;d%%(.8MX|,%%(;h>SeSY%%(O?X/àA(%%(YnN:]7M#%%(;~,+Vd&0%%($lȀWLHH%%(\f&VF%%(raؠUAUdX%%(SN ]ϳHTJ1%%(+-^Cۯ %%(]yc%%(á :YDO&(4JS/Ǝ&(c:/ZpDm&(-?sSr&()K\XyC:&(pMxx[s=](&(dAC\^%P7&(i3Xiq&(~ibPwsxK&(4i6^u/n5Brӎ&(U4Ų \, DW&(G\Ώu+=&( ߡ_"LII&(˲۫RtV .,˴&(we~Vfjg&(X1vV D):&(p\]3K&(i\{UV&(?CTLZk>&(F|QdH_&(^,-IY a&(*oZَ&(o4@\d}1&(WdQLO&(8ۼW&}&(HSGT^V&(O[^Q1L[&(iʣ__f &(w6mVWMR&(1.HSRPĂge&(K#Y d?&(y~֧+ZUtR:;&(9pIWuQY&(7#vONQdGH&(onH: ;VP3&(\s]KT&( chTɳʖ&(q`kcHxPbĞ&($zp]QDd&(r!^\+|&(pkX~&(+Y-PP!4sN &(xp%\k;U'[&(A+uXΙ8&(101]r}&(&)85ίSʜl{&(HCGrSG?&(+ϣ\T[׳pO&(;gBY%z1R&(eP`Ro&(V{T-&q&()=9Y%!OR*&(#ƈ\ V &(IǸi6VG:.ݖ&(.|n8^Bݛ4&(P]KOl]R$') $UaH_H ') U˿_q')IVŤHR')Z\URY[`{')K} pZ')|]z״K&S(8&DQo%K&S(hn+ΛTtæK&S(2H9ZaQjFK&S(StV KK&S(ߟWWe?K&S(4{ֲXc8!nqYK&S(V+EwS-ȗK&S(Cᰖ 6W sI\K&S([68YZ=4l&l(7';\Z;l&l(wUH]ĝKEl&l(} | Ubl&l(-WO0bؑl&l(zNh)[x^(l&l("'.\S,e0&S(>ޖ]80 D0&S(4}_՛0&S(`Ig[W0&S(v9QQ?B[<_80&S(Q]pXU&G0&S(׍WqX[{0&S(d \0]Js0&S(d7YtXܓW0&S(x.vg]{u0&S(yGX*\)0&S(J:M]pnS%C'wbBXZXuo\%C'2Ccm!Wk%C'CUS(6r%C'}S5Gk%C'۾ަTZ`Mõg_%C';UBVa{E,%C' [jƫD%C'>ʦG[^ 1n%C'Lf6V[ӥP4%C' +4"Tgx}%C'8]^D|q=%s'Kup\h@[|%%'("h[-uі%'+"nS_K*3d%'o:>KCVU$Oz%'XPށW%'峮}Y"MHH Ö%'t4Z\&i$`%'`!X1%'p}7/_0l@%'6-QtZ3Z%'v;RŔ+=A%'I&%'Ic T l%'\hy\UK%'ViU"MՍ_mO%'ٵV7jr>Xѩ%'JcBQwp&+%'7%XXlyx%'uR9XhT%[%'asT([X6m%'r [IY>%'J{X{N_`9~%'i5Xzp" %'E_-F%'Wɣgu_Htu%%'vWke%'=-k[*XHHl%'KáT͑;{%'LX"՗耢%']W^K`%(*,Z!H%( PT-Yh6*u%(Kh]+Ϩy%(Ej; [˃N̓%(&J_}/jo%(늄+0k[ F2SY%(*PWÄ_Կ*%(O]SSV. %(R"^Z1)%(mw ^wEM5&(?SQdz&(CBcp WT0 $&(SmjW*H]&(sP^_Lݜe&((w+QVUQ&(|҅WF:q&(lٖJJ^)-(p&()9A_TUUb&(+^S)U&(O*NR#&(aҋQFM+&(܇P?͚m&(peKT~+a&(7s[P&(^jHUWwi&(PJX ]{W~&(O8ZMF]!u&(Tff\wUO&(|V#@&(ᲄA_Aaj&(xY ߵ&(g_Yz &(Ma+zY9_c&(wci}2Z۹&(K"3[!{&(@2EPOD;%(X+V#> L%(9CZ r%0'  ZyB"ڛr%0'/ #]7VSr%0''\ZGDar%0'&u3#YE ꂤr%0'I?oZJJ#Mr%0'ragS$] r%0'jHTfAY&r%0'z|w-Qw~&r%0'_ ?M&?r%0'IQ؉ 8r%0'p[^*Kcj9r%0'"Q?0XBnSmr%0'ASUSTeK COMPUTER INC. ASUS Vivobook S 15ASUSTeK COMPUTER INC. ASUS Zenbook A14Acer Aspire 1Acer Swift 14 AIDell Inc. InspironDell Inc. LatitudeDell Inc. XPSHP 103C_5335M8 HP OmniBook XHP 103C_5336AN HP EliteBook UltraHUAWEI MateBook ELENOVO Flex 5G 14Q8CX05LENOVO Miix 630LENOVO ThinkPad T14s Gen 6LENOVO ThinkPad T14s Gen 6 (LCD)LENOVO ThinkPad T14s Gen 6 (OLED)LENOVO ThinkPad X13s Gen 1LENOVO YOGA C630-13Q50LENOVO Yoga 5G 14Q8CX05LENOVO Yoga Slim 7 14Q8X9Microsoft Corporation SurfaceQualcomm SCP_HAMOAacer,aspire1acer,swift-sf14-11asus,vivobook-s15asus,zenbook-a14-ux3407qa-lcdasus,zenbook-a14-ux3407qa-oledasus,zenbook-a14-ux3407radell,inspiron-14-plus-7441dell,latitude-7455dell,xps13-9345hp,elitebook-ultra-g1qhp,omnibook-x14hp,omnibook-x14-fe1huawei,gaokun3lenovo,flex-5glenovo,miix-630lenovo,thinkpad-t14s-lcdlenovo,thinkpad-t14s-oledlenovo,thinkpad-x13slenovo,yoga-c630lenovo,yoga-slim7xmicrosoft,arcatamicrosoft,blackrockmicrosoft,denalimicrosoft,romulus13microsoft,romulus15qcom,x1e001de-devkitqcom,x1e80100-crdlace-0.1.0/lace-util/testdata/t14s-dmi.bin000066400000000000000000000040141514263214500201420ustar00rootroot00000000000000 1L1 Instruction Cache1L1 Data Cache@@1L2 Cache\ #!!\X Top - on boardBank 034560H gA , QualcommQualcomm Technologies IncSnapdragon(R) X Elite - X1E78100 - Qualcomm(R) Oryon(TM) CPU446None6 '$  }  LENOVON42ET92W (2.22 )06/27/2025 .\PLENOVO21N2ZC5QUSThinkPad T14s Gen 6PW0C7DHZLENOVO_MT_21N2_BU_Think_FM_ThinkPad T14s Gen 6ThinkPad T14s Gen 6   LENOVO21N2ZC5QUSSDK0T76576 WIN ptal8W1CG45Z0H4FNot AvailableNot Available  LENOVONonePW0C7DHZNo Asset InformationLENOVO_MT_21N2_BU_Think_FM_ThinkPad T14s Gen 6 Not AvailableUSB 1 Not AvailableUSB 2 Not AvailableUSB 3 Not AvailableUSB 4~ Not AvailableUSB 5~ Not AvailableUSB 6~ Not AvailableUSB 7~ Not AvailableUSB 8~ Not AvailableUSB 9~ Not AvailableExternal Monitor Not AvailableHdmi1~ Not AvailableHdmi2~ Not AvailableDisplayPort1~ Not AvailableDisplayPort2 Not AvailableHeadphone/Microphone Combo Jack1~ Not AvailableHeadphone/Microphone Combo Jack2 SimCard Slot  en-US~ ~  !KHOIHGIUCCHHII"#$%TVT-Enablement&ZZ'"(6)THNK<*THNKx+THNK0,THNK@-THNKP,]8.THNK`% 0&% '% $# E% V% PW/TP0LENOVO 42HT56W06/18/2025+1LENOVO %)2LENOVO MS 3LENOVO 4LENOVO 0lace-0.1.0/lace-util/testdata/t14s-edid.bin000066400000000000000000000002001514263214500202670ustar00rootroot00000000000000 f  xM5TK$QW>p<@0 6.2p<@0 6. set[str]: """Return a set of workspace member package names.""" metadata = subprocess.run( ["cargo", "metadata", "--no-deps", "--format-version", "1"], check=True, capture_output=True, text=True, ) return set(map(lambda pkg: pkg["name"], json.loads(metadata.stdout)["packages"])) def main(): """Main function to parse arguments and run cargo commands.""" parser = argparse.ArgumentParser(description="Cargo wrapper for CI environments") parser.add_argument("command", help="Cargo command to run") parser.add_argument( "--workspace", action="store_true", help="Run command for all workspace members" ) parser.add_argument( "-p", "--package", action="append", help="Specify package to run command for" ) parser.add_argument( "--exclude", action="append", help="Exclude package from workspace run" ) args, unknown_args = parser.parse_known_args() package_set = set(args.package) if args.package else set() exclude_set = set(args.exclude) if args.exclude else set() if args.workspace and package_set: print("Error: --package cannot be used with --workspace", file=sys.stderr) sys.exit(1) if not args.workspace and exclude_set: print("Error: --exclude can only be used with --workspace", file=sys.stderr) sys.exit(1) if args.workspace: package_set = get_workspace_members().difference(exclude_set) if package_set: for package in package_set: result = subprocess.run( ["cargo", args.command, "-p", package] + unknown_args, check=False ) if result.returncode != 0: sys.exit(result.returncode) else: result = subprocess.run(["cargo", args.command] + unknown_args, check=False) if result.returncode != 0: sys.exit(result.returncode) if __name__ == "__main__": main() lace-0.1.0/scripts/vm_manage.py000077500000000000000000000424601514263214500164230ustar00rootroot00000000000000#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only """Lace test VM management script""" import argparse import copy import json import os import platform import shutil import subprocess import time import guestfs import pefile import requests # Enable DEBUG mode DEBUG = False # Use local image server for Ubuntu cloud images LOCAL_IMG_SERVER = False # Ubuntu release to use for testing UBUNTU_RELEASE = "resolute" # Constants for size units KIB = 1024 MIB = 1024 * KIB GIB = 1024 * MIB # Disk sector size SECTOR_SIZE = 512 # Default VM configurations for different architectures VM_DEFAULTS = { "x86_64": { "arch": "x86_64", "machine": "q35", "cpu": { "model": "qemu64", }, "fw": { "dir": "/usr/share/OVMF", "code": "OVMF_CODE_4M.fd", "vars": "OVMF_VARS_4M.fd", }, }, "aarch64": { "arch": "aarch64", "machine": "virt", "cpu": { "model": "cortex-a57", }, "fw": { "dir": "/usr/share/AAVMF", "code": "AAVMF_CODE.secboot.fd", "vars": "AAVMF_VARS.fd", }, }, } # EFI system partition type GUID EFI_SYSTEM_PARTITION_TYPE_GUID = "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" # Cloud-init user-data template CI_USER_DATA = """#cloud-config password: ubuntu chpasswd: { expire: False } ssh_pwauth: True """ # EFI suffixes for different architectures EFI_SUFFIXES = { "x86_64": "X64.EFI", "aarch64": "AA64.EFI", } def default_vm_dir(): """ Returns the default directory for VM files, which is one level up from the "scripts" directory and is called "vm". """ return os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "vm" ) def parse_disk_size(disk_size): """ Parse a disk size string with optional unit suffix (K, M, G) and return the size in bytes """ units = {"K": KIB, "M": MIB, "G": GIB} unit = 1 if disk_size[-1] in units: unit = units[disk_size[-1]] disk_size = disk_size[:-1] return int(disk_size) * unit def ubuntu_cloud_url(release, arch): """ Construct the URL for the Ubuntu cloud image for the given release and architecture """ if arch == "x86_64": arch = "amd64" elif arch == "aarch64": arch = "arm64" else: raise ValueError(f"Unsupported architecture for Ubuntu cloud image: {arch}") if LOCAL_IMG_SERVER: return f"http://localhost/cloudimg/{release}-server-cloudimg-{arch}.img" return f"http://cloud-images.ubuntu.com/{release}/current/{release}-server-cloudimg-{arch}.img" def download_file(url, dest_path): """ Download a file from the given URL to the specified destination path """ resp = requests.get(url, timeout=10, stream=True) if resp.status_code != 200: raise RuntimeError( f"Failed to download file from {url}: HTTP {resp.status_code}" ) with open(dest_path, "wb") as file: for chunk in resp.iter_content(chunk_size=4096): file.write(chunk) def best_vm_accel(vm_arch): """ Determine the best VM accelerator to use based on the host and VM architecture. """ if platform.machine() == vm_arch: return "kvm" # Use hardware acceleration if host and target arch match return "tcg" # Use software emulation if host and target arch differ def create_disk_image(args): """Create a disk image for the VM based on an Ubuntu cloud image""" # Download Ubuntu cloud image ubuntu_img_url = ubuntu_cloud_url(UBUNTU_RELEASE, args.arch) ubuntu_img_path = os.path.join(args.dir, "ubuntu-cloud.img") print(f"Downloading Ubuntu cloud image from {ubuntu_img_url}...") download_file(ubuntu_img_url, ubuntu_img_path) print("Download complete.") disk_image_path = os.path.join(args.dir, "disk.img") gfs = guestfs.GuestFS(python_return_dict=True) if DEBUG: gfs.set_trace(1) gfs.disk_create(disk_image_path, "raw", args.disk_size) gfs.add_drive_opts(disk_image_path, format="raw", readonly=0) gfs.add_drive_opts(ubuntu_img_path, format="qcow2", readonly=1) gfs.launch() # Find Ubuntu OS root roots = gfs.inspect_os() if len(roots) == 0: raise RuntimeError("No operating systems found in the Ubuntu cloud image") # Mount Ubuntu filesystems mps = gfs.inspect_get_mountpoints(roots[0]) # NOTE: /dev/sda is going to be ignored here, this is a tmpfs, # libguestfs just needs a block device here `none` doesn't work gfs.mount_vfs("size=1M", "tmpfs", "/dev/sda", "/") gfs.mkdir_p("/cloudimg") for mount_point, device in sorted(mps.items(), key=lambda k: len(k[0])): gfs.mount_ro(device, f"/cloudimg{mount_point}") # Create GPT partition table and partitions device = gfs.list_devices()[0] gfs.part_init(device, "gpt") gfs.part_add(device, "p", 2048, 2048 + (512 * MIB // SECTOR_SIZE) - 1) # ESP gfs.part_set_gpt_type(device, 1, EFI_SYSTEM_PARTITION_TYPE_GUID) gfs.part_add( device, "p", 2048 + (512 * MIB // SECTOR_SIZE), -2048 ) # Root partition # Format filesystems partitions = list(filter(lambda s: s.startswith(device), gfs.list_partitions())) esp_partition = partitions[0] root_partition = partitions[1] gfs.mkfs("vfat", esp_partition) gfs.mkfs(args.root_fs_type, root_partition) # Copy files from Ubuntu cloud image to new disk gfs.mkdir_p("/disk") gfs.mount(root_partition, "/disk") gfs.mkdir_p("/disk/boot/efi") gfs.mount(esp_partition, "/disk/boot/efi") gfs.cp_a("/cloudimg/.", "/disk/") # Write new fstab fstab_content = f"""# /etc/fstab: static file system information. UUID={gfs.vfs_uuid(root_partition)} / {args.root_fs_type} errors=remount-ro 0 1 UUID={gfs.vfs_uuid(esp_partition)} /boot/efi vfat umask=0077 0 2 """ gfs.write("/disk/etc/fstab", fstab_content) # Remove GRUB installation and EFI files gfs.rm_rf("/disk/boot/grub") gfs.rm_rf("/disk/boot/efi/EFI") # Close disks gfs.umount_all() gfs.shutdown() gfs.close() # Delete cloud image os.remove(ubuntu_img_path) def do_init(args): """Handler for the 'init' command""" # Create VM directory if it doesn't exist # Otherwise, raise an error os.makedirs(args.dir, exist_ok=False) # Get firmware paths defaults = VM_DEFAULTS.get(args.arch) if not defaults: raise ValueError(f"Unsupported architecture: {args.arch}") # Save VM configuration config = copy.deepcopy(defaults) config["cpu"]["cores"] = args.cores config["ram"] = args.ram config["disk"] = { "format": "raw", "file": "disk.img", } with open( os.path.join(args.dir, "config.json"), "w", encoding="utf-8" ) as config_file: json.dump(config, config_file, indent=4) # Copy firmware files firmware = config["fw"] shutil.copyfile( os.path.join(firmware["dir"], firmware["code"]), os.path.join(args.dir, firmware["code"]), ) shutil.copyfile( os.path.join(firmware["dir"], firmware["vars"]), os.path.join(args.dir, firmware["vars"]), ) # Create disk image create_disk_image(args) def build_and_inject_stubble(args, config): """Build lace-stubble and inject it into the VM disk image""" # Build lace-stubble stubble_target = f"{config['arch']}-unknown-uefi" subprocess.run( [ "cargo", "build", "-p", "lace-stubble", "--target", stubble_target, ], check=True, ) # Open disk image for read/write disk_image_path = os.path.join(args.dir, "disk.img") gfs = guestfs.GuestFS(python_return_dict=True) if DEBUG: gfs.set_trace(1) gfs.add_drive_opts(disk_image_path, format="raw", readonly=0) gfs.launch() # Find and mount OS root roots = gfs.inspect_os() if not roots: raise RuntimeError("No operating systems found in the Ubuntu image") mps = gfs.inspect_get_mountpoints(roots[0]) for mount_point, device in sorted(mps.items(), key=lambda k: len(k[0])): gfs.mount(device, mount_point) # Download kernel and initrd boot_listing = gfs.ls("/boot/") kernel_name = max(filter(lambda n: n.startswith("vmlinuz-"), boot_listing)) initrd_name = max(filter(lambda n: n.startswith("initrd.img-"), boot_listing)) gfs.download(f"/boot/{kernel_name}", os.path.join(args.dir, "vmlinuz")) gfs.download(f"/boot/{initrd_name}", os.path.join(args.dir, "initrd.img")) # On arm64 strip existing stubble layer from kernel dtbauto_files = [] if config["arch"] == "aarch64": pe = pefile.PE(os.path.join(args.dir, "vmlinuz")) dtbauto_idx = 0 for section in pe.sections: if section.Name.rstrip(b"\x00") == b".linux": with open( os.path.join(args.dir, "vmlinuz-really"), "wb" ) as vmlinuz_really: vmlinuz_really.write(section.get_data()) elif section.Name.rstrip(b"\x00") == b".dtbauto": dtbauto_path = os.path.join(args.dir, f"dtbauto-{dtbauto_idx}") with open(dtbauto_path, "wb") as dtbauto_file: dtbauto_file.write(section.get_data()) dtbauto_files.append(dtbauto_path) dtbauto_idx += 1 shutil.move( os.path.join(args.dir, "vmlinuz-really"), os.path.join(args.dir, "vmlinuz") ) # Create stubble EFI binary stubble_efi_path = os.path.join( "target", stubble_target, "debug", "lace-stubble.efi" ) output_efi_path = os.path.join(args.dir, "stubble.efi") pewrap_cmd = [ "cargo", "run", "-p", "pewrap", "--", "--stub", stubble_efi_path, "--output", output_efi_path, "--linux", os.path.join(args.dir, "vmlinuz"), "--initrd", os.path.join(args.dir, "initrd.img"), "--cmdline", f"console=ttyS0 console=tty0 root=UUID={gfs.vfs_uuid(roots[0])} rw", "--hwids", "data/hwids/json", ] # Add dtbauto files we might have extracted above if dtbauto_files: for dtbauto_file in dtbauto_files: pewrap_cmd.extend(["--dtbauto", dtbauto_file]) subprocess.run(pewrap_cmd, check=True) # Copy EFI binary to ESP gfs.mkdir_p("/boot/efi/EFI/BOOT") gfs.upload( output_efi_path, f"/boot/efi/EFI/BOOT/BOOT{EFI_SUFFIXES[config['arch']]}" ) # Close disk gfs.umount_all() gfs.shutdown() gfs.close() def do_start(args): """Handler for the 'start' command""" # Load VM configuration with open( os.path.join(args.dir, "config.json"), "r", encoding="utf-8" ) as config_file: config = json.load(config_file) # Build and inject lace-stubble build_and_inject_stubble(args, config) # Start swtpm if requested swtpm_proc = None tpm_sock = None if config.get("tpm"): if not shutil.which("swtpm"): raise RuntimeError("swtpm not found") tpm_dir = os.path.join(args.dir, "tpm") os.makedirs(tpm_dir, exist_ok=True) tpm_sock = os.path.join(tpm_dir, "swtpm-sock") # Clean up stale socket if os.path.exists(tpm_sock): os.remove(tpm_sock) swtpm_cmd = [ "swtpm", "socket", "--tpmstate", f"dir={tpm_dir}", "--ctrl", f"type=unixio,path={tpm_sock}", "--tpm2", "--log", "level=0", ] print(f"Starting swtpm...") swtpm_proc = subprocess.Popen(swtpm_cmd) # Wait for socket retries = 50 while not os.path.exists(tpm_sock) and retries > 0: time.sleep(0.1) retries -= 1 if not os.path.exists(tpm_sock): if swtpm_proc.poll() is not None: raise RuntimeError("swtpm exited unexpectedly") raise RuntimeError("Timed out waiting for swtpm socket") try: # Check for acpi disable on ARM64 acpi_flag = "" if config["arch"] == "aarch64" and config.get("acpi") == "off": acpi_flag = ",acpi=off" # Construct QEMU command qemu_cmd = [ "qemu-system-" + config["arch"], "-nographic", "-machine", f"{config['machine']},accel={best_vm_accel(config['arch'])}{acpi_flag}", "-cpu", config["cpu"]["model"], "-smp", f"cores={config['cpu']['cores']}", "-m", config["ram"], "-drive", "if=pflash,unit=0,format=raw,readonly=on,file=" + os.path.join(args.dir, config["fw"]["code"]), "-drive", "if=pflash,unit=1,format=raw,file=" + os.path.join(args.dir, config["fw"]["vars"]), "-drive", f"if=none,id=disk,format={config['disk']['format']},file=" + os.path.join(args.dir, config["disk"]["file"]), "-device", "virtio-blk-pci,drive=disk,bootindex=1", ] # Add TPM if requested if config.get("tpm"): tpm_dev = "tpm-tis-device" if config["arch"] == "aarch64" else "tpm-tis" qemu_cmd.extend( [ "-chardev", f"socket,id=chrtpm,path={tpm_sock}", "-tpmdev", "emulator,id=tpm0,chardev=chrtpm", "-device", f"{tpm_dev},tpmdev=tpm0", ] ) # Add SMBIOS table to QEMU command if "smbios" in config: qemu_cmd.extend( ["-smbios", "file=" + os.path.join(args.dir, config["smbios"])] ) # Install EDID file using fakeedid.efi in a vvfat drive if "edid" in config: # Build fakeedid.efi subprocess.run( [ "cargo", "build", "-p", "fakeedid", "--target", f"{config['arch']}-unknown-uefi", ], check=True, ) # Create EDID drive edid_drive = os.path.join(args.dir, "edid_drive") os.makedirs(os.path.join(edid_drive, "EFI", "BOOT"), exist_ok=True) shutil.copyfile( os.path.join( "target", f"{config['arch']}-unknown-uefi", "debug", "fakeedid.efi", ), os.path.join( edid_drive, "EFI", "BOOT", f"BOOT{EFI_SUFFIXES[config['arch']]}" ), ) shutil.copyfile( os.path.join(args.dir, config["edid"]), os.path.join(edid_drive, "edid.bin"), ) qemu_cmd.extend( [ "-drive", f"file=fat:rw:{edid_drive},format=raw,if=none,id=edid_drive", "-device", "virtio-blk-pci,drive=edid_drive,bootindex=0", ] ) # Add cloud-init seed on first boot if not os.path.exists(os.path.join(args.dir, "cloud-init-seed.img")): cloud_init_iso_path = os.path.join(args.dir, "cloud-init-seed.img") with open( os.path.join(args.dir, "user-data"), "w", encoding="utf-8" ) as file: file.write(CI_USER_DATA) subprocess.run( [ "cloud-localds", cloud_init_iso_path, os.path.join(args.dir, "user-data"), ], check=True, ) qemu_cmd.extend( ["-drive", f"file={cloud_init_iso_path},format=raw,if=virtio"] ) # Start the VM subprocess.run(qemu_cmd, check=True) finally: if swtpm_proc: print("Terminating swtpm...") swtpm_proc.terminate() swtpm_proc.wait() def main(): """Main function to parse arguments and execute commands""" parser = argparse.ArgumentParser(description="Lace VM management script") parser.add_argument( "--dir", type=str, default=default_vm_dir(), help="Directory for VM files" ) cmds = parser.add_subparsers(dest="command", required=True) init_cmd = cmds.add_parser("init", help="Initialize the VM") init_cmd.add_argument( "--arch", type=str, default=platform.machine(), help="Target architecture" ) init_cmd.add_argument("--cores", type=int, default=1, help="Number of CPU cores") init_cmd.add_argument("--ram", type=str, default="1G", help="Amount of RAM") init_cmd.add_argument( "--disk-size", type=parse_disk_size, default="4G", help="Disk size for the VM" ) init_cmd.add_argument( "--root-fs-type", type=str, default="ext4", help="Filesystem type for root partition", ) cmds.add_parser("start", help="Start the VM") args = parser.parse_args() match args.command: case "init": do_init(args) case "start": do_start(args) case _: raise RuntimeError("executed unreachable code") if __name__ == "__main__": main() lace-0.1.0/tools/000077500000000000000000000000001514263214500135575ustar00rootroot00000000000000lace-0.1.0/tools/collect-hwids/000077500000000000000000000000001514263214500163205ustar00rootroot00000000000000lace-0.1.0/tools/collect-hwids/Cargo.toml000066400000000000000000000005751514263214500202570ustar00rootroot00000000000000[package] name = "collect-hwids" version = "0.1.0" edition = "2024" license = "GPL-2.0-only OR GPL-3.0-only" [dependencies] clap = { version = "4.5.57", features = ["derive", "wrap_help"] } lace-util = { version = "0.1.0", path = "../../lace-util" } regex = "1.12.3" zerocopy = "0.8.39" zip = { version = "7.4.0", default-features = false, features = ["deflate-flate2-zlib-rs"] } lace-0.1.0/tools/collect-hwids/src/000077500000000000000000000000001514263214500171075ustar00rootroot00000000000000lace-0.1.0/tools/collect-hwids/src/cli.rs000066400000000000000000000020361514263214500202250ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. use clap::Parser; use std::ffi::OsString; #[derive(Parser, Debug)] #[command( version, about = "Tool to collect CHIDs from a running system", long_about = "collect-hwids reads system hardware information (SMBIOS tables and EDID data) \ and generates Computer Hardware IDs (CHIDs).\n\n\ The tool outputs CHID information to stdout and optionally creates a ZIP archive \ containing the raw hardware data for use in firmware update metadata or debugging." )] pub struct Args { /// Output path for HWIDs ZIP archive /// /// Creates a ZIP archive containing SMBIOS tables, EDID data, and computed /// CHIDs. The archive can be used for firmware update metadata generation /// or for debugging hardware identification issues. If not specified, only /// CHID information is written to stdout. #[arg(short, long, value_name = "FILE")] pub output: Option, } lace-0.1.0/tools/collect-hwids/src/lib.rs000066400000000000000000000001551514263214500202240ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. pub mod cli; lace-0.1.0/tools/collect-hwids/src/main.rs000066400000000000000000000125331514263214500204050ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri use clap::Parser; use collect_hwids::cli::Args; use lace_util::chid::*; use regex::bytes::Regex; use std::error::Error; use std::io::Write; use zip::{CompressionMethod, ZipWriter, write::SimpleFileOptions}; const SMBIOS_EP_PATH: &str = "/sys/firmware/dmi/tables/smbios_entry_point"; const SMBIOS_PATH: &str = "/sys/firmware/dmi/tables/DMI"; const DRM_PATH: &str = "/sys/class/drm"; fn main() { let args = Args::parse(); // Read SMBIOS entry point and table let smbios_ep_data = match std::fs::read(SMBIOS_EP_PATH) { Ok(d) => Some(d), Err(e) => { eprintln!("warning: failed to read SMBIOS entry point: {}", e); None } }; let smbios_data = match std::fs::read(SMBIOS_PATH) { Ok(d) => d, Err(e) => { eprintln!("error: failed to read SMBIOS table: {}", e); std::process::exit(1); } }; // Collect EDIDs let edids = collect_edids(); let edid = if !edids.is_empty() { if edids.len() > 1 { eprintln!( "warning: more than one EDID found, using first one for internal panel ID, re-run with external screens disconnected" ) } Some(edids[0].1.as_slice()) } else { None }; // Fill CHID sources let srcs = match chid_sources_from_smbios_and_edid(smbios_ep_data.as_deref(), &smbios_data, edid) { Ok(s) => s, Err(e) => { eprintln!("error: failed to fill CHID sources: {}", e); std::process::exit(1); } }; // Write sources and computed CHIDs to stdout let _ = write_sources_and_chids(&mut std::io::stdout(), &srcs); // Write output to ZIP archive if let Some(output) = &args.output { let outfile = match std::fs::File::create(output) { Ok(f) => f, Err(e) => { eprintln!("error: failed to create {:?}: {}", args.output, e); std::process::exit(1); } }; if let Err(e) = write_zip( outfile, smbios_ep_data.as_deref(), &smbios_data, &edids, &srcs, ) { eprintln!("error: failed to write zip {:?}: {}", &args.output, e); std::process::exit(1); } } } fn collect_edids() -> Vec<(String, Vec)> { let mut edids = Vec::new(); let drm_dir = match std::fs::read_dir(DRM_PATH) { Ok(d) => d, Err(e) => { eprintln!("warning: failed to open DRM directory: {}", e); return edids; } }; let port_re = Regex::new(r"card\d+-").unwrap(); for ent in drm_dir { let ent = match ent { Ok(e) => e, Err(e) => { eprintln!("warning: failed to read DRM directory: {}", e); continue; } }; // Skip entries that don't look like a video port if !port_re.is_match(ent.path().as_os_str().as_encoded_bytes()) { continue; } // Try reading EDID let mut edid_path = ent.path(); let port_name = edid_path.file_name().unwrap().to_string_lossy().to_string(); edid_path.push("edid"); match std::fs::read(&edid_path) { Ok(d) if d.is_empty() => (), // Skip empty EDID files Ok(d) => edids.push((port_name, d)), Err(e) => { eprintln!("warning: failed to read {:?}: {}", edid_path, e); } } } edids } fn write_sources_and_chids( w: &mut dyn std::io::Write, chid_srcs: &ChidSources, ) -> Result<(), Box> { // Write CHID sources for (i, src) in chid_srcs.iter().enumerate() { if let Some(s) = src { writeln!(w, "CHID source {}: {:?}", i, s)? } else { writeln!(w, "CHID source {}: ", i)? } } writeln!(w, "----------------------------------")?; // Write computed CHIDs for (i, &chid_type) in CHID_TYPES.iter().enumerate() { if let Some(chid) = compute_chid(chid_srcs, chid_type) { writeln!(w, "CHID type {}: {}", i, chid)?; } else { writeln!(w, "CHID type {}: ", i)?; } } Ok(()) } fn write_zip( w: W, smbios_ep: Option<&[u8]>, smbios: &[u8], edids: &[(String, Vec)], chid_srcs: &ChidSources, ) -> Result<(), Box> where W: std::io::Write + std::io::Seek, { let mut zw = ZipWriter::new(w); let options = SimpleFileOptions::default().compression_method(CompressionMethod::Deflated); // Write SMBIOS entry point and table if let Some(smbios_ep) = smbios_ep { zw.start_file("smbios_entry_point.bin", options)?; let _ = zw.write(smbios_ep)?; } zw.start_file("smbios.bin", options)?; let _ = zw.write(smbios)?; // Write EDIDs for (port, edid) in edids.iter() { zw.start_file(format!("{}.bin", port), options)?; let _ = zw.write(edid)?; } // Text file for CHID sources and computed CHIDs zw.start_file("hwids.txt", options)?; // Write CHID sources and computed CHIDs write_sources_and_chids(&mut zw, chid_srcs)?; // Finish ZIP zw.finish()?; Ok(()) } lace-0.1.0/tools/fakeedid/000077500000000000000000000000001514263214500153135ustar00rootroot00000000000000lace-0.1.0/tools/fakeedid/Cargo.toml000066400000000000000000000003341514263214500172430ustar00rootroot00000000000000[package] name = "fakeedid" version = "0.1.0" edition = "2024" license = "GPL-2.0-only OR GPL-3.0-only" [dependencies] uefi = { version = "0.36.1", features = ["panic_handler"] } [[bin]] name = "fakeedid" test = false lace-0.1.0/tools/fakeedid/src/000077500000000000000000000000001514263214500161025ustar00rootroot00000000000000lace-0.1.0/tools/fakeedid/src/main.rs000066400000000000000000000064141514263214500174010ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri // A simple UEFI application that installs a fake EDID protocol // with data read from edid.bin file located at the root of the // filesystem the application was booted from. #![no_main] #![no_std] use core::ffi::c_void; use uefi::Identify; use uefi::proto::media::file::{File, RegularFile}; use uefi::{ prelude::*, proto::{ loaded_image::LoadedImage, media::{ file::{FileAttribute, FileMode}, fs::SimpleFileSystem, }, }, }; /// This protocol contains the EDID information retrieved from a video output device. /// Ref: 12.9.2.4. EFI_EDID_DISCOVERED_PROTOCOL #[repr(C)] struct EdidDiscoveredProtocol { size_of_edid: u32, edid: *const u8, } unsafe impl uefi::Identify for EdidDiscoveredProtocol { const GUID: uefi::Guid = uefi::guid!("1c0c34f6-d380-41fa-a049-8ad06c1a66aa"); } impl uefi::proto::Protocol for EdidDiscoveredProtocol {} #[entry] fn main() -> Status { uefi::helpers::init().unwrap(); // Open edid.bin at the root of the filesystem fakeedid was booted from let li = boot::open_protocol_exclusive::(boot::image_handle()) .expect("cannot get our own loaded image"); let bootdev = li .device() .expect("cannot get boot device from loaded image"); let mut bootfs = boot::open_protocol_exclusive::(bootdev) .expect("cannot open SimpleFileSystem protocol on boot device"); let mut root: uefi::proto::media::file::Directory = bootfs.open_volume().expect("cannot open root volume"); let mut file = root .open(cstr16!("edid.bin"), FileMode::Read, FileAttribute::empty()) .expect("cannot open edid.bin") .into_regular_file() .expect("edid.bin is not a regular file"); // Allocate a buffer to store protocol and file and read the file into it file.set_position(RegularFile::END_OF_FILE) .expect("cannot seek to end of edid.bin"); let file_size = file.get_position().expect("cannot get size of edid.bin"); file.set_position(0) .expect("cannot seek to start of edid.bin"); let mem = boot::allocate_pages( boot::AllocateType::AnyPages, boot::MemoryType::BOOT_SERVICES_DATA, (size_of::() + file_size as usize).div_ceil(boot::PAGE_SIZE), ) .expect("cannot allocate memory for edid.bin"); unsafe { // Protocol first let ptr = mem.as_ptr() as *mut EdidDiscoveredProtocol; (*ptr).size_of_edid = file_size as u32; (*ptr).edid = mem.as_ptr().add(size_of::()); // Then file contents file.read(core::slice::from_raw_parts_mut( mem.as_ptr().add(size_of::()), file_size as usize, )) .expect("cannot read edid.bin"); // Install EDID protocol boot::install_protocol_interface( None, &EdidDiscoveredProtocol::GUID, mem.as_ptr() as *const c_void, ) .expect("cannot install EDID protocol"); }; // Exit with error so firmware continues booting the next boot option Status::NOT_STARTED } lace-0.1.0/tools/pewrap/000077500000000000000000000000001514263214500150555ustar00rootroot00000000000000lace-0.1.0/tools/pewrap/Cargo.toml000066400000000000000000000005341514263214500170070ustar00rootroot00000000000000[package] name = "pewrap" version = "0.1.0" edition = "2024" license = "GPL-2.0-only OR GPL-3.0-only" [dependencies] clap = { version = "4.5.57", features = ["derive", "wrap_help"] } lace-util = { version = "0.1.0", path = "../../lace-util" } serde = { version = "1.0.228", features = ["serde_derive"] } serde_json = "1.0.149" zerocopy = "0.8.39" lace-0.1.0/tools/pewrap/src/000077500000000000000000000000001514263214500156445ustar00rootroot00000000000000lace-0.1.0/tools/pewrap/src/cli.rs000066400000000000000000000113161514263214500167630ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. use clap::Parser; use std::path::PathBuf; #[derive(Parser, Debug)] #[command( version, about = "Tool for building stubble images", long_about = "pewrap combines a pre-built stub binary with additional binaries \ (Linux kernel, initrd, device trees), SBAT data, and HWIDs \ to generate a stubble image.\n\n\ The tool takes a stub PE binary and adds new sections containing the \ specified payloads. This enables creation of stubble images that \ can be loaded by UEFI firmware with all necessary components embedded." )] pub struct Args { /// Path to input stub PE image /// /// The stub PE must be a valid UEFI executable that will serve as the base /// for the output image. All sections from the stub will be preserved in /// the output, with new sections appended. #[arg(short, long, value_name = "FILE")] pub stub: PathBuf, /// Path to output stubble image /// /// The resulting stubble image will contain all sections from the stub plus /// any additional sections specified by other arguments. Section offsets /// and headers are automatically recalculated to maintain PE format validity. #[arg(short, long, value_name = "FILE")] pub output: PathBuf, /// Path to linux kernel image to add /// /// Embeds the kernel image in a .linux section for boot loading. /// The kernel must be a PE binary. For Linux kernels, this typically /// means a PE-wrapped bzImage or similar format suitable for UEFI loading. #[arg(short, long, value_name = "FILE")] pub linux: Option, /// Path to initrd image to add /// /// Embeds the initial ramdisk in a .initrd section for boot loading. /// The initrd is loaded into memory by the bootloader before starting the /// kernel, providing an early userspace environment and drivers. #[arg(short, long, value_name = "FILE")] pub initrd: Option, /// Kernel command line to add /// /// Embeds the command line string in a .cmdline section. This specifies /// boot parameters and configuration options passed to the kernel at boot time, /// such as root device, console settings, and kernel features. #[arg(short, long, value_name = "STRING")] pub cmdline: Option, /// Add .sbat section with SBAT data from the given file /// /// SBAT (UEFI Secure Boot Advanced Targeting) metadata for revocation support. /// This section contains versioning information used by UEFI Secure Boot to /// enable fine-grained revocation of vulnerable bootloader components without /// requiring full certificate revocation. #[arg(long, value_name = "FILE")] pub sbat: Option, /// HWIDs directory to scan for JSON files /// /// Scans the directory recursively for HWID JSON files and generates a /// .hwids section containing CHID-to-compatible mappings. These mappings /// are used for automatic device tree selection based on hardware /// identification (SMBIOS/EDID), allowing a single stubble image to support /// multiple hardware platforms. #[arg(long, value_name = "DIR")] pub hwids: Option, /// Device tree blobs to add for automatic loading /// /// Each DTB is embedded in a separate .dtbauto section for automatic loading /// based on hardware detection. Multiple DTBs can be specified by repeating /// this argument. The stubble image uses HWID mappings to select the appropriate /// DTB for the current hardware platform at boot time. #[arg(long, value_name = "FILE")] pub dtbauto: Vec, /// Post-process a lace-stubble PE binary for systemd-ukify compatibility /// /// systemd-ukify works with lace-stubble, but unlike pewrap, systemd-ukify does not /// have the ability to relayout the raw layout of a PE image, and as a result the /// maximum number of sections it can handle is limited to how many fit before the /// original SizeOfHeaders value. /// /// pewrap can relayout the raw layout of the image, which gives it the ability to /// add as many sections as able to fit before the VirtualAddress of the first section. /// /// This option instructs pewrap to relayout the image by setting SizeOfHeaders /// to as large as possible, maximizing the number of sections that can be added by /// systemd-ukify later on. /// /// Additionally it sets the PE major version to 1, which is also required by ukify, /// otherwise it will never indicate support for LoadFile2. #[arg(long)] pub post_process_for_ukify: bool, } lace-0.1.0/tools/pewrap/src/lib.rs000066400000000000000000000001551514263214500167610ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. pub mod cli; lace-0.1.0/tools/pewrap/src/main.rs000066400000000000000000000430321514263214500171400ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. // Authors: Mate Kukri use clap::Parser; use lace_util::chid_mapping::*; use lace_util::peimage::*; use lace_util::*; use pewrap::cli::Args; use serde::{Deserialize, Serialize}; use std::{ collections::VecDeque, fmt::Display, fs::DirEntry, io, mem::offset_of, path::Path, process, }; use zerocopy::IntoBytes; fn main() { let args = Args::parse(); // Parse stub PE image let data = match std::fs::read(&args.stub) { Ok(x) => x, Err(e) => { eprintln!("{}: {}", args.stub.display(), e); process::exit(1); } }; let (_pe, mut bld) = match parse_pe(&data).and_then(|pe| { let bld = PeRebuilder::from_ref(&pe)?; Ok((pe, bld)) }) { Ok(x) => x, Err(e) => { eprintln!("{}: {}", args.stub.display(), e); process::exit(1); } }; /* println!("{:#x?}", pe.dos_hdr); println!("{:#x?}", pe.nt_hdrs); println!("PE Sections"); for sect in pe.sect_hdrs.iter() { println!( " {:8} Raw data {:08x} raw size {:08x} VA {:08x} Virt size {:08x} Characteristics {:8x}", str::from_utf8(sect.name()).unwrap(), sect.pointer_to_raw_data, sect.size_of_raw_data, sect.virtual_address, sect.virtual_size, sect.characteristics ); } */ // Add sections from files let mut file_sections = vec![ (".linux", args.linux), (".initrd", args.initrd), (".sbat", args.sbat), ]; for dtb_path in args.dtbauto.iter() { file_sections.push((".dtbauto", Some(dtb_path.clone()))); } for (name, path) in file_sections.iter() { let Some(path) = path else { continue; }; let d = match std::fs::read(path) { Ok(d) => d, Err(e) => { eprintln!("{}: {}", path.display(), e); process::exit(1); } }; // Section specific checks match *name { ".linux" => { // Validate Linux kernel PE match lace_util::peimage::parse_pe(&d) { Ok(pe) => { // Check for LoadFile2 initrd support if pe.nt_hdrs.optional_header.major_image_version < 1 { eprintln!( "{}: Linux kernel PE image does not support LoadFile2 initrd", path.display() ); process::exit(1); } // Set stubble PE major version to 1 to indicate LoadFile2 initrd support bld.nt_hdrs.optional_header.major_image_version = 1; // Set stubble NX_COMPAT based on kernel NX_COMPAT let kernel_nx_compat = (pe.nt_hdrs.optional_header.dll_characteristics & peimage::DLLCHARACTERISTICS_NX_COMPAT) != 0; if kernel_nx_compat { bld.nt_hdrs.optional_header.dll_characteristics |= peimage::DLLCHARACTERISTICS_NX_COMPAT; } else { bld.nt_hdrs.optional_header.dll_characteristics &= !peimage::DLLCHARACTERISTICS_NX_COMPAT; } } Err(e) => { eprintln!("{}: invalid Linux kernel PE image: {}", path.display(), e); process::exit(1); } } } ".dtbauto" => { // Validate DTB files using the fdt crate if let Err(e) = fdt::Fdt::new(&d) { eprintln!("{}: invalid device tree blob: {}", path.display(), e); process::exit(1); } } _ => {} } bld.add_section(name, d, SCN_CNT_INITIALIZED_DATA | SCN_MEM_READ); } // Add sections from command line for (name, data) in [(".cmdline", args.cmdline)] { let Some(data) = data else { continue; }; bld.add_section( name, data.into_bytes(), SCN_CNT_INITIALIZED_DATA | SCN_MEM_READ, ); } // Add section from HWIDs if let Some(hwids_dir) = args.hwids { // Read HWID JSON files let hwid_jsons = match read_hwids_dir(&hwids_dir) { Ok(x) => x, Err(e) => { eprintln!("{}: {}", hwids_dir.display(), e); process::exit(1); } }; // Generate CHID mappings let mut chid_mappings = Vec::new(); for hwid_json in hwid_jsons.iter() { if let Err(e) = hwid_json.generate_chid_mappings(&mut chid_mappings) { eprintln!("{}: {}", hwids_dir.display(), e); process::exit(1); } } // Serialize CHID mappings let mut hwids_section_data = Vec::new(); if let Err(e) = serialize_chid_mappings(&mut hwids_section_data, &chid_mappings) { eprintln!("{}: {}", hwids_dir.display(), e); process::exit(1); } // Add HWIDs section bld.add_section( ".hwids", hwids_section_data, SCN_CNT_INITIALIZED_DATA | SCN_MEM_READ, ); } // If we are called with --post-process-for-ukify, set PE major version to 1 for LoadFile2 // We set this above only if the Linux kernel supports it, but ukify never sets it itself, // so we need to set it here unconditionally. if args.post_process_for_ukify { bld.nt_hdrs.optional_header.major_image_version = 1; } // Calculate section offsets if let Err(e) = bld.fixup_offsets(args.post_process_for_ukify) { eprintln!("{}: {}", args.output.display(), e); process::exit(1); } // Write output file if let Err(e) = std::fs::File::create(&args.output).map(|x| bld.write_pe(x)) { eprintln!("{}: {}", args.output.display(), e); process::exit(1); } } /// Representation of the JSON HWID file #[derive(Debug, Serialize, Deserialize)] struct HwidJson { #[serde(rename = "type")] type_: String, name: Option, compatible: Option, fwid: Option, hwids: Vec, } /// Errors that can occur when generating CHID mappings from HWID JSON #[derive(Clone, Debug)] enum GenerateChidMappingsError { UnknownType(String), GuidParseError(GuidParseError), } impl From for GenerateChidMappingsError { fn from(e: GuidParseError) -> Self { GenerateChidMappingsError::GuidParseError(e) } } impl Display for GenerateChidMappingsError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { GenerateChidMappingsError::UnknownType(t) => write!(f, "unknown HWID type: {}", t), GenerateChidMappingsError::GuidParseError(e) => e.fmt(f), } } } impl HwidJson { fn generate_chid_mappings<'s>( &'s self, v: &mut Vec>, ) -> Result<(), GenerateChidMappingsError> { for hwid in self.hwids.iter() { let guid = Guid::try_from_str(hwid)?; match self.type_.as_str() { "devicetree" => { v.push(ChidMapping::DeviceTree { chid: guid, name: self.name.as_deref(), compatible: self.compatible.as_deref(), }); } "uefi-fw" => { v.push(ChidMapping::UefiFw { chid: guid, name: self.name.as_deref(), fwid: self.fwid.as_deref(), }); } _type => { return Err(GenerateChidMappingsError::UnknownType(_type.to_owned())); } } } Ok(()) } } /// Read all HWIDs from JSON files in the given directory and its subdirectories fn read_hwids_dir(path: &Path) -> io::Result> { let mut hwids = Vec::new(); for entry in DirWalker::new(path)? { let entry = entry?; if entry.path().is_file() && entry.path().extension().and_then(|s| s.to_str()) == Some("json") { let file = std::fs::File::open(entry.path())?; hwids.push(serde_json::from_reader(file)?); } } Ok(hwids) } /// Recursive directory tree iterator struct DirWalker { queue: VecDeque, } impl DirWalker { fn new(path: &Path) -> io::Result { let mut queue = VecDeque::new(); for entry in std::fs::read_dir(path)? { queue.push_back(entry?); } Ok(DirWalker { queue }) } } impl Iterator for DirWalker { type Item = io::Result; fn next(&mut self) -> Option { self.queue.pop_front().map(|entry| { if entry.path().is_dir() { for entry in std::fs::read_dir(entry.path())? { self.queue.push_back(entry?); } } Ok(entry) }) } } struct PeRebuilder<'s> { dos_hdr: DosHeader, dos_data: &'s [u8], nt_hdrs: NtHeaders64, nt_data: &'s [u8], sections: Vec<(SectionHeader, Vec)>, } #[derive(Clone, Copy, Debug)] enum PeRebuildError { HeadersTooLarge, } impl Display for PeRebuildError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { PeRebuildError::HeadersTooLarge => write!(f, "PE headers exceed maximum allowed size"), } } } impl<'s> PeRebuilder<'s> { fn from_ref(r: &PeRef<'s>) -> Result { let mut sections = Vec::new(); for result in r.raw_sections() { let (shdr, data) = result?; sections.push((shdr, data.to_owned())); } Ok(PeRebuilder { dos_hdr: r.dos_hdr.clone(), dos_data: r.dos_data, nt_hdrs: r.nt_hdrs.clone(), nt_data: r.nt_data, sections, }) } fn add_section(&mut self, name: &str, data: Vec, characteristics: u32) { // Truncate section namearr to 8 bytes and pad with 0s let mut namearr = [0u8; 8]; let namelen = std::cmp::min(namearr.len(), name.len()); namearr[..namelen].copy_from_slice(&name.as_bytes()[..namelen]); // Figure out the first available VA we can freely put a section of any length let first_avail_va = self .sections .iter() .map(|(shdr, _)| shdr.virtual_address + shdr.virtual_size) .max() .unwrap_or(self.nt_hdrs.optional_header.size_of_headers); // Build section header let shdr = SectionHeader { name: namearr, // Virtual size is not aligned as per PE spec, // and the PE loader is expected to handle that virtual_size: data.len() as u32, // Virtual address is aligned as per PE spec virtual_address: align_up!( first_avail_va, self.nt_hdrs.optional_header.section_alignment, ), // Counter-intuitively, raw size is aligned as per PE spec size_of_raw_data: align_up!( data.len() as u32, self.nt_hdrs.optional_header.file_alignment, ), // This will be filled in later when building the final image pointer_to_raw_data: 0, // These are only relevant for object files pointer_to_relocations: 0, pointer_to_linenumbers: 0, number_of_relocations: 0, number_of_linenumbers: 0, // Characteristics as specified characteristics, }; self.sections.push((shdr, data)); } fn fixup_offsets(&mut self, maximize_header_space: bool) -> Result<(), PeRebuildError> { self.nt_hdrs.file_header.number_of_sections = self.sections.len() as u16; self.nt_hdrs.optional_header.size_of_code = 0; self.nt_hdrs.optional_header.size_of_initialized_data = 0; self.nt_hdrs.optional_header.size_of_uninitialized_data = 0; let mut unaligned_size_of_headers = self.dos_hdr.e_lfanew + offset_of!(NtHeaders64, optional_header) as u32 + self.nt_hdrs.file_header.size_of_optional_header as u32 + self.nt_hdrs.file_header.number_of_sections as u32 * size_of::() as u32; if maximize_header_space { // Increase SizeOfHeaders to maximum possible to allow adding more sections later let min_section_virtual_address = self .sections .iter() .map(|(shdr, _)| shdr.virtual_address) .min() .unwrap_or(unaligned_size_of_headers); if min_section_virtual_address > unaligned_size_of_headers { // Setting this unaligned value to the clearly section aligned VA is fine, // because section alignment is a multiple of file alignment, and the below // align_up! calls will fix do nothing. unaligned_size_of_headers = min_section_virtual_address; } } // Loaded image size starts with the size of headers rounded to section alignment self.nt_hdrs.optional_header.size_of_image = align_up!( unaligned_size_of_headers, self.nt_hdrs.optional_header.section_alignment ); // PE spec says size of headers is rounded to the file alignment self.nt_hdrs.optional_header.size_of_headers = align_up!( unaligned_size_of_headers, self.nt_hdrs.optional_header.file_alignment ); let mut off = self.nt_hdrs.optional_header.size_of_headers; for (shdr, _) in self.sections.iter_mut() { // See if the headers fit before the virtual address of any section. // Unfortunately this is an unfixable necessity because the PE images we // operate on only have base relocations which means we cannot move the // first section to start further from the image base in virtual memory. // (Base relocations only allow rebasing the entire image.) // Thankfully section alignment is at least 4K in real PEs, and // the size of the headers is usually around 500 bytes at most, so we are // not going to run out of space unless we add a crazy number of new sections. if self.nt_hdrs.optional_header.size_of_headers > shdr.virtual_address { return Err(PeRebuildError::HeadersTooLarge); } // Unlike in virtual space, we can move everything around in file space, // so we do not care about there being enough space in the file after the // headers to add additionally section headers, instead we dynamically recalculate // all raw data offsets, and re-write the whole file. shdr.pointer_to_raw_data = off; // For sections we added, this is already aligned, but the PE spec // mandates this being aligned for all sections, so let's just fix up // after bad linkers too. shdr.size_of_raw_data = align_up!( shdr.size_of_raw_data, self.nt_hdrs.optional_header.file_alignment ); off += shdr.size_of_raw_data; // Update the various size fields in the optional header if (shdr.characteristics & SCN_CNT_CODE) > 0 { self.nt_hdrs.optional_header.size_of_code += shdr.size_of_raw_data; } if (shdr.characteristics & SCN_CNT_INITIALIZED_DATA) > 0 { self.nt_hdrs.optional_header.size_of_initialized_data += shdr.size_of_raw_data; } if (shdr.characteristics & SCN_CNT_UNINITIALIZED_DATA) > 0 { self.nt_hdrs.optional_header.size_of_uninitialized_data += shdr.size_of_raw_data; } self.nt_hdrs.optional_header.size_of_image += align_up!( shdr.virtual_size, self.nt_hdrs.optional_header.section_alignment ); } Ok(()) } fn write_pe(&self, mut w: W) -> io::Result<()> { let mut off = 0; // Write headers off += w.write(self.dos_hdr.as_bytes())?; off += w.write(self.dos_data)?; off += w.write(self.nt_hdrs.as_bytes())?; off += w.write(self.nt_data)?; for (shdr, _) in self.sections.iter() { off += w.write(shdr.as_bytes())?; } // Pad headers off += write_zeros( &mut w, self.nt_hdrs.optional_header.size_of_headers as usize - off, )?; for (shdr, sdata) in self.sections.iter() { assert_eq!(shdr.pointer_to_raw_data as usize, off); // Write section off += w.write(sdata)?; // Pad section off += write_zeros(&mut w, shdr.size_of_raw_data as usize - sdata.len())?; } Ok(()) } } fn write_zeros(mut w: W, n: usize) -> io::Result { let mut cnt = 0; for _ in 0..n { cnt += w.write(&[0])?; } Ok(cnt) } lace-0.1.0/tools/xtask/000077500000000000000000000000001514263214500147115ustar00rootroot00000000000000lace-0.1.0/tools/xtask/Cargo.toml000066400000000000000000000005621514263214500166440ustar00rootroot00000000000000# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only [package] name = "xtask" version = "0.1.0" edition = "2024" license = "GPL-2.0-only OR GPL-3.0-only" [dependencies] clap = { version = "4.5.57", features = ["derive"] } clap_mangen = "0.2" # Tool dependencies for generating man pages pewrap = { path = "../pewrap" } collect-hwids = { path = "../collect-hwids" } lace-0.1.0/tools/xtask/README.md000066400000000000000000000021661514263214500161750ustar00rootroot00000000000000# xtask Build automation tasks for the lace project. ## Usage Run xtask tasks with: ```none cargo run -p xtask -- ``` ## Available commands ### `mangen` Generate manual pages for all tools that have CLI interfaces. ```none cargo run -p xtask -- mangen ``` This generates man pages in the `man/` directory at the repository root: - `man/pewrap.1` - Man page for pewrap - `man/collect-hwids.1` - Man page for collect-hwids By default, man pages are written to `./man`. To specify a different output directory, use: ```none cargo run -p xtask -- mangen --output-dir /path/to/output ``` To view the generated man pages, use the `man` command: ```none man ./man/pewrap.1 man ./man/collect-hwids.1 ``` ## Adding new tools To add man page generation for a new tool: 1. Ensure the tool uses `clap` with the `derive` feature. 2. Extract the CLI argument struct to a separate `cli.rs` module. 3. Create a `lib.rs` that re-exports the cli module: `pub mod cli;`. 4. Add the tool as a dependency in `tools/xtask/Cargo.toml`. 5. Add man page generation call in `tools/xtask/src/main.rs`. See pewrap or collect-hwids for examples. lace-0.1.0/tools/xtask/src/000077500000000000000000000000001514263214500155005ustar00rootroot00000000000000lace-0.1.0/tools/xtask/src/main.rs000066400000000000000000000033071514263214500167750ustar00rootroot00000000000000// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only // Copyright (C) 2025, Canonical Ltd. use clap::Parser; use std::path::{Path, PathBuf}; #[derive(Parser, Debug)] #[command(version, about = "Build automation tasks for lace")] enum Xtask { /// Generate man pages for all tools Mangen { /// Output directory for man pages (defaults to ./man) #[arg(short, long, default_value = "man")] output_dir: PathBuf, }, } fn main() { let args = Xtask::parse(); match args { Xtask::Mangen { output_dir } => { if let Err(e) = generate_man_pages(&output_dir) { eprintln!("Error generating man pages: {}", e); std::process::exit(1); } } } } fn generate_man_pages(output_dir: &Path) -> std::io::Result<()> { std::fs::create_dir_all(output_dir)?; // Generate man page for pewrap let pewrap_cmd = ::command(); generate_man_page(&pewrap_cmd, "pewrap", output_dir)?; // Generate man page for collect-hwids let collect_hwids_cmd = ::command(); generate_man_page(&collect_hwids_cmd, "collect-hwids", output_dir)?; println!("Man pages generated in: {}", output_dir.display()); Ok(()) } fn generate_man_page(cmd: &clap::Command, name: &str, output_dir: &Path) -> std::io::Result<()> { let man = clap_mangen::Man::new(cmd.clone()); let mut buffer = Vec::new(); man.render(&mut buffer).map_err(std::io::Error::other)?; let man_path = output_dir.join(format!("{}.1", name)); std::fs::write(&man_path, buffer)?; println!(" Generated: {}", man_path.display()); Ok(()) }