Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: gr-iio #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# gnuradio-docker
18 changes: 18 additions & 0 deletions ci_lib/gr_adi_lib_iio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# gr_adi_lib_iio

For automated testing using hardware such as an Analog Devices ADALM-PLUTO:

```
docker \
run \
--device \
"/dev/bus/usb" \
--device-cgroup-rule \
"a 189:* rwm" \
--interactive \
--name \
"he_ad_lib_iio" \
--rm \
--tty \
"gr_adi_lib_iio:v0.21"
```
286 changes: 286 additions & 0 deletions ci_lib/gr_adi_lib_iio/gr_adi_lib_iio
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
# syntax=docker/dockerfile:1.0.0-experimental

# Copyright (c) 2020 - 2021 Adam Horden <[email protected]>

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

#

FROM debian:bullseye-slim

#

LABEL maintainer="[email protected]"

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

#

ENV DEBIAN_FRONTEND="noninteractive"

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

RUN \
set \
-o \
"errexit" \
-o \
"xtrace" \
&& apt-get update \
&& apt-get upgrade --no-install-recommends --yes \
&& rm \
--force \
--recursive \
"/usr/share/man" \
&& rm \
--force \
--recursive \
"/var/lib/apt/lists"

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

RUN \
set \
-o \
"errexit" \
-o \
"xtrace" \
&& apt-get update \
&& apt-get install --no-install-recommends --yes "bison" \
&& apt-get install --no-install-recommends --yes "ca-certificates" \
&& apt-get install --no-install-recommends --yes "clang-11" \
&& apt-get install --no-install-recommends --yes "cmake" \
&& apt-get install --no-install-recommends --yes "flex" \
&& apt-get install --no-install-recommends --yes "git" \
&& apt-get install --no-install-recommends --yes "libc++-11-dev" \
&& apt-get install --no-install-recommends --yes "libc++abi1-11" \
&& apt-get install --no-install-recommends --yes "libc++abi-11-dev" \
&& apt-get install --no-install-recommends --yes "libclang-11-dev" \
&& apt-get install --no-install-recommends --yes "libclang-common-11-dev" \
&& apt-get install --no-install-recommends --yes "libserialport0" \
&& apt-get install --no-install-recommends --yes "libserialport-dev" \
&& apt-get install --no-install-recommends --yes "libusb-1.0-0" \
&& apt-get install --no-install-recommends --yes "libusb-1.0-0-dev" \
&& apt-get install --no-install-recommends --yes "libxml2" \
&& apt-get install --no-install-recommends --yes "libxml2-dev" \
&& apt-get install --no-install-recommends --yes "llvm-11-dev" \
&& apt-get install --no-install-recommends --yes "make" \
&& apt-get install --no-install-recommends --yes "pkg-config" \
&& rm \
--force \
--recursive \
"/usr/share/man" \
&& rm \
--force \
--recursive \
"/var/lib/apt/lists"

# ----------------------------------------------------------------------------------------
# Arguments:
# ----------------------------------------------------------------------------------------

ARG GR_BLD_ARCH

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

RUN \
set \
-o \
"errexit" \
-o \
"xtrace" \
&& ln \
--force \
--symbolic \
"/usr/bin/clang-11" \
"/usr/bin/clang"

# ----------------------------------------------------------------------------------------
# Arguments:
# ----------------------------------------------------------------------------------------

ARG GR_ADI_LIB_IIO_CMAKE_FLAGS=" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=/usr/bin/clang \
-DCMAKE_C_FLAGS=-std=c11 -stdlib=libc++ \
-DCMAKE_C_STANDARD=11 \
-DCMAKE_EXE_LINKER_FLAGS=-lc++abi \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DCMAKE_INSTALL_PREFIX:PATH=/usr"

# ----------------------------------------------------------------------------------------
# Arguments:
# ----------------------------------------------------------------------------------------

ARG GR_ADI_LIB_IIO_SRC
ARG GR_ADI_LIB_IIO_SRC_BR
ARG GR_ADI_LIB_IIO_SRC_VER

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

