162.17. uhd-4.10.0.0
USRP Hardware Driver — Ettus/NI USRP radios for GNU Radio's gr-uhd, with the uhd_* utilities and Python API
The build-state snapshot was taken from 4.10.0.0-1; this recipe is 4.10.0.0-2, so the size, time and contents below describe the earlier build.
| Version | 4.10.0.0, release 2 |
| Shelf | sdr-hw — SDR hardware drivers and the SoapySDR device layer |
| Phase | 41_system (System), 912 of 1047 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://www.ettus.com/sdr-software/uhd-usrp-hardware-driver/ |
| Build time | 11.0 SBU |
| Installed size | 32.1 MiB in 440 files |
| Recipe | ports/core/sdr-hw/uhd/kpkgbuild |
About
UHD, the USRP Hardware Driver, is Ettus Research’s driver library for its USRP radios (the USB B-series, the networked N- and X-series, and the embedded E-series). It installs libuhd, a C API over it, the uhd Python module, and the uhd_* utilities, among them uhd_find_devices and uhd_usrp_probe. gnuradio builds its gr-uhd blocks on it, and gr-osmosdr, sdrangel, sdrpp, satdump and urh link it. The repository holds the FPGA and firmware sources as well; build.sh configures only the host software, in host/.
Sources
uhd-4.10.0.0.tar.gz(53.1 MiB)
sha256a9c66b52abcd586b513999f3a52345807b7551d01efac8c98eed813838be0297
upstream: https://github.com/EttusResearch/uhd/archive/refs/tags/v4.10.0.0.tar.gz
archive copy: sources-4/sdr-hw--uhd-4.10.0.0.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, boost, libusb, python3, python3-mako, python3-setuptools, python3-pybind11, python3-requests, numpy, python3-ruamel-yaml.
Required by (6): gnuradio, gr-osmosdr, satdump, sdrangel, sdrpp, urh.
Patches
build.sh applies these; kpkg applies nothing by itself.
gcc-15.patch— Adds#include <cstdint>tohost/lib/include/uhdlib/transport/link_if.hpp. The header usesint32_tand includes nothing that declares it with the tree’s libstdc++.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install uhd'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/sdr-hw/uhd.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/sdr-hw/uhd
echo 'a9c66b52abcd586b513999f3a52345807b7551d01efac8c98eed813838be0297 uhd-4.10.0.0.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/uhd
SRC=$SRC_ROOT/uhd-4.10.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf uhd-4.10.0.0.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers series and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/gcc-15.patch"
cmake -S host -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DUHD_VERSION=$version \
-DENABLE_STATIC_LIBS=OFF \
-DENABLE_LIBUHD=ON \
-DENABLE_C_API=ON \
-DENABLE_PYTHON_API=ON \
-DENABLE_UTILS=ON \
-DENABLE_EXAMPLES=OFF \
-DENABLE_TESTS=OFF \
-DENABLE_PYMOD_UTILS=OFF \
-DENABLE_SIM=OFF \
-DENABLE_DPDK=OFF \
-DENABLE_USB=ON \
-DENABLE_MAN_PAGES=OFF \
-DENABLE_MANUAL=OFF \
-DENABLE_DOXYGEN=OFF \
-DENABLE_RFNOC_DEV=OFF
cmake --build build
DESTDIR=$PKG cmake --install build
for c in "$PKG"/usr/bin/*; do
p=host/docs/manpages/${c##*/}.1
if [ -e "$p" ]; then
install -Dm644 "$p" -t "$PKG"/usr/share/man/man1
fi
done
test -e "$PKG"/usr/lib/pkgconfig/uhd.pc
test -x "$PKG"/usr/bin/uhd_find_devices
test -e "$PKG"/usr/share/man/man1/uhd_find_devices.1
test -n "$(find "$PKG"/usr/lib -path '*/site-packages/uhd/__init__.py')"
The switches, and why each is set:
-DUHD_VERSION=$version— The version UHD reports and writes intouhd.pc. Left alone, UHD derives it from git (git describe, the branch name), and a release tarball is no checkout, so the version would carry a commit count of0and a hash ofunknown.-DENABLE_STATIC_LIBS=OFF— Build no static library; upstream’s default.-DENABLE_LIBUHD=ON,-DENABLE_C_API=ON,-DENABLE_UTILS=ON,-DENABLE_USB=ON— Require the library, its C API, the utility programs and USB transport (for the B-series and the USRP1, on libusb). Each is a UHD component, on by default whenever its dependencies are found. Upstream marks the library required, so configure stops without Boost and Mako even unnamed; the other three are left out with only a status line when theirs are missing. NamedON, a component whose dependencies are missing stops configure with “Dependencies for required component … not met”.-DENABLE_PYTHON_API=ON— Build theuhdPython module with pybind11. The component needs numpy and the Python headers, and namedONit fails configure without them. It compiles against python3-pybind11 when CMake finds it, and against the copy underhost/lib/deps/pybind11when not. The lasttestline inbuild.shfails the build if the module is not in the package.-DENABLE_EXAMPLES=OFF,-DENABLE_TESTS=OFF— Build neither the example programs nor the unit tests, which are on by default.-DENABLE_PYMOD_UTILS=OFF— Leave out the Python utilities module, a separate component from the Python API.-DENABLE_SIM=OFF— Leave out UHD’s simulated USRP device, which is on by default whenever the Python API is built.-DENABLE_DPDK=OFF— No DPDK transport for the networked radios; DPDK is not a port.-DENABLE_RFNOC_DEV=OFF— Install none of the RFNoC FPGA development files; upstream’s default.-DENABLE_MAN_PAGES=OFF— Let UHD install no manual pages itself. Its manual-page component installs the uncompressed pages by bare name fromhost/docs/, where they are not, and the install stops; with compression on, it installs gzipped copies of its whole list, among them pages forrfnoc_modtoolandrfnoc_image_builder, which this build does not install. The loop after the install puts the uncompressed pages in place, below.-DENABLE_MANUAL=OFF,-DENABLE_DOXYGEN=OFF— Generate neither the HTML manual nor the API documentation with Doxygen.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/uhd, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf uhd-4.10.0.0-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/uhd, and runs the triggers its paths call for.
Contents
Installed programs: uhd_adc_self_cal, uhd_cal_rx_iq_balance, uhd_cal_tx_dc_offset, uhd_cal_tx_iq_balance, uhd_config_info, uhd_find_devices, uhd_image_loader, uhd_images_downloader, uhd_usrp_probe, usrp2_card_burner, usrpctl.
Installed libraries: libuhd.so.
Installed directories: /usr/include/uhd, /usr/lib/cmake/uhd, /usr/lib/python3.14/site-packages/uhd, /usr/lib/uhd, /usr/share/doc/uhd, /usr/share/licenses/uhd, /usr/share/uhd.
Short descriptions
uhd_adc_self_cal |
invoke calibration in some UHD devices. |
uhd_cal_rx_iq_balance |
Generate RX IQ Balance Calibration Table for a UHD Device |
uhd_cal_tx_dc_offset |
Generate TX DC Offset Calibration Table for a UHD Device |
uhd_cal_tx_iq_balance |
Generate TX IQ Balance Calibration Table for a UHD Device |
uhd_config_info |
USRP Hardware Driver Build Configuration Info |
uhd_find_devices |
USRP Hardware Driver Discovery Utility |
uhd_image_loader |
UHD Image Loader |
uhd_images_downloader |
USRP Hardware Driver firmware/FPGA downloader |
uhd_usrp_probe |
USRP Hardware Driver Peripheral Report Utility |
usrp2_card_burner |
USRP N-Series FPGA/Firmware Burner |
usrpctl |
USRP Hardware Driver Peripheral Configuration Tool |
uhd.pc |
Ettus Research - USRP Hardware Driver |
Notes
The loop after the install puts the manual pages in place. For each program in $PKG/usr/bin it installs host/docs/manpages/<program>.1, uncompressed, when one exists, so no page describes a program that is not there. The test lines at the end check the pkg-config file, uhd_find_devices, its manual page and the Python module.
The package carries no FPGA or firmware images for the radios. uhd_images_downloader fetches them from Ettus into /usr/share/uhd/images/ when it is run, and a radio that loads its image from the host finds none until then.
Access to the USB radios comes from the tree’s own udev rules, which give the Ettus and National Instruments ids to the dialout group (see The device groups and the udev rules); upstream’s uhd-usrp.rules, installed under /usr/lib/uhd/utils, is not used.
The recipe’s series key keeps ports/update offering only releases on the line it names. The next line, 4.11, moves the RPC transport of the MPM devices (N3xx, E3xx, X4xx) onto gRPC and Protobuf, and its host build needs gRPC, which is not a port.
runtime = python3-mako: the Python package uhd.rfnoc_utils, which includes the RFNoC image builder (image_builder.py), renders the FPGA image’s Verilog and YAML from Mako templates, imported from submodules that the run-time needs record does not read. python3-mako is a build-only port, so without the word a prebuilt install would leave it out and the image builder would stop on its first import.