Skip to content

Commit 316d137

Browse files
committed
scripts: Enable aarch64 containerized build
Signed-off-by: Akira Moroo <[email protected]>
1 parent 74c8b71 commit 316d137

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

resources/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ ENV OPENSSL_INCLUDE_DIR=/usr/include/
6363
# Install the rust toolchain
6464
RUN export ARCH="$(uname -m)" \
6565
&& nohup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \
66+
&& rustup target add aarch64-unknown-linux-gnu \
67+
&& rustup target add x86_64-unknown-linux-gnu \
6668
&& rustup component add rustfmt \
6769
&& rustup component add clippy \
6870
&& rustup component add rust-src \

scripts/dev_cli.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ cmd_build() {
227227

228228
process_volumes_args
229229

230+
[ "$(uname -m)" == "aarch64" ] && target="aarch64-unknown-none.json"
231+
[ "$(uname -m)" == "x86_64" ] && target="x86_64-unknown-none.json"
232+
230233
cargo_args=("$@")
231234
[ $build = "release" ] && cargo_args+=("--release")
232235

@@ -240,7 +243,7 @@ cmd_build() {
240243
--volume "$RHF_ROOT_DIR:$CTR_RHF_ROOT_DIR" $exported_volumes \
241244
--env RUSTFLAGS="$rustflags" \
242245
"$CTR_IMAGE" \
243-
cargo build --target "x86_64-unknown-none.json" \
246+
cargo build --target "$target" \
244247
-Zbuild-std=core,alloc \
245248
-Zbuild-std-features=compiler-builtins-mem \
246249
--target-dir "$CTR_RHF_CARGO_TARGET" \
@@ -399,6 +402,7 @@ cmd_build-container() {
399402
mkdir -p $BUILD_DIR
400403
cp $RHF_DOCKERFILE $BUILD_DIR
401404

405+
[ $(uname -m) = "aarch64" ] && TARGETARCH="arm64"
402406
[ $(uname -m) = "x86_64" ] && TARGETARCH="amd64"
403407
RUST_TOOLCHAIN="$(rustup show active-toolchain | cut -d ' ' -f1)"
404408

0 commit comments

Comments
 (0)