Skip to content

Commit

Permalink
Add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckschwerdt committed Oct 2, 2021
0 parents commit d5f27f2
Show file tree
Hide file tree
Showing 4 changed files with 270 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Create release
on: workflow_dispatch

jobs:
release_job:
runs-on: ubuntu-latest
name: Build Release
steps:
- uses: actions/checkout@v2
- name: Build
# note: crossbuild-essential-armhf on 18.04 is GCC-7.2, on 20.04 GCC-9.2
# GCC-7.2 has GLIBC trouble on SoapyRemote avahi linking
# GCC-9.2 has stropts.h trouble with socat
run: |
sudo apt-get install -y git rsync gcc-8-arm-linux-gnueabihf g++-8-arm-linux-gnueabihf cmake scons autoconf bison yodl
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-8 100 --slave /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-8
./build.sh
- name: Get Release tag
run: echo "RELEASE_VERSION=$(date +%F)" >> $GITHUB_ENV
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: Release ${{ env.RELEASE_VERSION }}
body_path: RELEASE-INFO.md
draft: true
prerelease: true
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: plutosdr-apps.tar.gz
asset_name: plutosdr-apps-${{ env.RELEASE_VERSION }}.tar.gz
asset_content_type: application/gzip
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Prebuilt SoapySDR and rtl_433 apps for Pluto SDR

