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..2cda382 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..145e6fe 100644 --- a/toolchain/Dockerfile +++ b/toolchain/Dockerfile @@ -159,21 +159,23 @@ 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 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