@@ -7,23 +7,41 @@ SELF="$ROOT/os/mkosi"
77source " $SELF /versions.env"
88BUILD_DIR=${1:? build directory required}
99STAGE=${2:? rootfs staging tree required}
10- src=" $BUILD_DIR /attestation-sdk"
11- build=" $BUILD_DIR /build"
10+ BUILD_DIR=$( realpath -m " $BUILD_DIR " )
11+ STAGE=$( realpath -m " $STAGE " )
12+ checkout=" $BUILD_DIR /attestation-sdk"
13+ # Cargo includes the literal RUSTFLAGS in crate disambiguators. A prefix-map
14+ # containing work-a/work-b would therefore change Rust symbol hashes even
15+ # though the mapped paths are equal. Serialize this component in a stable,
16+ # clean pathname and keep the per-build checkout as the verified input.
17+ canonical=/var/tmp/dstack-mkosi-nvattest
18+ exec 9> " $canonical .lock"
19+ flock 9
20+ src=" $canonical /attestation-sdk"
21+ build=" $canonical /build"
1222
13- if [[ ! -d $src /.git ]]; then
23+ if [[ ! -d $checkout /.git ]]; then
1424 mkdir -p " $BUILD_DIR "
15- git init -q " $src "
16- git -C " $src " remote add origin https://github.com/NVIDIA/attestation-sdk.git
25+ git init -q " $checkout "
26+ git -C " $checkout " remote add origin https://github.com/NVIDIA/attestation-sdk.git
1727fi
18- git -C " $src " fetch -q --depth=1 origin " $NVATTEST_REVISION "
19- git -C " $src " checkout -q --detach FETCH_HEAD
20- git -C " $src " reset -q --hard " $NVATTEST_REVISION "
28+ git -C " $checkout " fetch -q --depth=1 origin " $NVATTEST_REVISION "
29+ git -C " $checkout " checkout -q --detach FETCH_HEAD
30+ git -C " $checkout " reset -q --hard " $NVATTEST_REVISION "
31+ git -C " $checkout " clean -qfdx
32+ rm -rf " $canonical "
33+ mkdir -p " $canonical "
34+ cp -a " $checkout " " $src "
2135patch -d " $src " -p1 --fuzz=0 < \
2236 " $ROOT /os/yocto/layers/meta-nvidia/recipes-graphics/nvattest/files/0001-validate-ocsp-response-freshness.patch"
2337patch -d " $src " -p1 --fuzz=0 < \
2438 " $SELF /patches/nvattest/0001-pin-fetchcontent-inputs.patch"
2539
2640rm -rf " $build "
41+ export CFLAGS=" ${CFLAGS:- } -O2 -g0 -ffile-prefix-map=$canonical =/usr/src/nvattest -fmacro-prefix-map=$canonical =/usr/src/nvattest"
42+ export CXXFLAGS=" ${CXXFLAGS:- } -O2 -g0 -ffile-prefix-map=$canonical =/usr/src/nvattest -fmacro-prefix-map=$canonical =/usr/src/nvattest"
43+ export CARGO_INCREMENTAL=0
44+ export RUSTFLAGS=" --remap-path-prefix=$canonical =/usr/src/nvattest -C strip=debuginfo"
2745cmake -S " $src /nv-attestation-cli" -B " $build " -G Ninja \
2846 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \
2947 -DNVAT_BUILD_TESTS=OFF -DNVAT_BUILD_SAMPLES=OFF \
@@ -32,8 +50,6 @@ cmake -S "$src/nv-attestation-cli" -B "$build" -G Ninja \
3250install -m0644 \
3351 " $ROOT /os/yocto/layers/meta-nvidia/recipes-graphics/nvattest/files/regorus-ffi-Cargo.lock" \
3452 " $build /_deps/regorus-src/bindings/ffi/Cargo.lock"
35- export CARGO_INCREMENTAL=0
36- export RUSTFLAGS=" --remap-path-prefix=$BUILD_DIR =/usr/src/nvattest -C strip=debuginfo"
3753cmake --build " $build " -j" ${JOBS:- $(nproc)} "
3854cmp " $ROOT /os/yocto/layers/meta-nvidia/recipes-graphics/nvattest/files/regorus-ffi-Cargo.lock" \
3955 " $build /_deps/regorus-src/bindings/ffi/Cargo.lock"
0 commit comments