Skip to content

Commit 33a4988

Browse files
committed
refactor(simulator): match real provider and colocate unit files
Use provider value tdx_guest like the kernel TSM interface, and keep the systemd unit plus prepare drop-in under the Yocto recipe files/ tree instead of os/common/rootfs.
1 parent 40335d7 commit 33a4988

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

dstack/tee-simulator/src/tdx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::TeeBackend;
1717

1818
const TDX_DEFAULT_MOUNTPOINT: &str = "/sys/kernel/config/tsm/report";
1919
const PROVIDER_NAME: &str = "com.intel.dcap";
20-
const PROVIDER_VALUE: &[u8] = b"tdx_guest_sim\n";
20+
const PROVIDER_VALUE: &[u8] = b"tdx_guest\n";
2121
const DIRECT_IO: u32 = 1;
2222
const TTL: Duration = Duration::ZERO;
2323

os/yocto/layers/meta-dstack/recipes-core/dstack-tee-simulator/dstack-tee-simulator.bb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ inherit systemd
88
DSTACK_MONOREPO_ROOT ?= "${@os.path.realpath(os.path.join(d.getVar('THISDIR'), '../../../../../..'))}"
99
DSTACK_CORE_SRC ?= "${DSTACK_MONOREPO_ROOT}/dstack"
1010
DSTACK_RUST_SDK_SRC ?= "${DSTACK_MONOREPO_ROOT}/sdk/rust"
11-
DSTACK_ROOTFS_SRC ?= "${DSTACK_MONOREPO_ROOT}/os/common/rootfs"
1211

1312
S = "${UNPACKDIR}/repo/dstack"
14-
DSTACK_ROOTFS_FILES = "${UNPACKDIR}/repo/os/common/rootfs"
1513

1614
DEPENDS += "rsync-native"
1715
RDEPENDS:${PN} += "fuse3-utils kernel-module-fuse"
@@ -24,17 +22,16 @@ EXTRA_CARGO_FLAGS = "-p dstack-tee-simulator"
2422
inherit cargo_bin
2523

2624
do_unpack() {
27-
install -d "${S}" "${UNPACKDIR}/repo/sdk/rust" "${DSTACK_ROOTFS_FILES}"
25+
install -d "${S}" "${UNPACKDIR}/repo/sdk/rust"
2826
rsync -a --exclude=".git" --exclude=".worktrees" --exclude="target" \
2927
"${DSTACK_CORE_SRC}/" "${S}/"
3028
rsync -a --exclude=".git" --exclude="target" \
3129
"${DSTACK_RUST_SDK_SRC}/" "${UNPACKDIR}/repo/sdk/rust/"
32-
rsync -a "${DSTACK_ROOTFS_SRC}/" "${DSTACK_ROOTFS_FILES}/"
3330
}
3431

3532
do_unpack[cleandirs] = "${UNPACKDIR}/repo"
3633
do_unpack[nostamp] = "1"
37-
do_unpack[vardeps] += "DSTACK_CORE_SRC DSTACK_RUST_SDK_SRC DSTACK_ROOTFS_SRC"
34+
do_unpack[vardeps] += "DSTACK_CORE_SRC DSTACK_RUST_SDK_SRC"
3835

3936
do_configure() {
4037
cargo_bin_do_configure
@@ -49,15 +46,20 @@ do_compile[network] = "1"
4946
do_install() {
5047
install -d ${D}${bindir} ${D}${systemd_system_unitdir}
5148
install -m 0755 ${CARGO_BINDIR}/dstack-tee-simulator ${D}${bindir}
52-
install -m 0644 ${DSTACK_ROOTFS_FILES}/dstack-tee-simulator.service \
49+
install -m 0644 ${THISDIR}/files/dstack-tee-simulator.service \
5350
${D}${systemd_system_unitdir}
5451

5552
install -d ${D}${sysconfdir}/systemd/system/dstack-prepare.service.d
56-
install -m 0644 \
57-
${DSTACK_ROOTFS_FILES}/dstack-prepare.service.d/tee-simulator.conf \
53+
install -m 0644 ${THISDIR}/files/tee-simulator.conf \
5854
${D}${sysconfdir}/systemd/system/dstack-prepare.service.d/tee-simulator.conf
5955
}
6056

57+
# Unit/drop-in live next to this recipe; include them in task checksums.
58+
do_install[file-checksums] += "\
59+
${THISDIR}/files/dstack-tee-simulator.service:True \
60+
${THISDIR}/files/tee-simulator.conf:True \
61+
"
62+
6163
FILES:${PN} += "${sysconfdir}/systemd/system/dstack-prepare.service.d/tee-simulator.conf"
6264

6365
# Cargo embeds build paths into binaries; allow TMPDIR references.

os/common/rootfs/dstack-tee-simulator.service renamed to os/yocto/layers/meta-dstack/recipes-core/dstack-tee-simulator/files/dstack-tee-simulator.service

File renamed without changes.

os/common/rootfs/dstack-prepare.service.d/tee-simulator.conf renamed to os/yocto/layers/meta-dstack/recipes-core/dstack-tee-simulator/files/tee-simulator.conf

File renamed without changes.

0 commit comments

Comments
 (0)