Skip to content

Commit fd4505d

Browse files
fix: rust fix for aarch64 (#46)
* fix: rust fix for aarch64 * fix: revert target change when sourcing switch-arm
1 parent fc7f66d commit fd4505d

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

rust/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -q \
1212
# Add rust binaries to PATH
1313
ENV PATH="$PATH:/root/.cargo/bin"
1414

15+
# Set default build target to armv7
16+
ENV CARGO_BUILD_TARGET="armv7-unknown-linux-gnueabihf"
17+
1518
# Target reMarkable architecture by default
1619
COPY config /root/.cargo/config

rust/config

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[build]
2-
target = "armv7-unknown-linux-gnueabihf"
3-
41
[target.armv7-unknown-linux-gnueabihf]
52
linker = "arm-linux-gnueabihf-gcc"
63
rustflags = [
@@ -10,3 +7,10 @@ rustflags = [
107
"-C", "link-arg=-mfloat-abi=hard",
118
"-C", "link-arg=-mcpu=cortex-a9",
129
]
10+
11+
[target.aarch64-unknown-linux-gnu]
12+
linker = "aarch64-remarkable-linux-gnu-gcc"
13+
rustflags = [
14+
"-C", "link-arg=-march=armv8-a+crc+crypto",
15+
"-C", "link-arg=-mtune=cortex-a53",
16+
]

toolchain/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,21 +157,23 @@ export CHOST="$CHOST"
157157
export CROSS_COMPILE="$CHOST-"
158158
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"
159159
export PKG_CONFIG_SYSROOT_DIR="/opt/x-tools/$NGCONFIG/$NGCONFIG/sysroot"
160-
SYSROOT="/opt/x-tools/$NGCONFIG/$NGCONFIG/sysroot"
161-
NGCONFIG="$NGCONFIG"
160+
export SYSROOT="/opt/x-tools/$NGCONFIG/$NGCONFIG/sysroot"
161+
export NGCONFIG="$NGCONFIG"
162162
export TARGET_PREFIX="$CHOST"
163+
export CARGO_BUILD_TARGET="armv7-unknown-linux-gnueabihf"
163164
EOF
164165

165166
RUN touch /opt/x-tools/switch-aarch64.sh && chmod +x /opt/x-tools/switch-aarch64.sh && cat <<EOF > /opt/x-tools/switch-aarch64.sh
166167
export ARCH=aarch64
167168
export CHOST="$CHOST_AARCH64"
168169
export CROSS_COMPILE="$CHOST_AARCH64-"
169-
export PATH="$PATH:/opt/x-tools/$NGCONFIG_AARCH64/bin"
170+
export PATH="\$PATH:/opt/x-tools/$NGCONFIG_AARCH64/bin"
170171
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"
171172
export PKG_CONFIG_SYSROOT_DIR="/opt/x-tools/$NGCONFIG_AARCH64/$NGCONFIG_AARCH64/sysroot"
172173
export SYSROOT="/opt/x-tools/$NGCONFIG_AARCH64/$NGCONFIG_AARCH64/sysroot"
173174
export NGCONFIG="$NGCONFIG_AARCH64"
174175
export TARGET_PREFIX="$CHOST_AARCH64"
176+
export CARGO_BUILD_TARGET="aarch64-unknown-linux-gnu"
175177
EOF
176178

177179
# Configure Opkg

0 commit comments

Comments
 (0)