-
Notifications
You must be signed in to change notification settings - Fork 0
Device Debugging Toolset
You can download prebuilt binary-analysis and debugging tools for the Miyoo Mini+ from the main MMP repository.
| Binary | Version | Linkage | Use Cases |
|---|---|---|---|
addr2line |
binutils 2.32 | dynamic glibc | Map addresses to source lines with DEBUG info. |
nm |
↑ | ↑ | List symbols in binaries and object files. |
objdump |
↑ | ↑ | Disassemble code and inspect relocations. |
readelf |
↑ | ↑ | Inspect ELF headers, sections, and dependencies. |
file |
5.39 | ↑ | Identify file types using MAGIC <magic.mgc>. |
gdb |
8.3.1 | ↑ | Debug programs on the device via GDB. |
gdbserver |
8.3.1 | static | Allows remote debugging of device programs via GDB. |
strace |
5.10 | ↑ | Trace a process's system calls. |
ldd |
Shell script | -- | Show shared library dependencies. |
Note
Dynamically linked binaries use the device's existing glibc loader and libraries; including /lib/ld-linux-armhf.so.3, /lib/libc.so.6; and, where needed, /lib/libdl.so.2 or /lib/libm.so.6.
# SSH connection details for your Miyoo Mini+ will depend on its firmware and your LAN setup:
ipAddress="192.168.1.128"
user="root"
localDirectory="$HOME/binaries"
remoteDirectory="/mnt/SDCARD/.tmp_update/bin"
sshOptions=(
-o StrictHostKeyChecking=accept-new
-o MACs=hmac-sha1
-o IgnoreUnknown=WarnWeakCrypto
-o WarnWeakCrypto=no
)
# Read the SSH password:
read -r -s -p "SSH password: " SSHPASS && printf '\n'
export SSHPASS
# Download the prebuilt binaries to the $localDirectory:
githubRawBaseUrl="https://github.com/Luspin/MMP/raw/refs/heads/main/src/tools/binaries"
binaryFiles=(
addr2line
file
gdb
gdbserver
ldd
magic.mgc
nm
objdump
readelf
strace
)
wgetOptions=(
--continue
--directory-prefix="$localDirectory"
--input-file=-
--no-http-keep-alive
--random-wait
--retry-on-http-error=429,500,502,503,504
--tries=3
--wait=5
--waitretry=10
)
mkdir --parents "$localDirectory"
for binaryFile in "${binaryFiles[@]}"; do
printf '%s/%s\n' "$githubRawBaseUrl" "$binaryFile"
done | wget "${wgetOptions[@]}"
# Create the $remoteDirectory on the Miyoo Mini+:
sshpass -e ssh \
"${sshOptions[@]}" \
"$user@$ipAddress" \
"mkdir -p '$remoteDirectory'"
# Copy each file to the $remoteDirectory:
for binaryFile in "${binaryFiles[@]}"; do
remoteMode=755
if [[ "$binaryFile" == "magic.mgc" ]]; then
remoteMode=644
fi
sshpass -e ssh \
"${sshOptions[@]}" \
"$user@$ipAddress" \
"cat > '$remoteDirectory/$binaryFile' && chmod $remoteMode '$remoteDirectory/$binaryFile'" \
< "$localDirectory/$binaryFile"
done
unset SSHPASSNote
- Remember to replace the
ipAddress,user, andremoteDirectoryvariables with values that match your firmware and LAN setup. - The GitHub API allows unauthenticated requests, but repeated requests may hit IP-based rate limits:
Rate limits for the REST API
After copying the binaries to the Miyoo Mini+, you can SSH into it with the $remoteDirectory available under PATH:
# 'MAGIC' lets 'file' find 'magic.mgc' without passing '--magic-file' each time:
sshpass -e ssh \
-t \
"${sshOptions[@]}" \
"$user@$ipAddress" \
"export PATH='$remoteDirectory':\$PATH; export MAGIC='$remoteDirectory/magic.mgc'; exec sh"If you need to regenerate the binaries/ bundle, then you can do so by running the build.sh script directly from the MMP repository.
The build.sh script creates the src/, src/Downloads/, and binaries/ directories next to build.sh.
It then downloads source archives into src/Downloads/, extracts source trees under src/, cross-compiles the tools, and stages the results under the binaries/ directory.
# Set the local build directory and GitHub source URL:
toolSourceDirectory="$HOME/src/MMP/src/tools"
toolSourceBaseUrl="https://github.com/Luspin/MMP/raw/refs/heads/main/src/tools"
# Create the directory layout that is expected by 'build.sh':
mkdir --parents "$toolSourceDirectory/binaries"
cd "$toolSourceDirectory"
# Download 'build.sh':
wget \
--output-document=build.sh \
"$toolSourceBaseUrl/build.sh"
# Download the maintained 'ldd' wrapper required by 'build.sh':
wget \
--output-document=binaries/ldd \
"$toolSourceBaseUrl/binaries/ldd"
# Make the downloaded scripts executable (755):
chmod 755 \
build.sh \
binaries/ldd
# Run 'build.sh':
./build.shNote
-
gdbis built without TUI, curses, expat, Python, or Guile to avoid extra on-device dependencies. -
gdbhaslibstdc++andlibgcclinked in, so those do not need to be installed separately on the Miyoo Mini+.
Source versions are fixed by default in the build.sh script:
| Tool(s) | Source package | Version |
|---|---|---|
readelf, objdump, nm, addr2line
|
binutils | 2.32 |
file, magic.mgc
|
file | 5.39 |
gdb, gdbserver
|
gdb | 8.3.1 |
ldd |
Shell script | -- |
strace |
strace | 5.10 |
Previous Article
Deployment and Testing
Next Article
GDB Usage