RUN \
set \
-o \
"errexit" \
-o \
"xtrace" \
&& export \
GR_BLD_PTH="$( \
printf \
"/%s/%s/gr_adi_lib_iio_bld_%s" \
"root" \
"gr" \
"${GR_ADI_LIB_IIO_SRC_VER}")" \
&& export \
GR_ADI_LIB_IIO_BLD_PTH="$( \
printf \
"%s/gr_adi_lib_iio_%s/gr_adi_lib_iio_bld_%s" \
"${GR_BLD_PTH}" \
"${GR_ADI_LIB_IIO_SRC_VER}" \
"${GR_ADI_LIB_IIO_SRC_VER}")" \
&& export \
GR_ADI_LIB_IIO_SRC_PTH="$( \
printf \
"%s/gr_adi_lib_iio_%s/gr_adi_lib_iio_src_%s" \
"${GR_BLD_PTH}" \
"${GR_ADI_LIB_IIO_SRC_VER}" \
"${GR_ADI_LIB_IIO_SRC_VER}")" \
&& mkdir \
--parents \
"${GR_ADI_LIB_IIO_BLD_PTH}" \
&& mkdir \
--parents \
"${GR_ADI_LIB_IIO_SRC_PTH}" \
&& cd \
"${GR_ADI_LIB_IIO_BLD_PTH}" \
&& /usr/bin/git \
clone \
--jobs \
"$(\
grep \
"processor.*:" \
/proc/cpuinfo | \
wc \
--lines)" \
"${GR_ADI_LIB_IIO_SRC}" \
"${GR_ADI_LIB_IIO_SRC_PTH}" \
&& /usr/bin/git \
-C \
"${GR_ADI_LIB_IIO_SRC_PTH}" \
fetch \
&& /usr/bin/git \
-C \
"${GR_ADI_LIB_IIO_SRC_PTH}" \
checkout \
"${GR_ADI_LIB_IIO_SRC_BR}" \
-b \
"${GR_ADI_LIB_IIO_SRC_BR}" \
&& /usr/bin/cmake \
${GR_ADI_LIB_IIO_CMAKE_FLAGS} \
"${GR_ADI_LIB_IIO_SRC_PTH}" \
&& /usr/bin/cmake \
--build \
"${GR_ADI_LIB_IIO_BLD_PTH}" \
-- \
-j \
"$(\
grep \
"processor.*:" \
/proc/cpuinfo | \
wc \
--lines)" \
&& /usr/bin/cmake \
--build \
"${GR_ADI_LIB_IIO_BLD_PTH}" \
-- \
"install" \
&& rm \
--force \
--recursive \
"${GR_BLD_PTH}"

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

RUN \
set \
-o \
"errexit" \
-o \
"xtrace" \
&& rm \
--force \
"/usr/bin/iio_adi_xflow_check" \
"/usr/bin/iio_attr" \
"/usr/bin/iio_genxml" \
"/usr/bin/iio_readdev" \
"/usr/bin/iio_reg" \
"/usr/bin/iio_stresstest" \
"/usr/bin/iio_writedev"

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

RUN \
set \
-o \
"errexit" \
-o \
"xtrace" \
&& apt-get update \
&& apt-get remove --purge --yes "bison" \
&& apt-get remove --purge --yes "ca-certificates" \
&& apt-get remove --purge --yes "clang-11" \
&& apt-get remove --purge --yes "cmake" \
&& apt-get remove --purge --yes "flex" \
&& apt-get remove --purge --yes "git" \
&& apt-get remove --purge --yes "libc++-11-dev" \
&& apt-get remove --purge --yes "libc++abi-11-dev" \
&& apt-get remove --purge --yes "libclang-11-dev" \
&& apt-get remove --purge --yes "libclang-common-11-dev" \
&& apt-get remove --purge --yes "libserialport-dev" \
&& apt-get remove --purge --yes "libusb-1.0-0-dev" \
&& apt-get remove --purge --yes "libxml2-dev" \
&& apt-get remove --purge --yes "llvm-11-dev" \
&& apt-get remove --purge --yes "make" \
&& apt-get remove --purge --yes "pkg-config" \
&& apt-get autoremove --purge --yes \
&& rm \
--force \
--recursive \
"/usr/share/man" \
&& rm \
--force \
--recursive \
"/var/lib/apt/lists"

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

COPY \
"gr_adi_lib_iio.sh" \
"/usr/bin/gr_adi_lib_iio.sh"

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

ENTRYPOINT [ \
"/usr/bin/gr_adi_lib_iio.sh" \
]
22 changes: 22 additions & 0 deletions ci_lib/gr_adi_lib_iio/gr_adi_lib_iio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Copyright (c) 2020 - 2021 Adam Horden <[email protected]>

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

set \
-o \
"errexit" \
-o \
"xtrace" \

# ----------------------------------------------------------------------------------------
#
# ----------------------------------------------------------------------------------------

exec \
"/usr/bin/iio_info" \
"-S" \
"usb"
Loading