File tree 4 files changed +19
-6
lines changed
4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ kbuild = "build --target x86_64-custom.json -Zbuild-std=core -Zbuild-std-feature
6
6
kimage = " run --target x86_64-custom.json -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem -- --no-run"
7
7
krun = " run --target x86_64-custom.json -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem"
8
8
ktest = " xtest --target x86_64-custom.json"
9
- xtask = " run -p xtask --release -- "
9
+ xtask = " run -p xtask --"
10
10
image = " xtask image"
Original file line number Diff line number Diff line change @@ -21,8 +21,9 @@ members = [
21
21
" xtask" ,
22
22
]
23
23
24
- # the profile used for `cargo build`
25
- [profile .dev ]
24
+ # the profile used for debug build of `td-shim` and `td-payload`
25
+ [profile .dev-opt ]
26
+ inherits = " dev"
26
27
panic = " abort" # disable stack unwinding on panic
27
28
opt-level = " z"
28
29
lto = true
Original file line number Diff line number Diff line change @@ -138,6 +138,13 @@ cargo xbuild -p td-payload --target x86_64-unknown-none --release --bin example
138
138
cargo run -p td-shim-tools --bin td-shim-ld -- target/x86_64-unknown-none/release/ResetVector.bin target/x86_64-unknown-none/release/td-shim -t executable -p target/x86_64-unknown-none/release/example -o target/release/final-elf.bin
139
139
```
140
140
141
+ To build the debug TdShim, please use ` dev-opt ` profile to build ` td-shim ` binary. For example:
142
+
143
+ ```
144
+ cargo xbuild -p td-shim --target x86_64-unknown-none --profile dev-opt --features=main,tdx
145
+ cargo run -p td-shim-tools --bin td-shim-ld --features=linker -- target/x86_64-unknown-none/dev-opt/ResetVector.bin target/x86_64-unknown-none/dev-opt/td-shim -o target/debug/final.bin
146
+ ```
147
+
141
148
## Run
142
149
REF: https://github.com/tianocore/edk2-staging/tree/TDVF
143
150
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ lazy_static! {
18
18
Path :: new( env!( "CARGO_MANIFEST_DIR" ) ) . parent( ) . unwrap( ) ;
19
19
static ref SHIM_OUTPUT : PathBuf = PROJECT_ROOT . join( "target/x86_64-unknown-none/" ) ;
20
20
static ref IMAGE_OUTPUT : PathBuf = PROJECT_ROOT . join( "target/release/final.bin" ) ;
21
+ static ref IMAGE_OUTPUT_DEBUG : PathBuf = PROJECT_ROOT . join( "target/debug/final.bin" ) ;
21
22
static ref METADATA : PathBuf = PROJECT_ROOT . join( "td-shim-tools/etc/metadata.json" ) ;
22
23
}
23
24
@@ -227,15 +228,15 @@ impl BuildArgs {
227
228
if self . release {
228
229
"release"
229
230
} else {
230
- "dev"
231
+ "dev-opt "
231
232
}
232
233
}
233
234
234
235
fn profile_path ( & self ) -> & str {
235
236
if self . release {
236
237
"release"
237
238
} else {
238
- "debug "
239
+ "dev-opt "
239
240
}
240
241
}
241
242
@@ -255,7 +256,11 @@ impl BuildArgs {
255
256
}
256
257
257
258
fn output ( & self ) -> Result < PathBuf > {
258
- let path = self . output . as_ref ( ) . unwrap_or ( & IMAGE_OUTPUT ) ;
259
+ let path = self . output . as_ref ( ) . unwrap_or ( if self . release {
260
+ & IMAGE_OUTPUT
261
+ } else {
262
+ & IMAGE_OUTPUT_DEBUG
263
+ } ) ;
259
264
260
265
// Get the absolute path of the target file
261
266
let absolute = if path. is_absolute ( ) {
You can’t perform that action at this time.
0 commit comments