Skip to content

Commit

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

jobs:
release_job:
runs-on: ubuntu-latest
name: Build Release
steps:
- uses: actions/checkout@v2
- name: Build
run: |
sudo apt-get install -y bison scons
./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
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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/),
and [gpsd](https://gitlab.com/gpsd/gpsd) currently.
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.

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

You can use the ARM.com supplied compiler, located in `DESTDIR/gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf`

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.

### Using Xilinx 2019.1 SDK toolchain

You can use the Xilinix provided compiler, located in `/opt/Xilinx/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi`
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.
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 /opt/Xilinx/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi)
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})
100 changes: 100 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash

set -e

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

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

if [ ! -d gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf ] ; then
[ -f gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf.tar.xz ] || 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
tar xf gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf.tar.xz
fi
echo '- Compiler: gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf' >>"${releaseinfo}"
export tools="${tools:-${builddir}/gcc-arm-8.2-2019.01-x86_64-arm-linux-gnueabihf}"

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}"

[ -d SoapySDR ] || git clone https://github.com/pothosware/SoapySDR.git
pushd SoapySDR
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 && 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 && 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 && 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 && 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 && 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 && 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}"
export CROSS_COMPILE="${tools}/bin/arm-linux-gnueabihf-"
CC="${CROSS_COMPILE}gcc" CFLAGS="--sysroot ${sysroot}" ./configure --prefix=/usr
# sudo apt-get install -y bison
make
# make install DESTDIR=${stagedir}
cp 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
export PATH="$tools/bin:$PATH"
DESTDIR="${stagedir}" scons libgpsmm=No ncurses=No python=No prefix=/usr sysroot="${sysroot}" target=arm-linux-gnueabihf build install
# fix paths
rsync -a "${stagedir}/usr/" "${stagedir}/"
popd

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

0 comments on commit 31ea919

Please sign in to comment.