diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4c42919 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..a7d107c --- /dev/null +++ b/README.md @@ -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. diff --git a/Toolchain-arm-linux-gnueabi.cmake b/Toolchain-arm-linux-gnueabi.cmake new file mode 100644 index 0000000..c72dea8 --- /dev/null +++ b/Toolchain-arm-linux-gnueabi.cmake @@ -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}) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..05dd4fd --- /dev/null +++ b/build.sh @@ -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