Make the rust compiler instsallable via rustup even though it's not in the vm 
yet.
This avoids rust compile errors on emulated CPUs,
rustup installs for host cpu kernel architecture instead of VM architecture.

Signed-off-by: jpsollie <janpieter.sol...@edpnet.be>
---
 lib/common.sh | 4 ++++
 root_image    | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/common.sh b/lib/common.sh
index 5e24169..7aadfaa 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -87,6 +87,7 @@ parse_arch()
            ktest_arch=x86
            DEBIAN_ARCH=i386
            ARCH_TRIPLE=${ARCH_TRIPLE_X86}
+           RUST_TRIPLE=i686-unknown-linux-gnu
 
            KERNEL_ARCH=x86
            BITS=32
@@ -98,6 +99,7 @@ parse_arch()
            ktest_arch=x86_64
            DEBIAN_ARCH=amd64
            ARCH_TRIPLE=${ARCH_TRIPLE_X86_64}
+           RUST_TRIPLE=x86_64-unknown-linux-gnu
 
            KERNEL_ARCH=x86
            BITS=64
@@ -109,6 +111,7 @@ parse_arch()
            ktest_arch=aarch64
            DEBIAN_ARCH=arm64
            ARCH_TRIPLE=${ARCH_TRIPLE_ARM64}
+           RUST_TRIPLE=aarch64-unknown-linux-gnu
 
            KERNEL_ARCH=arm64
            BITS=64
@@ -120,6 +123,7 @@ parse_arch()
            ktest_arch=arm
            DEBIAN_ARCH=armhf
            ARCH_TRIPLE=${ARCH_TRIPLE_ARMV7}
+           RUST_TRIPLE=armv7-unknown-linux-gnueabihf
 
            KERNEL_ARCH=arm
            BITS=32
diff --git a/root_image b/root_image
index 19eebae..4416132 100755
--- a/root_image
+++ b/root_image
@@ -241,7 +241,7 @@ update_packages()
     curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > 
"$MNT"/tmp/rustup.sh
     chmod 755 "$MNT"/tmp/rustup.sh
 
-    _chroot "$MNT" /tmp/rustup.sh -y
+    _chroot "$MNT" /tmp/rustup.sh --default-host $RUST_TRIPLE -y
     echo 'export PATH="$HOME/.cargo/bin:$PATH"' > $MNT/etc/profile.d/rustup.sh
 }
 
-- 
2.42.1


Reply via email to