This is a build action to create [binary releases](https://github.com/triq-org/PlutoSDR-Apps/releases)
for the [ADALM-Pluto SDR](https://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/adalm-pluto.html#eb-overview).

You mainly get [SoapySDR](https://github.com/pothosware/SoapySDR/),
the [SoapyPlutoSDR](https://github.com/pothosware/SoapyPlutoSDR/) module,
and [rtl_433](https://github.com/merbanan/rtl_433).
But there is also
[rx_tools](https://github.com/rxseger/rx_tools),
[tx_tools](https://github.com/triq-org/tx_tools),
[SoapyRemote](https://github.com/pothosware/SoapyRemote),
[chrony](https://chrony.tuxfamily.org/),
[gpsd](https://gitlab.com/gpsd/gpsd),
and for testing
[iperf](https://github.com/esnet/iperf),
[socat](http://repo.or.cz/socat).
Let me know what other tools would be useful.

## Using

Download [a Release](https://github.com/triq-org/PlutoSDR-Apps/releases),
then copy to the Pluto and unpack to `/usr`

## Notes on the compiler toolchain

If you want to compile yourself you need a compiler toolchain.
You want a host target of `arm-linux-gnueabihf`, a number of options are available:

### Using Debian (or Ubuntu) crossbuild toolchain

Simply install the `crossbuild-essential-armhf` meta package.

Toolchain path will be `/usr` and is already setup.

### Using ARM.com toolchain (previously Linaro)

You can use the ARM.com (previously Linaro) supplied compiler.

See [GNU Toolchain for the A-profile Architecture](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads/8-2-2019-01).
You want the download "AArch32 target with hard float (arm-linux-gnueabihf)", then just unpack.

Toolchain path will be `DESTDIR/gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf`

### Using Xilinx 2019.1 SDK toolchain

You can use the Xilinix provided compiler.
The download needs an account though and there is no easy unattended install.

See [Xilinx Software Development Kit (XSDK)](https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vitis/archive-sdk.html).
You want the Software Development Kit Standalone WebInstall Client - 2019.1 Lightweight Installer Download,
then run `sh Xilinx_SDK_2019.1_0524_1430_Lin64.bin`

We only need tools from /opt/Xilinx/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi
You might want to repackage the compiler base dir for unattended install.

Toolchain path will be `/opt/Xilinx/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi`
30 changes: 30 additions & 0 deletions Toolchain-arm-linux-gnueabi.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
# Set to plutosdr-fw sysroot dir
if(DEFINED ENV{sysroot})
set(CMAKE_SYSROOT $ENV{sysroot})
else()
set(CMAKE_SYSROOT $ENV{HOME}/staging)
endif()
# Set to output dir
if(DEFINED ENV{stagedir})
set(CMAKE_STAGING_PREFIX $ENV{stagedir})
else()
set(CMAKE_STAGING_PREFIX $ENV{HOME}/stage)
endif()
# Set for SoapySDR to locate it's module search path (/usr/lib/SoapySDR/modules0.7)
set(CMAKE_INSTALL_PREFIX:PATH /usr)
# Set to cross compiler location
if(DEFINED ENV{tools})
set(tools $ENV{tools})
else()
set(tools /usr)
endif()
set(CMAKE_C_COMPILER ${tools}/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/arm-linux-gnueabihf-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# Set for Soapy modules and rtl_433 to locate staged SoapySDR libs
set(CMAKE_PREFIX_PATH ${CMAKE_STAGING_PREFIX})
146 changes: 146 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#!/bin/bash

set -e

export builddir="${builddir:-$(pwd)}"

date +%F >"${builddir}/RELEASE-VERSION.txt"
export releaseinfo="${builddir}/RELEASE-INFO.md"
echo -n >"${releaseinfo}"

# Setup Toolchain

if [ -z "${tools}" -a -n "$(command -v arm-linux-gnueabihf-gcc)" ] ; then
export tools=$(dirname $(dirname $(command -v arm-linux-gnueabihf-gcc)))
echo "- Compiler: $(arm-linux-gnueabihf-gcc --version | head -1)" >>"${releaseinfo}"
fi

if [ -z "${tools}" -a -d "gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf" ] ; then
export tools="${builddir}/gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf"
export PATH="${tools}/bin:$PATH"
echo '- Compiler: gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf' >>"${releaseinfo}"
fi

if [ -z "${tools}" -a -d "/opt/Xilinx/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi" ] ; then
export tools="/opt/Xilinx/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi"
export PATH="${tools}/bin:$PATH"
echo "- Compiler: $(arm-linux-gnueabihf-gcc --version | head -1)" >>"${releaseinfo}"
fi

if [ -z "${tools}" ] ; then
echo 'Toolchain "arm-linux-gnueabihf" not found. On Debian try:'
echo '$ sudo apt-get install -y crossbuild-essential-armhf'
echo 'Or a standalone toolchain:'
echo '$ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/8.2-2019.01/gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf.tar.xz'
echo '$ tar xf gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf.tar.xz'
exit 1
fi

# Setup Sysroot

if [ ! -d staging ] ; then
[ -f sysroot-v0.34.tar.gz ] || wget https://github.com/analogdevicesinc/plutosdr-fw/releases/download/v0.34/sysroot-v0.34.tar.gz
tar xzf sysroot-v0.34.tar.gz
fi
echo '- plutosdr-fw: sysroot v0.34' >>"${releaseinfo}"
export sysroot="${sysroot:-${builddir}/staging}"
export stagedir="${stagedir:-${builddir}/stage}"
export toolchain="${toolchain:-${builddir}/Toolchain-arm-linux-gnueabi.cmake}"

# Compile Apps

[ -d SoapySDR ] || git clone https://github.com/pothosware/SoapySDR.git
pushd SoapySDR
git checkout feat-ratefmt
echo -n '- SoapySDR: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
rm -rf build ; mkdir build ; pushd build
cmake -DCMAKE_TOOLCHAIN_FILE="${toolchain}" -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_PYTHON=OFF -DENABLE_PYTHON3=OFF .. && make VERBOSE=1 && make install
popd ; popd

[ -d SoapyPlutoSDR ] || git clone https://github.com/pothosware/SoapyPlutoSDR.git
pushd SoapyPlutoSDR
echo -n '- SoapyPlutoSDR: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
rm -rf build ; mkdir build ; pushd build
cmake -DCMAKE_TOOLCHAIN_FILE="${toolchain}" -DCMAKE_INSTALL_PREFIX=/usr -DSoapySDR_DIR="${stagedir}/share/cmake/SoapySDR" .. && make VERBOSE=1 && make install
popd ; popd

[ -d SoapyRemote ] || git clone https://github.com/pothosware/SoapyRemote.git
pushd SoapyRemote
echo -n '- SoapyRemote: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
rm -rf build ; mkdir build ; pushd build
cmake -DCMAKE_TOOLCHAIN_FILE="${toolchain}" -DCMAKE_INSTALL_PREFIX=/usr -DSoapySDR_DIR="${stagedir}/share/cmake/SoapySDR" .. && make VERBOSE=1 && make install
popd ; popd

[ -d rtl_433 ] || git clone https://github.com/merbanan/rtl_433.git
pushd rtl_433
echo -n '- rtl_433: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
rm -rf build ; mkdir build ; pushd build
cmake -DENABLE_RTLSDR=OFF -DENABLE_SOAPYSDR=ON -DENABLE_OPENSSL=OFF -DCMAKE_TOOLCHAIN_FILE="${toolchain}" -DCMAKE_INSTALL_PREFIX=/usr -DSoapySDR_DIR="${stagedir}/share/cmake/SoapySDR" .. && make VERBOSE=1 && make install
popd ; popd

[ -d rx_tools ] || git clone https://github.com/rxseger/rx_tools.git
pushd rx_tools
echo -n '- rx_tools: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
rm -rf build ; mkdir build ; pushd build
cmake -DCMAKE_TOOLCHAIN_FILE="${toolchain}" -DCMAKE_INSTALL_PREFIX=/usr -DSoapySDR_DIR="${stagedir}/share/cmake/SoapySDR" .. && make VERBOSE=1 && make install
popd ; popd

[ -d tx_tools ] || git clone https://github.com/triq-org/tx_tools.git
pushd tx_tools
echo -n '- tx_tools: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
rm -rf build ; mkdir build ; pushd build
cmake -DCMAKE_TOOLCHAIN_FILE="${toolchain}" -DCMAKE_INSTALL_PREFIX=/usr -DSoapySDR_DIR="${stagedir}/share/cmake/SoapySDR" .. && make VERBOSE=1 && make install
popd ; popd

[ -d chrony ] || git clone https://git.tuxfamily.org/chrony/chrony.git
pushd chrony
echo -n '- chrony: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
CC="arm-linux-gnueabihf-gcc" CFLAGS="--sysroot ${sysroot}" ./configure --prefix=/usr
# sudo apt-get install -y bison
make
# make install DESTDIR=${stagedir} BINDIR=/bin SBINDIR=/bin
cp -a chronyc chronyd "${stagedir}/bin/"
popd

[ -d gpsd ] || git clone git://git.savannah.gnu.org/gpsd.git
pushd gpsd
echo -n '- gpsd: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
# sudo apt-get install -y scons
DESTDIR="${stagedir}" scons libgpsmm=No ncurses=No python=No sbindir=bin prefix=/ sysroot="${sysroot}" target=arm-linux-gnueabihf build install
popd

[ -d iperf ] || git clone https://github.com/esnet/iperf.git
pushd iperf
echo -n '- iperf: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
CFLAGS="--sysroot ${sysroot}" ./configure --without-openssl --prefix=/usr --host=arm-linux-gnueabihf --enable-static --disable-shared
make
make install DESTDIR=${stagedir} prefix=/
popd

[ -d socat ] || git clone git://repo.or.cz/socat.git
pushd socat
echo -n '- socat: ' >>"${releaseinfo}"
git describe --tags --first-parent --abbrev=7 --long --dirty --always >>"${releaseinfo}"
autoconf
CFLAGS="--sysroot ${sysroot}" ./configure --disable-openssl --prefix=/usr --host=arm-linux-gnueabihf
# this might be wrongly detected
echo '#undef HAVE_SYS_STROPTS_H' >>config.h
# sudo apt-get install -y yodl
make
make install DESTDIR=${stagedir} prefix=/
popd

# Dist Package

cd "${stagedir}"
find . -ls
tar czf "${builddir}/plutosdr-apps.tar.gz" bin lib/lib* lib/SoapySDR

0 comments on commit d5f27f2

Please sign in to comment.