Skip to content

Commit 779a34e

Browse files
BotspotljharbSladyn Nunes
committed
[Fix] nvm_get_arch: Rasbperry Pi: armv7l with arm64 kernel, get correct arch
Co-authored-by: Botspot <[email protected]> Co-authored-by: Jordan Harband <[email protected]> Co-authored-by: Sladyn Nunes <[email protected]>
1 parent 2b5e53f commit 779a34e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

nvm.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,14 @@ nvm_get_arch() {
17961796
aarch64) NVM_ARCH="arm64" ;;
17971797
*) NVM_ARCH="${HOST_ARCH}" ;;
17981798
esac
1799+
1800+
# If running a 64bit ARM kernel but a 32bit ARM userland, change ARCH to 32bit ARM (armv7l)
1801+
L=$(ls -dl /sbin/init) # if /sbin/init is 32bit executable
1802+
if [ "$(uname)" = "Linux" ] && [ "${NVM_ARCH}" = arm64 ] && [ "$(od -An -t x1 -j 4 -N 1 "${L#*-> }")" = ' 01' ]; then
1803+
NVM_ARCH=armv7l
1804+
HOST_ARCH=armv7l
1805+
fi
1806+
17991807
nvm_echo "${NVM_ARCH}"
18001808
}
18011809

test/fast/Unit tests/nvm_get_arch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,6 @@ run_test amd64 smartos x64 no_pkg_info
7979
run_test x86 osx x86
8080
run_test amd64 osx x64
8181

82+
run_test arm64 smartos x64
83+
8284
cleanup

0 commit comments

Comments
 (0)