diff --git a/raspberry/Dockerfile b/raspberry/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b2c93f7ecec867035b02c1e469be0f4ac8acfaef --- /dev/null +++ b/raspberry/Dockerfile @@ -0,0 +1,45 @@ +# +# Dockerfile +# +FROM ubuntu:focal AS builder +RUN apt update +RUN apt install -y git +WORKDIR /home +RUN git clone https://github.com/gnuradio/gnuradio.git -b maint-3.9 +COPY ./keyboard /etc/default/keyboard +RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections +RUN echo keyboard-configuration keyboard-configuration/layout select 'English (US)' | debconf-set-selections +RUN echo keyboard-configuration keyboard-configuration/layoutcode select 'us' | debconf-set-selections +RUN echo "resolvconf resolvconf/linkify-resolvconf boolean false" | debconf-set-selections +RUN apt-get install -y keyboard-configuration +RUN apt install -y build-essential fakeroot devscripts +RUN apt-get install -y cmake debhelper dh-python doxygen gir1.2-gtk-3.0 gir1.2-pango-1.0 graphviz libasound2-dev libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev libboost-test-dev libboost-thread-dev libcodec2-dev libfftw3-dev libfontconfig1-dev libgmp-dev libgsl-dev libgsm1-dev libjack-jackd2-dev liblog4cpp5-dev liborc-0.4-dev libpangocairo-1.0-0 libportaudio2 libpulse-dev libqwt-qt5-dev libsdl1.2-dev libsndfile1-dev libthrift-dev libuhd-dev libusb-1.0-0-dev libvolk2-dev libxi-dev libxrender-dev libzmq3-dev pkg-config portaudio19-dev pybind11-dev python3-click python3-click-plugins python3-dev python3-gi python3-gi-cairo python3-lxml python3-mako python3-numpy python3-opengl python3-pyqt5 python3-scipy python3-yaml python3-zmq qt5-qmake qtbase5-dev qttools5-dev thrift-compiler xmlto libsoapysdr-dev checkinstall + +RUN git clone --recursive https://github.com/gnuradio/volk.git +WORKDIR /home/volk/ +RUN echo $PWD +RUN mkdir build +WORKDIR /home/volk/build +RUN cmake .. +RUN make -j$(nproc) +RUN checkinstall \ + --default \ + --install=no \ + --nodoc \ + --pkgname=volk\ + --type=debian -y + +WORKDIR /home/gnuradio +RUN mkdir -p /home/gnuradio/build +WORKDIR /home/gnuradio/build +RUN cmake .. +RUN make -j$(nproc) +RUN checkinstall --default --install=no --pkgname=gnuradio --type=debian -y + +WORKDIR /out + +RUN mv /home/gnuradio/build/gnuradio*.deb gnuradio.deb +RUN mv /home/volk/build/volk*.deb volk.deb + +ENTRYPOINT ["/bin/bash", "-l", "-c", "cp *.deb /local/"] + diff --git a/raspberry/README.md b/raspberry/README.md new file mode 100644 index 0000000000000000000000000000000000000000..67ca0d5c7cf27a3a91d77c87fc821f882dfea683 --- /dev/null +++ b/raspberry/README.md @@ -0,0 +1,164 @@ +How to install gr-bladeRF to + +O. Prepare Raspberry Pi4 + +0.1. Download and install rpi-imager: + visit https://www.raspberrypi.com/software and download rpi imager + or run + ``` + wget https://downloads.raspberrypi.org/imager/imager_latest_amd64.deb + sudo dpkg -i imager_1.6.2_amd64.deb + ``` +0.2. Flash image and setup network + Insert microSD card to slot on your computer an run rpi-imager + + Choose OS: Other general purpose OS - Ubuntu - Ubuntu Server 21.04.3 LTS (RPi 3/4/400) 64-bit server OS for arm64 architectures + + Choose storage - your microSD card + + Press write + + Insert microSD into RPi and plug ethernet & power cables. + +0.3. Determining the Pi’s IP address + To determine the IP address of your board, open a terminal and run the `arp` command: + + On Ubuntu and Mac OS: + ``` + arp -na | grep -i "e4:5f" + ? (192.168.1.105) at e4:5f:01:35:c0:92 [ether] on wlp3s0 + ``` + ubuntu@ubuntu:~$ sudoedit /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg + + Connect to rpi4 via ssh: + ``` + ssh ubuntu@192.168.1.105 + ``` + password: `ubuntu` + Change password on first login and connect again. + +0.5. Install a desktop + + check architecture + ``` + ubuntu@ubuntu:~$ dpkg --print-architecture + arm64 + ``` + ``` + sudo apt update + sudo apt -y upgrade + sudo apt install -y xubuntu-desktop + ``` + +2. Install bladeRF + + ``` + sudo add-apt-repository ppa:nuandllc/bladerf + sudo apt-get update + sudo apt-get install -y bladerf libbladerf-dev bladerf-firmware-fx3 + sudo apt-get install bladerf-fpga-hostedx40 # for bladeRF x40 + sudo apt-get install bladerf-fpga-hostedx115 # for bladeRF x115 + sudo apt-get install bladerf-fpga-hostedxa4 # for bladeRF 2.0 Micro A4 + sudo apt-get install bladerf-fpga-hostedxa9 # for bladeRF 2.0 Micro A9 + ``` + Check bladeRF: + ``` + ubuntu@ubuntu:~$ bladeRF-cli -i + bladeRF> info + + Board: Nuand bladeRF 2.0 (bladerf2) + Serial #: 0a3e891bd6ff4eee908b8278a2a67d45 + VCTCXO DAC calibration: 0x1d01 + FPGA size: 49 KLE + FPGA loaded: yes + Flash size: 32 Mbit + USB bus: 2 + USB address: 2 + USB speed: SuperSpeed + Backend: libusb + Instance: 0 + + bladeRF> exit + ``` +3. Crossplatform build volk and gnuradio using docker and install on RPi + + ./build_gnuradio.sh + + Transfer files to RPi: + ``` + scp *.deb ubuntu@192.168.1.105:/home/ubuntu + ``` + Connect to RPi + + ssh -X ubuntu@192.168.1.105 # -X for run GUI applications + + Install + ``` + sudo dpkg -i volk.deb + sudo dpkg -i gnuradio.deb + sudo apt-get install -y libusb-1.0-0-dev libusb-1.0-0 git cmake g++ \ + libboost-all-dev libgmp-dev swig python3-numpy python3-matplotlib \ + python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \ + libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \ + liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \ + python3-zmq python3-scipy python3-gi python3-gi-cairo gir1.2-gtk-3.0 \ + libcodec2-dev libgsm1-dev libqt5svg5-dev libpulse-dev pulseaudio alsa-base \ + libasound2 libasound2-dev pybind11-dev libsndfile-dev + ``` + Run gnuradio + ``` + export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + gnuradio-companion + ``` +4. Build and install gr-iqbal, gr-osmosdr, gr-bladeRF + + Make directory for source + ``` + mkdir ~/gr + ``` + # gr-iqbal + ``` + cd ~/gr + git clone git://git.osmocom.org/gr-iqbal + cd gr-iqbal + git submodule update --init --recursive + mkdir build && cd build + cmake .. + make -j$(nproc) + sudo make install && sudo ldconfig + ``` + # gr-osmosdr + ############# + ``` + cd ~/gr + git clone https://git.osmocom.org/gr-osmosdr + cd gr-osmosdr + mkdir build && cd build + cmake .. + make -j$(nproc) + sudo make install && sudo ldconfig + ``` + #gr-bladeRF + ############ + ``` + cd ~/gr + git clone https://github.com/Nuand/gr-bladeRF.git + cd gr-bladeRF + mkdir build + cd build + cmake .. + make -j4 + sudo make install + ``` + + Check `gr-bladeRF`: + + Setup audio forwarding: + ``` + scp ~/.config/pulse/cookie ubuntu@192.168.1.105:/home/ubuntu/.config/pulse/cookie + ``` + + ``` + gnuradio-companion ~/gr/gr-bladeRF/apps/fm_receiver.grc + ``` + diff --git a/raspberry/build_gnuradio.sh b/raspberry/build_gnuradio.sh new file mode 100644 index 0000000000000000000000000000000000000000..675d40d87c62a12a39bfc14326520f705450141c --- /dev/null +++ b/raspberry/build_gnuradio.sh @@ -0,0 +1,8 @@ +#!/usr/bin/sh +#Run crossplatform docker +docker run --privileged --rm docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 +#Create docker image. The packages will be built inside the container. +docker buildx build --platform linux/arm64 -t gnuradio-builder . +#Run docker image. +docker run -v ${PWD}:/local --platform linux/arm64 -t gnuradio-builder + diff --git a/raspberry/keyboard b/raspberry/keyboard new file mode 100644 index 0000000000000000000000000000000000000000..b372bfa6a838c231ebc269fc4bac979ded11bb10 --- /dev/null +++ b/raspberry/keyboard @@ -0,0 +1,17 @@ +# Check /usr/share/doc/keyboard-configuration/README.Debian for +# documentation on what to do after having modified this file. + +# The following variables describe your keyboard and can have the same +# values as the XkbModel, XkbLayout, XkbVariant and XkbOptions options +# in /etc/X11/xorg.conf. + +XKBMODEL="pc105" +XKBLAYOUT="us" +XKBVARIANT="intl" +XKBOPTIONS="" + +# If you don't want to use the XKB layout on the console, you can +# specify an alternative keymap. Make sure it will be accessible +# before /usr is mounted. +# KMAP=/etc/console-setup/defkeymap.kmap.gz +BACKSPACE="guess"