From 0187bf1e6ebff16783377cabd810c1d885b97cae Mon Sep 17 00:00:00 2001 From: Noa Himesaka Date: Thu, 30 Oct 2025 13:22:42 +0900 Subject: [PATCH 1/2] fix: rust fix for aarch64 --- rust/Dockerfile | 3 +++ rust/config | 10 +++++++--- toolchain/Dockerfile | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/rust/Dockerfile b/rust/Dockerfile index a7f396b..8e13490 100644 --- a/rust/Dockerfile +++ b/rust/Dockerfile @@ -12,5 +12,8 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -q \ # Add rust binaries to PATH ENV PATH="$PATH:/root/.cargo/bin" +# Set default build target to armv7 +ENV CARGO_BUILD_TARGET="armv7-unknown-linux-gnueabihf" + # Target reMarkable architecture by default COPY config /root/.cargo/config diff --git a/rust/config b/rust/config index 7a74532..0f1c929 100644 --- a/rust/config +++ b/rust/config @@ -1,6 +1,3 @@ -[build] -target = "armv7-unknown-linux-gnueabihf" - [target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc" rustflags = [ @@ -10,3 +7,10 @@ rustflags = [ "-C", "link-arg=-mfloat-abi=hard", "-C", "link-arg=-mcpu=cortex-a9", ] + +[target.aarch64-unknown-linux-gnu] +linker = "aarch64-remarkable-linux-gnu-gcc" +rustflags = [ + "-C", "link-arg=-march=armv8-a+crc+crypto", + "-C", "link-arg=-mtune=cortex-a53", +] diff --git a/toolchain/Dockerfile b/toolchain/Dockerfile index 4b6583f..10d7469 100644 --- a/toolchain/Dockerfile +++ b/toolchain/Dockerfile @@ -168,12 +168,13 @@ RUN touch /opt/x-tools/switch-aarch64.sh && chmod +x /opt/x-tools/switch-aarch64 export ARCH=aarch64 export CHOST="$CHOST_AARCH64" export CROSS_COMPILE="$CHOST_AARCH64-" -export PATH="$PATH:/opt/x-tools/$NGCONFIG_AARCH64/bin" +export PATH="\$PATH:/opt/x-tools/$NGCONFIG_AARCH64/bin" export PKG_CONFIG_LIBDIR="/opt/x-tools/$NGCONFIG_AARCH64/$NGCONFIG_AARCH64/sysroot/usr/lib/pkgconfig:/opt/x-tools/$NGCONFIG_AARCH64/$NGCONFIG_AARCH64/sysroot/lib/pkgconfig:/opt/x-tools/$NGCONFIG_AARCH64/$NGCONFIG_AARCH64/sysroot/opt/lib/pkgconfig" export PKG_CONFIG_SYSROOT_DIR="/opt/x-tools/$NGCONFIG_AARCH64/$NGCONFIG_AARCH64/sysroot" export SYSROOT="/opt/x-tools/$NGCONFIG_AARCH64/$NGCONFIG_AARCH64/sysroot" export NGCONFIG="$NGCONFIG_AARCH64" export TARGET_PREFIX="$CHOST_AARCH64" +export CARGO_BUILD_TARGET="aarch64-unknown-linux-gnu" EOF # Configure Opkg From aac0bf4373778df0500a679bdb52a344e388e18b Mon Sep 17 00:00:00 2001 From: Noa Himesaka Date: Thu, 30 Oct 2025 13:27:44 +0900 Subject: [PATCH 2/2] fix: revert target change when sourcing switch-arm --- rust/config | 2 +- toolchain/Dockerfile | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rust/config b/rust/config index 0f1c929..2cda382 100644 --- a/rust/config +++ b/rust/config @@ -12,5 +12,5 @@ rustflags = [ linker = "aarch64-remarkable-linux-gnu-gcc" rustflags = [ "-C", "link-arg=-march=armv8-a+crc+crypto", - "-C", "link-arg=-mtune=cortex-a53", + "-C", "link-arg=-mtune=cortex-a53", ] diff --git a/toolchain/Dockerfile b/toolchain/Dockerfile index 10d7469..145e6fe 100644 --- a/toolchain/Dockerfile +++ b/toolchain/Dockerfile @@ -159,9 +159,10 @@ export CHOST="$CHOST" export CROSS_COMPILE="$CHOST-" export PKG_CONFIG_LIBDIR="/opt/x-tools/$NGCONFIG/$NGCONFIG/sysroot/usr/lib/pkgconfig:/opt/x-tools/$NGCONFIG/$NGCONFIG/sysroot/lib/pkgconfig:/opt/x-tools/$NGCONFIG/$NGCONFIG/sysroot/opt/lib/pkgconfig" export PKG_CONFIG_SYSROOT_DIR="/opt/x-tools/$NGCONFIG/$NGCONFIG/sysroot" -SYSROOT="/opt/x-tools/$NGCONFIG/$NGCONFIG/sysroot" -NGCONFIG="$NGCONFIG" +export SYSROOT="/opt/x-tools/$NGCONFIG/$NGCONFIG/sysroot" +export NGCONFIG="$NGCONFIG" export TARGET_PREFIX="$CHOST" +export CARGO_BUILD_TARGET="armv7-unknown-linux-gnueabihf" EOF RUN touch /opt/x-tools/switch-aarch64.sh && chmod +x /opt/x-tools/switch-aarch64.sh && cat < /opt/x-tools/switch-aarch64.sh