-
Notifications
You must be signed in to change notification settings - Fork 106
[RTE-710] elf2uki converter CLI tool #862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tvsfx
wants to merge
19
commits into
master
Choose a base branch
from
thomasvs/RTE-710-elf2uki
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,458
−27
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d846483
fortanix-vme/tools/elf2uki skeleton
tvsfx 287dbc4
init.c changes
tvsfx adffc83
Generate `init` executable
tvsfx 0500b3e
doc: TODOs in elf2uki
tvsfx e66eaaa
doc: invocation example
tvsfx 8b960b0
vendor linux kernel
tvsfx 9dba95a
add build.rs to compile init.c
tvsfx 79010d5
stop vendoring ukify
tvsfx 77b5635
improve: expect `ukify` in path, use fallback kernel
tvsfx 65c35a9
use separate `BLOB`s file
tvsfx 629ba9f
fix: cargo clippy
tvsfx 51606cf
feat: confidential-vm-blobs crate
tvsfx 083dd4a
feat(elf2uki): use new blobs create to stub out efi boot stub
tvsfx b28d60b
move `MaybeVendoredImage` util into vendored crate
tvsfx 0b285d0
Use defaults for crate authors and version in clap
tvsfx a614a5b
improve(elf2uki): use doc comments instead of explicit 'help'
tvsfx abb8fdf
doc(confidential-vm-blobs): init.c diff in README.md
tvsfx 8503529
fix(el2fuki): typo
tvsfx b12d486
example(elf2uki): add example to CI
tvsfx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| **/.cargo/* | ||
| !**/.cargo/config | ||
| !**/.cargo/config.toml | ||
| **/Cargo.lock | ||
| /target | ||
| target/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| source_dir=$(dirname "${BASH_SOURCE[0]}") | ||
| app_dir="$source_dir/hello_world" | ||
|
|
||
| pushd "$app_dir" | ||
| #builds statically linked bin for `musl` | ||
| cargo -q build --release | ||
| popd | ||
|
|
||
| # build UKI and write it to `/dev/null` | ||
| cargo -q run -p elf2uki -- \ | ||
| --app "$app_dir/target/x86_64-unknown-linux-musl/release/hello_world" \ | ||
| --cmdline "console=ttyS0 earlyprintk=serial" \ | ||
| --output /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [build] | ||
| target = "x86_64-unknown-linux-musl" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [package] | ||
| name = "hello_world" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
|
|
||
| [dependencies] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| fn main() { | ||
| println!("Hello, world!"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [package] | ||
| name = "confidential-vm-blobs" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
|
|
||
| [dependencies] | ||
| anyhow = "1.0.100" | ||
| tempfile = "3" |
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <!-- TODO (RTE-739, RTE-728): clean up setup --> | ||
| # Blobs | ||
|
|
||
| These blobs have been vendored from the following locations | ||
|
|
||
| ## init | ||
| Tweaked the code to build the `init` executable from [here](https://github.com/aws/aws-nitro-enclaves-sdk-bootstrap/blob/f718dea60a9d9bb8b8682fd852ad793912f3c5db) and placed it under `build_init/`. | ||
| `build.rs` uses the shell script `build_init/update_init.sh` to place the generated `init` artifact in this folder and keep it up-to-date. | ||
|
|
||
| Changes made are as follows: | ||
| 1. Remove function `init_nsm_driver`: initialization of Nitro Secure Module driver | ||
| 2. Remove function `enclave_ready`: sending signal to nitro-cli that the enclave has started | ||
| 3. Remove global vars for above two functions. | ||
|
|
||
| To see the diff: | ||
| ```sh | ||
| diff -c10 <(curl https://raw.githubusercontent.com/aws/aws-nitro-enclaves-sdk-bootstrap/f718dea60a9d9bb8b8682fd852ad793912f3c5db/init/init.c) blobs/build_init/init.c | ||
| ``` | ||
|
|
||
| ## vmlinuz-{version} | ||
| Ubuntu kernel, extracted from noble package `linux-image-{version}`. | ||
|
|
||
| ## OVMF | ||
| Defaults copied from noble installation, taken from `/usr/share/ovmf/OVMF.fd` and `/usr/share/ovmf/OVMF.amdsev.fd` respectively | ||
|
|
||
| ## EFI boot stub | ||
| Defaults copied from noble package `sytemd-boot-efi` version `255.4-1ubuntu8.12`, installed under path `/usr/lib/systemd/boot/efi/linuxx64.efi.stub` by default |
14 changes: 14 additions & 0 deletions
14
fortanix-vme/tools/confidential-vm-blobs/blobs/build_init/Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| FROM nixos/nix:2.21.4 AS build | ||
| ARG TARGET=all | ||
| ENV TARGET=${TARGET} | ||
|
|
||
| RUN mkdir /build | ||
| ADD ./ /build/ | ||
| WORKDIR /build | ||
|
|
||
| RUN nix-build -A ${TARGET} | ||
|
|
||
| FROM scratch AS artifacts | ||
| COPY --from=build /build/result/* /blobs/ | ||
| # Without a CMD we can not create a container from this to extract the content | ||
| CMD ["dummy"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.