Skip to content

Instantly share code, notes, and snippets.

@vitali2y
Created November 23, 2025 20:32
Show Gist options
  • Select an option

  • Save vitali2y/1690b20f27502ac3b93635fa7bbed0a4 to your computer and use it in GitHub Desktop.

Select an option

Save vitali2y/1690b20f27502ac3b93635fa7bbed0a4 to your computer and use it in GitHub Desktop.
Cross-compile lrzsz for Orange Pi RV2 (RISC-V 64) SBC
#!/usr/bin/env bash
#
# Cross-compile lrzsz-0.12.21rc (lrz & lsz) for Orange Pi RV2 (RISC-V 64)
#
set -euo pipefail
PRJ="lrzsz"
LRZSZ_URL="https://github.com/UweOhse/${PRJ}.git"
export ARCH="riscv"
export CROSS_HOST="riscv64-linux-gnu"
export CROSS_COMPILE="${CROSS_HOST}-"
export CC="${CROSS_COMPILE}gcc"
export AR="${CROSS_COMPILE}ar"
export RANLIB="${CROSS_COMPILE}ranlib"
export STRIP="${CROSS_COMPILE}strip"
git clone --recursive "${LRZSZ_URL}" && cd "${PRJ}"
mkdir output
echo "Configuring for RISC-V target..."
autoconf
./configure --host=${CROSS_HOST} CC="${CC}" AR="${AR}" RANLIB="${RANLIB}"
echo "Building..."
make ARCH="${ARCH}" CROSS_COMPILE=$"${CROSS_COMPILE}" -j$(nproc)
echo "Stripping and exporting bins..."
cp src/lrz ./output/lrz
cp src/lsz ./output/lsz
"$STRIP" ./output/lrz
"$STRIP" ./output/lsz
echo "Build finished successfully!"
echo "Copy these bins to SBC (e.g. /usr/bin/):"
ls -la ./output/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment